netfilter: nf_tables: fix inverted genmask check in nft_map_catchall_activate()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 628bd3e49cba1c066228e23d71a852c23e26da73 · < f41c5d151078c5348271ffaf8e7410d96f2d82f8| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
netfilter: nf_tables: fix inverted genmask check in nft_map_catchall_activate()
nft_map_catchall_activate() has an inverted element activity check compared to its non-catchall counterpart nft_mapelem_activate() and compared to what is logically required.
nft_map_catchall_activate() is called from the abort path to re-activate catchall map elements that were deactivated during a failed transaction. It should skip elements that are already active (they don't need re-activation) and process elements that are inactive (they need to be restored). Instead, the current code does the opposite: it skips inactive elements and processes active ones.
Compare the non-catchall activate callback, which is correct:
nft_mapelem_activate(): if (nft_set_elem_active(ext, iter->genmask)) return 0; /* skip active, process inactive */
With the buggy catchall version:
nft_map_catchall_activate(): if (!nft_set_elem_active(ext, genmask)) continue; /* skip inactive, process active */
From the CVE record · Linux
An inverted activity check in the Linux kernel’s nftables catchall map handling can leave a chain reference count unrestored after an aborted DELSET operation, leading to a use-after-free. An unprivileged local user can exploit this for privilege escalation on distributions with CONFIG_USER_NS and CONFIG_NF_TABLES enabled; no separate authentication or user interaction is described.
Administrators running Linux kernels on distributions with CONFIG_USER_NS and CONFIG_NF_TABLES enabled should check whether their kernels are affected; no affected versions are specified.