DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [DPDK/other Bug 2152] ip_frag: IPv6 fragmentation overflows pkts_out on short first segment
Date: Fri, 20 Nov 2026 18:29:52 +0000	[thread overview]
Message-ID: <bug-2152-3@https.bugs.dpdk.org/> (raw)

https://bugs.dpdk.org/show_bug.cgi?id=2152

            Bug ID: 2152
           Summary: ip_frag: IPv6 fragmentation overflows pkts_out on
                    short first segment
           Product: DPDK
           Version: 26.11
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: other
          Assignee: dev@dpdk.org
          Reporter: stephen@networkplumber.org
  Target Milestone: ---
             Group: security

```
============================================================================
ANT-2026-CN4C9II5  [high]  CWE-787  memory-safety
ip_frag: IPv6 fragmentation overflows pkts_out on short first segment
Location: lib/ip_frag/rte_ipv6_fragmentation.c:190  in
rte_ipv6_fragment_packet()
Commit:   9a45341f18a1ab47af7123e63d942b90c1b79f38
============================================================================
```

A remote sender can make `rte_ipv6_fragment_packet()` in lib/ip_frag write
thousands of mbuf pointers past the end of the caller's `pkts_out[]` array,
crashing the data-path process. This affects applications that reassemble IPv4
fragments, strip the outer header, and then fragment the inner IPv6 packet to a
smaller MTU. The unmodified `examples/ipsec-secgw --reassemble` is one such
application. A genuine ESP packet, re-cut so that its first IPv4 fragment ends
inside the inner IPv6 header, crashes it, and re-cutting needs no key because
outer fragmentation is not authenticated. For an unauthenticated tunnel such as
6in4, any remote sender can do it with three ordinary frames.

The root cause is a missing length check. `rte_ipv4_fragment_packet()` rejects
a first segment shorter than the IP header (added in 1edf7a796d), but the IPv6
function sets `in_seg_data_pos = 40`
(`lib/ip_frag/rte_ipv6_fragmentation.c:105`) without checking that the first
segment holds 40 bytes. When it holds fewer, `data_len - in_seg_data_pos` wraps
in unsigned arithmetic and the end-of-segment equality test never fires. The
loop then keeps allocating fragments until a mempool is empty, storing each one
at `pkts_out[out_pkt_pos]` (line 190) without consulting `nb_pkts_out`. The
sender controls the first segment's length because IPv4 reassembly chains
fragments in arrival order, so after `rte_pktmbuf_adj()` that segment holds
only the first few bytes of the inner header.

The number of pointers written equals the number of free mbufs (8189 in one
test), and the values are mbuf addresses, not sender-chosen bytes. Nothing
beyond a crash has been shown. The attached reproducer is a small 6in4 endpoint
built with ASan. With a 48-byte first fragment, the packet is forwarded as two
fragments. With an 8-byte first fragment and otherwise identical bytes, ASan
reports a stack-buffer-overflow write at line 190, and a plain build dies with
SIGSEGV.

-- 
You are receiving this mail because:
You are the assignee for the bug.

             reply	other threads:[~2026-11-20 18:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 18:29 bugzilla [this message]
2026-11-20 18:31 ` [DPDK/other Bug 2152] ip_frag: IPv6 fragmentation overflows pkts_out on short first segment bugzilla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-2152-3@https.bugs.dpdk.org/ \
    --to=bugzilla@dpdk.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox