CVE-2026-52942: netfilter: nf_log: validate MAC header was set before dumping it
In the Linux kernel, the following vulnerability has been resolved:
netfilter: nflog: validate MAC header was set before dumping it
The fallback path of dumpmacheader() guards the MAC header access only with "skb->macheader != skb->networkheader", without checking skbmacheaderwasset(). When the MAC header is unset, macheader is 0xffff, so the test passes and skbmacheader(skb) returns skb->head + 0xffff, ~64 KiB past the buffer; the loop then reads dev->hardheaderlen bytes out of bounds into the kernel log.
This is reachable via the netdev logger: nflogunknownpacket() calls dumpmacheader() unconditionally, and an skb sent through AFPACKET with PACKETQDISCBYPASS reaches the egress hook with macheader still unset (devqueuexmit(), which would reset it, is bypassed).
Add the skbmacheaderwasset() check the ARPHRDETHER path already uses, and replace the open-coded MAC header length test with skbmacheaderlen(). Only skbs with an unset MAC header are affected; valid ones are dumped as before.
BUG: KASAN: slab-out-of-bounds in dumpmacheader (net/netfilter/nflogsyslog.c:831) Read of size 1 at addr ffff88800ea49d3f by task exploit/148 Call Trace: kasanreport (mm/kasan/report.c:595) dumpmacheader (net/netfilter/nflogsyslog.c:831) nflognetdevpacket (net/netfilter/nflogsyslog.c:938 net/netfilter/nflogsyslog.c:963) nflogpacket (net/netfilter/nflog.c:260) nftlogeval (net/netfilter/nftlog.c:60) nftdochain (net/netfilter/nftablescore.c:285) nftdochainnetdev (net/netfilter/nftchainfilter.c:307) nfhookslow (net/netfilter/core.c:619) nfhookdirectegress (net/packet/afpacket.c:257) packetxmit (net/packet/afpacket.c:280) packetsendmsg (net/packet/afpacket.c:3114) syssendto (net/socket.c:2265)
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 6.6.143.1-1 - Configuration
Update the Linux kernel/netfilter logging code so dump_mac_header() validates the skb MAC header state (e.g., only dump when skb_mac_header_was_set() is true) rather than unconditionally reading MAC header fields when the MAC header is unset.
netfilter nf_log_syslog (Linux kernel) validate MAC header was set before dumping it in dump_mac_header() = enabled
Event History
Frequently Asked Questions
What is the severity of CVE-2026-52942?
CVE-2026-52942 has a risk score of 48, indicating a moderate vulnerability in the Linux kernel.
How do I fix CVE-2026-52942?
To address CVE-2026-52942, ensure you update to the patched version of the Linux kernel provided by your distribution.
What systems are affected by CVE-2026-52942?
CVE-2026-52942 affects the Linux kernel, specifically systems utilizing the netfilter component.
What aspects of the Linux kernel are impacted by CVE-2026-52942?
CVE-2026-52942 impacts the handling of MAC headers in netfilter's logging functionality.
Is CVE-2026-52942 a common vulnerability?
While not widely discussed, CVE-2026-52942 poses a significant risk and should be addressed promptly in affected systems.