netfilter: flowtable: avoid num_encaps underflow on bridge VLAN untag
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ e990cef6516daa4e1e236433579e333f74fd38cb · < e052f920773b73be49eb4d8702a9f85de7464363| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
netfilter: flowtable: avoid num_encaps underflow on bridge VLAN untag
The DEV_PATH_BR_VLAN_UNTAG case post-decrements info->num_encaps inside WARN_ON_ONCE(). num_encaps is u8, so if it's already 0 the decrement still happens and wraps it to 255. The break only leaves the inner switch -- a later path entry can set info->indev back to a real device, and we end up returning with num_encaps == 255.
nft_dev_forward_path() then walks info.encap[] (size 2) up to num_encaps, which means an OOB stack read and a bogus count copied into the route descriptor.
Should only happen on a malformed bridge path stack, hence the WARN, but worth handling sanely. Move the decrement out of the WARN.
[ While at this, remove the WARN_ON_ONCE since this can only happen with a buggy bridge path stack --pablo ].
From the CVE record · Linux
A malformed bridge path stack can cause an unsigned encapsulation count to underflow in the Linux kernel’s netfilter flowtable. A subsequent path walk can read beyond a two-entry stack array and copy a bogus count into a route descriptor. The input does not establish how an attacker could trigger this condition or whether authentication or user interaction is required.
Engineers running Linux kernels with netfilter flowtable should check their versions against the vendor advisory; affected versions were not provided.