CVE-2026-23397: nfnetlink_osf: validate individual option lengths in fingerprints
In the Linux kernel, the following vulnerability has been resolved:
nfnetlinkosf: validate individual option lengths in fingerprints
nfnlosfaddcallback() validates optnum bounds and string NUL-termination but does not check individual option length fields. A zero-length option causes nfosfmatchone() to enter the option matching loop even when foptsize sums to zero, which matches packets with no TCP options where ctx->optp is NULL:
Oops: general protection fault KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] RIP: 0010:nfosfmatchone (net/netfilter/nfnetlinkosf.c:98) Call Trace: nfosfmatch (net/netfilter/nfnetlinkosf.c:227) xtosfmatchpacket (net/netfilter/xtosf.c:32) iptdotable (net/ipv4/netfilter/iptables.c:293) nfhookslow (net/netfilter/core.c:623) iplocaldeliver (net/ipv4/ipinput.c:262) iprcv (net/ipv4/ipinput.c:573)
Additionally, an MSS option (kind=2) with length < 4 causes out-of-bounds reads when nfosfmatchone() unconditionally accesses optp[2] and optp[3] for MSS value extraction. While RFC 9293 section 3.2 specifies that the MSS option is always exactly 4 bytes (Kind=2, Length=4), the check uses "< 4" rather than "!= 4" because lengths greater than 4 do not cause memory safety issues -- the buffer is guaranteed to be at least foptsize bytes by the ctx->optsize == foptsize check.
Reject fingerprints where any option has zero length, or where an MSS option has length less than 4, at add time rather than trusting these values in the packet matching hot path.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Update the kernel netfilter OSF fingerprint matching logic so it validates each individual option length in fingerprints: reject any fingerprint containing an option with zero length, and for the MSS option (kind=2) ensure its length is exactly 4 (reject lengths < 4). This prevents nf_osf_match_one from entering the option-parsing path with invalid lengths and avoids null-ptr dereference/out-of-bounds reads.
nfnetlink_osf / nf_osf_match_one (net/netfilter/nfnetlink_osf.c) fingerprint option length validation = Reject fingerprints where any option has zero length, and where the MSS option (kind=2) has length less than 4
Event History
Frequently Asked Questions
What is the severity of CVE-2026-23397?
CVE-2026-23397 has been classified with a medium severity level due to potential impact on system stability.
How do I fix CVE-2026-23397?
To fix CVE-2026-23397, you should update to the latest version of the Linux kernel that includes the security patch.
What does CVE-2026-23397 affect?
CVE-2026-23397 affects the nfnetlink_osf component of the Linux kernel specifically.
Can CVE-2026-23397 lead to system exploitation?
Yes, CVE-2026-23397 could potentially lead to exploitation through improper handling of option lengths in fingerprints.
Is there a workaround for CVE-2026-23397 before applying a patch?
Currently, there is no established workaround for CVE-2026-23397; applying the patch is the recommended solution.