# CVE-2026-98096: ipv6: sr: restore network header before routing and forwarding

The Markdown version of <https://upatch.dev/cve/CVE-2026-98096>. Last updated 25 Nov 2026.

## At a glance

CVE-2026-98096 is rated High 7.4 (CVSS 3.1, CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:H). It affects the Linux kernel and was published on 25 Sept 2026. It is not in CISA's Known Exploited Vulnerabilities catalog. Its EPSS score is 0.5%: the estimated chance it is exploited in the next 30 days, as of 24 Nov 2026. The upatch `cve-2026-98096-srh-block` mitigates it, and is vetted (merged into the registry).

A upatch is a signed BPF program that shirudo loads into a running Linux kernel to block the code path this CVE's exploit takes. It holds the line until the fix ships; it does not replace patching.

## The vulnerability

CVE-2026-98096, "ipv6: sr: restore network header before routing and forwarding", was published on 25 September 2026. `ipv6_srh_rcv()` in `net/ipv6/exthdrs.c` runs with `skb->data` pointing at the Segment Routing Header while `skb_network_header()` points at the fixed IPv6 header. When `segments_left > 0`, `ipv6_srh_rcv()` restored `skb->data` before routing by pushing `sizeof(struct ipv6hdr)` (40 bytes), assuming the SRH immediately followed the fixed IPv6 header. When another extension header such as a Hop-by-Hop options header precedes the SRH, `skb_network_offset(skb)` remains negative during `ip6_route_input()`, breaking `__skb_flow_dissect()` and causing downstream forwarding handlers such as `ip6_forward()` or `sch_fragment()` to pass the negative offset as an unsigned length, triggering out-of-bounds memory copies or buffer overflows.

### Official description

In the Linux kernel, the following vulnerability has been resolved:

ipv6: sr: restore network header before routing and forwarding

ipv6_srh_rcv() runs with skb->data at the Segment Routing Header (SRH) while skb_network_header() points at the IPv6 header.

When segments_left > 0, ipv6_srh_rcv() previously restored the skb->data position by pushing sizeof(struct ipv6hdr), assuming the SRH immediately followed the fixed IPv6 header. If another extension header (such as a Hop-by-Hop options header) precedes the SRH, skb_network_offset() remained negative.

This led to two problems: 1. During ip6_route_input(), fib6_rules_early_flow_dissect() invokes \_\_skb_flow_dissect() which passes the negative skb_network_offset() to flow dissection, breaking BPF and C flow dissector logic. 2. If forwarded via ip6_forward() or redirected via act_mirred, downstream handlers (like sch_fragment() or neighbour output) pass the negative offset as an unsigned length, triggering OOB memcpy or buffer overflows.

Fix this by pushing -skb_network_offset(skb) before routing, ensuring skb_network_offset(skb) is 0 for route lookup / flow dissection as well as downstream forwarding. On the loopback path, pull skb_transport_offset(skb) to restore skb->data to the SRH before looping back.

## What the upatch does

It attaches to `netfilter` (IPv6 `NF_INET_PRE_ROUTING`), which runs in `ipv6_rcv()` before `ip6_rcv_finish()` and `ipv6_srh_rcv()`, and inspects incoming IPv6 packets whose `nexthdr` is an IPv6 extension header using `bpf_dynptr_from_skb()` and `bpf_dynptr_slice()`. When a packet carries an extension header chain in which a routing header of type `IPV6_SRCRT_TYPE_4` (4) with `segments_left > 0` appears after one or more preceding extension headers, or when an extension header chain cannot be parsed within 8 extension headers, the program returns `NF_DROP` (`0`). Packets without IPv6 extension headers return `NF_ACCEPT` (`1`) after reading the single `nexthdr` byte.

The policy: [`cve-2026-98096-srh-block.bpf.c`](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2026-98096), 87 lines of BPF C attached at `netfilter`, licensed GPL-2.0 OR BSD-2-Clause.

## Side effects

- Incoming IPv6 packets that place another extension header (such as Hop-by-Hop options or Destination options) before a Segment Routing Header with `segments_left > 0`, or that chain more than 8 IPv6 extension headers before a non-extension payload, are dropped at IPv6 pre-routing.
- Incoming IPv6 packets without extension headers, with a Segment Routing Header immediately following the fixed IPv6 header, or with `segments_left == 0` pass unchanged.
- All IPv4 traffic passes unchanged.

## Preemption model and cost

The program keeps no state: no maps, no shared or per-CPU data. It is correct under every preemption model, including preemptible RCU and `PREEMPT_RT`. It never runs on IPv4 packets; for ordinary IPv6 packets without extension headers it reads the single `nexthdr` byte via `bpf_dynptr_slice()` and compares it against six extension header protocol numbers. It walks the extension header chain (bounded to 8 headers) only when an IPv6 extension header is present.

## Affected versions

| Branch   | Bug added in | Fixed in |
| -------- | ------------ | -------- |
| 5.10     | 4.10         | 5.10.271 |
| 5.15     | 4.10         | 5.15.222 |
| 6.1      | 4.10         | 6.1.189  |
| 6.6      | 4.10         | 6.6.158  |
| 6.12     | 4.10         | 6.12.111 |
| 6.18     | 4.10         | 6.18.53  |
| 7.2      | 4.10         | 7.2.7    |
| mainline | 4.10         | 7.3      |

## How it was tested

With seg6_enabled active on loopback, the netfilter IPv6 pre-routing upatch dropped IPv6 packets with a Hop-by-Hop options header preceding a Segment Routing Header with segments_left > 0 while allowing ordinary IPv6 UDP traffic. The test kernel 7.4 already contains the upstream fix, so the unpatched run shows the packet reaching ipv6_srh_rcv() and being delivered.

- **Tested:** 25 Nov 2026
- **Target:** Linux 7.4 with the fix and net.ipv6.conf.{all,lo}.seg6_enabled=1
- **Kernel:** 7.4-shirudo-ci-20261123
- **Architecture:** x86_64
- **Machine:** shirudo test VM

### Results

| State           | Hop-by-Hop + SRH (segments_left=1) UDP loopback | Ordinary IPv6 UDP loopback |
| --------------- | ----------------------------------------------- | -------------------------- |
| Before loading  | delivered                                       | delivered                  |
| Upatch loaded   | dropped at NF_INET_PRE_ROUTING                  | delivered                  |
| After unloading | delivered                                       | delivered                  |

## How to apply

Build the upatch from source, sign it with your own shirudo key, and publish it to your own OCI registry. Machines that follow your upatch tree load it within about a minute.

Build and sign:

```sh
git clone https://github.com/copper-helm/upatch-registry
cd upatch-registry
tools/build <shirudo-checkout> <keys-dir> 1.0.0 upatches/cve-2026-98096
```

Publish and roll out:

```sh
shirudo bpm push build/packages/cve-2026-98096-1.0.0.bee oci://<registry>/<namespace>/cve-2026-98096 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-98096-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>
```

## Review

- Contributors: romanlab.
- Reviewers: none recorded yet.

## Sources and links

- [CVE-2026-98096 announcement with affected and fixed versions](https://git.kernel.org/pub/scm/linux/security/vulns.git/plain/cve/published/2026/CVE-2026-98096.mbox)
- [Upstream fix commit 975b5b067f52](https://git.kernel.org/stable/c/975b5b067f525a1b1338c4a3bee1c46545801518)
- [Stable fix commit 3ad7dca5e03b](https://git.kernel.org/stable/c/3ad7dca5e03bd64c65983a19734337512fd75491)
- [Stable fix commit 97b21ef57dfa](https://git.kernel.org/stable/c/97b21ef57dfabbff660a4672c9fef7edfb720f47)
- [Stable fix commit ce4c8beedc19](https://git.kernel.org/stable/c/ce4c8beedc19aceeab0e7bdc6f34394fb158c47c)
- [Stable fix commit af08f62b5a5a](https://git.kernel.org/stable/c/af08f62b5a5a446d6134a92d86771d3d12e0e3da)
- [Stable fix commit 9cfbe2c381ab](https://git.kernel.org/stable/c/9cfbe2c381ab6d00a08e7a5b6028865adfb4e1bc)
- [Stable fix commit 8f44d4160bcd](https://git.kernel.org/stable/c/8f44d4160bcdb3136a9145a4b9c7816382976925)
- [Stable fix commit f463c4786cf2](https://git.kernel.org/stable/c/f463c4786cf27376de7dfc0833a12e924a98f698)

### Links

- [CVE-2026-98096 on upatch.dev](https://upatch.dev/cve/CVE-2026-98096) (this page, as HTML)
- [NVD](https://nvd.nist.gov/vuln/detail/CVE-2026-98096)
- [CVE.org](https://www.cve.org/CVERecord?id=CVE-2026-98096)
- [CWE-787](https://cwe.mitre.org/data/definitions/787.html)
- Upatch source: [upatches/cve-2026-98096](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2026-98096)

### More references from NVD (8)

- [git.kernel.org](https://git.kernel.org/stable/c/3ad7dca5e03bd64c65983a19734337512fd75491) (Patch)
- [git.kernel.org](https://git.kernel.org/stable/c/8f44d4160bcdb3136a9145a4b9c7816382976925) (Patch)
- [git.kernel.org](https://git.kernel.org/stable/c/975b5b067f525a1b1338c4a3bee1c46545801518) (Patch)
- [git.kernel.org](https://git.kernel.org/stable/c/97b21ef57dfabbff660a4672c9fef7edfb720f47) (Patch)
- [git.kernel.org](https://git.kernel.org/stable/c/9cfbe2c381ab6d00a08e7a5b6028865adfb4e1bc) (Patch)
- [git.kernel.org](https://git.kernel.org/stable/c/af08f62b5a5a446d6134a92d86771d3d12e0e3da) (Patch)
- [git.kernel.org](https://git.kernel.org/stable/c/ce4c8beedc19aceeab0e7bdc6f34394fb158c47c) (Patch)
- [git.kernel.org](https://git.kernel.org/stable/c/f463c4786cf27376de7dfc0833a12e924a98f698) (Patch)
