My firewall allowed port 53. The packet landed on 9999
CVE-2026-139281 lets IPv6 fragments past an nftables firewall that uses conntrack. I reproduced it on Ubuntu's 7.0 kernel and tested two rules that stop it.
By Meet ModiThe fix is one word. In net/ipv6/netfilter/nf_conntrack_reasm.c, u8 prev_nhoff became int prev_nhoff. The u8 had been there since connection tracking was added to the kernel, about 20 years ago. My test firewall allowed UDP port 53 and nothing else. It logged my packet as port 53, accepted it, and the payload landed on a socket listening on port 9999.
If you run an nftables IPv6 firewall with connection tracking on Linux (anything with ct state in it), CVE-2026-139281 means a remote sender can pick the port your rules see separately from the port the kernel delivers to. Fixed upstream kernels are out for every maintained branch. Until yours is patched, a single nft rule that drops IPv6 fragments before defragmentation blocked it in my tests. Disabling IPv6, the official workaround, also works, and it is the bigger hammer.
What CVE-2026-139281 is
Jérémy Jean of ANSSI, the French national cybersecurity agency, sent the patch to netdev on August 22. The commit message describes the bug better than any summary of it: find_prev_fhdr() "returns the offset of the Next Header field before an IPv6 Fragment header through an int pointer, but stores the offset in a u8 local. An extension header chain can put this field beyond byte 255, causing the offset to wrap before it is saved in the fragment queue."
Then, the part that makes it a firewall bug and not just a corrupted packet: "A two-fragment packet can, for example, be recorded as UDP destination port 53 while its payload is delivered to UDP port 9999." The commit also carries an Assisted-by: Codex:gpt-5 tag. It does not say whether the model helped find the bug or only write the patch.
- Aug 22, 2026Patch posted publicly to netdev and netfilter-devel. Fixes: 9fb9cbb1082d, the commit that added nf_conntrack.
- Nov 23, 2026Changelogs for stable kernels 5.10.275, 5.15.226, 6.1.193, 6.6.163, 6.12.119, 6.18.65 and 7.3.6 are dated this day on kernel.org. Each one has the patch, and 6.12.118's does not.
- Nov 30, 2026The kernel's CNA publishes CVE-2026-139281 with a CVSS 3.1 score of 9.1, and Ubuntu lists it as Medium.
- Dec 3, 2026BleepingComputer writes it up as a critical 21-year-old flaw, with Red Hat's 9.1 score and its advice to disable IPv6.
Note the first gap. The patch and its description of the attack were public on a mailing list for three months before stable kernels shipped it, and for over three months before the CVE. None of the sources say anything about that gap.
Can IPv6 packets be fragmented? Yes, and that is the door
In IPv6 only the sender fragments. Routers never do. A fragmented packet carries a Fragment header, and anything that has to be read by every hop or by the destination before reassembly (Hop-by-Hop options, Destination options, a Routing header) sits in front of it in a chain. Each header says what type the next one is in its first byte, the Next Header field.
A firewall cannot judge a fragment by itself, because only the first one has the UDP or TCP header. So when conntrack is on, the kernel reassembles IPv6 fragments early, in the prerouting hook at priority -400, before your rules run. Reassembly deletes the Fragment header and has to patch the Next Header byte of whatever came before it, so the chain skips straight to UDP. find_prev_fhdr() finds that byte's offset. Here is the line, from the 7.0 source and the fix:
@@ -398,7 +398,7 @@ find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
{
u8 nexthdr = ipv6_hdr(skb)->nexthdr;
const int netoff = skb_network_offset(skb);
- u8 prev_nhoff = netoff + offsetof(struct ipv6hdr, nexthdr);
+ int prev_nhoff = netoff + offsetof(struct ipv6hdr, nexthdr);
/* later, in nf_ct_frag6_reasm(): */
skb_network_header(skb)[fq->nhoffset] = skb_transport_header(skb)[0];If the header before the Fragment header starts at byte 296, a u8 keeps 296 minus 256, which is 40. Byte 40 is the first byte after the fixed IPv6 header, which is the Next Header field of the first extension header. So reassembly writes "UDP" (17) there, and the real field at 296 keeps saying "Fragment". The packet now has a short chain that ends in a fake UDP header made of whatever bytes the sender put at offset 296.
Why the firewall and the socket disagree is in the CVE record's own scoring notes: ipv6_get_l4proto() and ipv6_find_hdr(), which conntrack and nftables use, "walk the chain from the IPv6 header and classify one L4 header, while ip6_protocol_deliver_rcu() uses IP6CB->nhoff and the reset transport header and delivers another." The firewall re-reads the damaged chain from the top. Delivery jumps to where reassembly left the transport pointer, which is the real UDP header.
I reproduced the bypass on Ubuntu's 7.0 kernel
The machine was a GitHub Actions runner on 7.0.0-1020-azure, built Oct 27, before the fix, with Ubuntu's tracker listing linux-azure as vulnerable. I set up two network namespaces joined by a veth pair: a sender, and a victim with sockets on UDP 53 and UDP 9999 behind this ruleset:
table inet fw {
chain input {
type filter hook input priority 0; policy drop;
ct state established,related accept
iifname "lo" accept
meta l4proto ipv6-icmp accept
meta l4proto udp log prefix "fw-sees: " flags all
udp dport 53 accept
counter comment "dropped by policy"
}
}Packets were built with scapy 2.8.0 and sent from the other namespace as two fragments. Nothing left the runner. I am not publishing the packet builder. The layouts and the output below are enough to check a fix against.
First, proof that the wrap happens at all. The same UDP packet to 9999, once with an 8 byte first header and once with a 256 byte one, which puts the pre-fragment header at byte 296:
fw-sees: ... OPT ( ) OPT ( ) PROTO=UDP SPT=40000 DPT=9999 LEN=88 # 8 byte header: correct
fw-sees: ... OPT ( ) PROTO=UDP SPT=11265 DPT=7692 LEN=16962 # 256 byte header: wrapped11265 is 0x2c01: Next Header 44 and length 1, the first two bytes of the second options header, now being read as a source port. 7692 is 0x1e0c, the option type and length I happened to fill it with. Both packets were dropped, which is right for a packet the firewall reads as garbage. But the firewall is now reading bytes I chose as the port.
So I chose them. With the bytes at offset 298 set to 0x00 0x35, the firewall read port 53. The first layout I tried used two Destination Options headers, and the packet passed the firewall but was never delivered: Ip6InHdrErrors went up by one. That turned out to be general. With conntrack loaded, even a legitimate fragmented packet to port 53 with a single 8 byte Destination Options header in front of the Fragment header was dropped as a header error on this kernel, while a packet with the same kind of header was delivered with no ruleset loaded. I did not dig into why.
A Hop-by-Hop header behaves differently, because the kernel parses it before netfilter runs and remembers where it ended. So: a 256 byte Hop-by-Hop header, then a 16 byte options header whose bytes double as a UDP header, then the Fragment header, then the real UDP header for port 9999. Three runs, with the two controls first:
HBH 8 bytes, DestOpt2 at 48 -> u8 48
received: (nothing) # firewall saw 9999, dropped
HBH 256 bytes, DestOpt2 at 296 -> u8 40, filler bytes
received: (nothing) # firewall saw 7692, dropped
HBH 256 bytes, DestOpt2 at 296 -> u8 40, crafted bytes
received: port 9999 got 80 bytes from fd00::1: b'AAAAAAAA|meant-for-9999|'
fw-sees: IN=vv OUT= OPT ( ) PROTO=UDP SPT=11265 DPT=53 LEN=2883
udp dport 53 counter packets 1 bytes 400 acceptThat is the commit message's example, on a real kernel. The firewall logged port 53 and accepted it. The application listening on 9999, which the ruleset was supposed to hide, got the data.
Does ct state invalid drop stop it?
Partly. A lot of rulesets start with ct state invalid drop, and the packet above was invalid as far as conntrack was concerned: the fake UDP header claimed a length of 2,883 bytes. With that rule added first, the same packet was dropped. Then I made the fake header honest. It claimed the right length (104) and carried a checksum computed for the firewall's wrong view of the packet, which conntrack checks by default (nf_conntrack_checksum = 1):
fw-sees: IN=vv OUT= OPT ( ) PROTO=UDP SPT=11265 DPT=53 LEN=104
ct state invalid counter packets 1 bytes 400 drop # the earlier packet
udp dport 53 counter packets 1 bytes 400 accept # this one
received: port 9999 got 80 bytes from fd00::1: b'AAAAAAAA|meant-for-9999|'
$ conntrack -L -f ipv6
udp 17 27 src=fd00::1 dst=fd00::2 sport=11265 dport=53 [UNREPLIED] src=fd00::2 dst=fd00::1 sport=53 dport=11265 mark=0 use=1A normal-looking new flow to the DNS port, in the table you would look at during an incident. Nothing in it says 9999.
Is my kernel vulnerable to CVE-2026-139281?
Two questions: does the kernel have the fix, and is the IPv6 defrag path active at all. The CVE record says the only precondition is an active nf_defrag_ipv6, which loads with IPv6 connection tracking.
# upstream: fixed from 5.10.275, 5.15.226, 6.1.193, 6.6.163, 6.12.119, 6.18.65, 7.3.6, 7.4-rc1
uname -r
# is the IPv6 defrag path loaded
lsmod | grep -E 'nf_defrag_ipv6|nf_conntrack '
# does your ruleset depend on conntrack
nft list ruleset | grep -E 'ct (state|status|original|reply)'On the runner, lsmod showed nf_defrag_ipv6 in use by nf_conntrack, and nf_conntrack in use by xt_MASQUERADE and nf_nat, the modules Docker's NAT rules load. My own test rules had loaded conntrack by then too, so that output does not prove it was on by default. Distribution kernels carry their own version numbers, so uname -r against the upstream list only helps on upstream kernels. For the rest, read the tracker:
- Ubuntu: priority Medium, CVSS 4.0 6.9. On Dec 3 every listed kernel package, from 16.04 to 26.10 (linux, linux-aws, linux-azure, linux-gcp and the rest), was still vulnerable.
- Debian: bookworm (6.1.192-3) and trixie (6.12.118-1) vulnerable, forky (7.3.6-1) and sid (7.3.7-1) fixed.
- Red Hat: 9.1 Critical. The page had no per-release status table when I read it.
nftables rules to drop IPv6 fragments before defrag
A rule in your normal input chain is too late: by the time it runs, the fragments have been reassembled and the damage is done. The rule has to run on each fragment, which means a prerouting chain with a priority below -400. I tested two, each added next to the strict ruleset above.
# Option 1: no IPv6 fragments at all
table inet pre {
chain raw {
type filter hook prerouting priority -450; policy accept;
exthdr frag exists counter drop
}
}
# Option 2: only fragments that also carry options or routing headers
table inet pre {
chain raw {
type filter hook prerouting priority -450; policy accept;
exthdr frag exists exthdr hbh exists counter drop
exthdr frag exists exthdr dst exists counter drop
exthdr frag exists exthdr rt exists counter drop
}
}# option 1
crafted packet: received nothing
legit fragmented UDP to 53: received nothing
plain UDP to 53: port 53 got 5 bytes
exthdr frag exists counter packets 6 bytes 1092 drop
# option 2
crafted packet: received nothing
legit fragmented UDP to 53: port 53 got 78 bytes ... meant-for-53
plain UDP to 53: port 53 got 5 bytes
exthdr frag exists exthdr hbh exists counter packets 2 bytes 728 dropTo push the patched byte past 255, the headers in front of the Fragment header have to add up to well over 200 bytes. Legitimate fragmented traffic rarely carries any. Option 2 keeps ordinary fragments working, which matters if the host receives large UDP, like big DNS answers coming back to a resolver. Option 1 is simpler and is the one I would reach for first on a server that does not need fragments, which most do not.
The CSP connect-src rule that does not cover WebRTC is the browser version of the same lesson: a rule only covers what the code under it actually reads, and you find out what that is by sending it something odd. For another kernel networking bug where the counters looked fine and the packets did not, see cgroup memory pressure throttling TCP.
Should you disable IPv6 on Linux instead?
It is the mitigation Red Hat gives, through its knowledge base article, and their own page says the catch: it disables all IPv6 connectivity. On an IPv4-only server that has IPv6 turned on by default and unused, it is a fine answer. On anything that serves users over IPv6, sits in an IPv6-only cluster, or talks to IPv6-only upstreams, it is an outage you would be causing on purpose. The prerouting rule above closes the same hole without turning anything off.
The catch: limits of what I tested
- One kernel, one host. I tested a local firewall in front of local sockets. Routers, Docker hosts and Kubernetes nodes filter forwarded traffic, and I did not test that path.
- I only tested a stateful ruleset. Whether a ruleset with no ct expressions anywhere still loads the defrag hook depends on what else on the box uses conntrack (on this runner, Docker did). I did not test a purely stateless setup.
- Option 2 covers Hop-by-Hop, Destination Options and Routing headers. find_prev_fhdr() also walks an Authentication Header, which my rule does not match. I did not test an AH chain. Option 1 does not care.
- Option 1 breaks every legitimately fragmented IPv6 packet to the host. That is usually nothing, but check before rolling it to a DNS resolver.
- The Destination Options drop I saw with conntrack on is an observation on one kernel, not something I traced to a cause.
- The scores disagree. Ubuntu's 6.9 and Canonical's "limited impact on system integrity" (quoted by BleepingComputer) may reflect that most hosts have nothing on a hidden port worth reaching. If your IPv6 firewall is the only thing between the internet and a service, the 9.1 is the one that matches what I saw.
- Distribution fixes were not out on Dec 4 for Ubuntu or Debian stable. The stopgap may be live for a while.
What is CVE-2026-139281?
CVE-2026-139281 is a Linux kernel bug in netfilter's IPv6 fragment reassembly for connection tracking. An offset stored in an 8 bit variable wraps when the extension header chain passes byte 255, so reassembly patches the wrong byte. Firewall rules and conntrack can then see a different port than the one the kernel delivers to, so a sender can reach ports the firewall blocks.
Which Linux kernel versions fix CVE-2026-139281?
Upstream fixed it in 5.10.275, 5.15.226, 6.1.193, 6.6.163, 6.12.119, 6.18.65, 7.3.6 and 7.4-rc1, with kernel.org changelogs dated November 23, 2026. Distribution kernels use their own versions, so check your distribution's tracker. On December 4, Ubuntu and Debian stable still listed their kernels as vulnerable, while Debian forky and sid had fixed packages.
Does this affect nftables and iptables?
It affects the kernel code both of them sit on. The bug is in nf_defrag_ipv6 and conntrack, which reassemble fragments before any rule runs, so nftables rules and ip6tables rules that use connection tracking both see the wrong header. I reproduced it with nftables 1.1.6. I did not test ip6tables separately, but it uses the same reassembly path in the kernel.
Can IPv6 packets be fragmented?
Yes, but only by the sender. IPv6 routers never fragment. The sender adds a Fragment header after any Hop-by-Hop, Destination Options or Routing headers, and the receiver reassembles. Linux firewalls with connection tracking reassemble fragments in prerouting before rules run, which is the step this bug breaks when the headers in front of the Fragment header are long.
How do I drop IPv6 fragments with nftables?
Add a prerouting chain with a priority below -400, so it runs before conntrack's defragmentation, and drop with exthdr frag exists. For example, type filter hook prerouting priority -450 with the rule exthdr frag exists drop. A rule in the normal input chain runs after reassembly and is too late to stop this bug.
Is it bad to disable IPv6 on Linux?
It is fine on a server that never uses IPv6, and it is Red Hat's suggested mitigation for this CVE. It is bad anywhere users, upstream services or cluster networking reach the host over IPv6, because it cuts all of that off. A prerouting nftables rule that drops IPv6 fragments closes this hole with far less collateral damage.
Why do Red Hat and Ubuntu rate CVE-2026-139281 differently?
Red Hat and the kernel CNA give it CVSS 3.1 9.1, counting full confidentiality and integrity impact because blocked services become reachable. Ubuntu gives it Medium with a CVSS 4.0 score of 6.9, and BleepingComputer quotes Canonical saying it has no impact on data confidentiality. The scoring systems differ too, so the two numbers are not directly comparable.
- netfilter: nf_conntrack: avoid truncating IPv6 nexthdr offset (commit 48d522b65fb0), Linux kernel
- [PATCH] netfilter: nf_conntrack: avoid truncating IPv6 nexthdr offset, netdev mailing list
- CVE-2026-139281, CVE
- CVE-2026-139281, Red Hat
- CVE-2026-139281, Ubuntu
- CVE-2026-139281, Debian security tracker
- nf_conntrack_reasm.c at v7.0, GitHub (torvalds/linux)
- Critical 21-year-old Linux flaw lets hackers bypass firewall rules, BleepingComputer
More Posts
Redis TLS clients hang at connection 1024, and plain TCP never notices
Redis 8.0 to 8.12.0 with TLS can leave a client stuck in the handshake once the server passes 1024 connections. Fixed in 8.12.1, 8.10.4 and four more.
Chrome is about to distrust the CA that signs google.com
Chrome stops trusting ECDSA P-256 CA keys on March 15, 2027. Google Trust Services WE1 and WE2 are P-256, and 146 of 770 top sites I scanned chain to one.
Laravel Go is a quarter slower than Laravel Rust. It rebuilds 35 times faster
Laravel Go served 1,318 req/s to Laravel Rust's 1,724 on one core in my rerun, then rebuilt in 2.9 s to Rust's 1 min 42 s. Here is the trade.