🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by zhuorao yang Tue, 01 Dec 2026 03:11
[PATCH net] net: ipv4: reject invalid fragment ranges
#24942
Author: zhuorao yang
Date: Tue, 01 Dec 2026 03:11
61 lines
12666 bytes
inet_frag_queue_insert() assumes offset is smaller than end when it
inserts a fragment into the interval tree. nf_ct_frag6_queue() can
violate that assumption for an unclipped IPv6 skb: payload_len minus
the extension header length underflows, leaving end smaller than
offset.

The invalid range then enters the left subtree and breaks the rbtree
ordering. Reassembly can select a non-first fragment as the head,
triggering inet_frag_reasm_prepare()'s WARN_ON(). On current mainline,
the misplaced head also reaches the conditional one-byte out-of-bounds
write in nf_ct_frag6_reasm().

Reject end <= offset in the shared insertion helper before inserting
the range.

Fixes: c23f35d19db3 ("net: IP defrag: encapsulate rbtree defrag code into callable functions")
Signed-off-by: zhuorao yang <alex000young@gmail.com>
---

Vulnerability report

Affected versions: Linux 7.4.0-rc5 at
  fe6ff8d5d675c01793b9f051d16055dd4aa75244; the rbtree form dates to
  v5.1.
Trigger conditions: CONFIG_USER_NS and CONFIG_NET_ACT_CT. A local user
  can create a user and network namespace, configure tc ingress ct
  processing, and send the malformed IPv6 fragments. The same path is
  reachable from network traffic when such pre-L3 conntrack
  defragmentation is deployed.
Reproducer status: A QEMU/KASAN reproduction on 7.4.0-rc5 reaches
  inet_frag_queue_insert(offset=8, end=0), triggers the
  inet_frag_reasm_prepare() WARN_ON(), and reports a one-byte KASAN
  write in nf_ct_frag6_gather(). The fixed kernel completes the same
  test without the warning or KASAN report. Reproducer material is
  available to maintainers on request.
Reproducer material is intentionally withheld from this public message.

AI assistance: DeepSeek identified the issue and drafted the patch.
The submitter reviewed the code and certified the Developer Certificate
of Origin.

 net/ipv4/inet_fragment.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index f330d0a39823..9f3b632f5753 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -444,6 +444,9 @@ int inet_frag_queue_insert(struct inet_frag_queue *q, struct sk_buff *skb,
 {
 	struct sk_buff *last = q->fragments_tail;
 
+	if (end <= offset)
+		return IPFRAG_OVERLAP;
+
 	/* The reassembled skb keeps the first fragment's secpath. */
 	if (last && !secpath_equal(last, skb))
 		return IPFRAG_MIXED_SECPATH;
-- 
2.56.0
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads