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/mojo_fuzz_harness.py
View on GitHub#!/usr/bin/env python3
"""
mojo_fuzz_harness.py — Mojo IPC attack-surface enumeration + mutation fuzzer skeleton.
USAGE:
# Enumerate renderer-reachable Mojo interfaces from a Chromium checkout:
python3 mojo_fuzz_harness.py --list-interfaces /path/to/chromium/src
# Fuzz one broker-exposed interface for handle/logic/memory bugs:
python3 mojo_fuzz_harness.py --chromium /path/to/chromium/src \
--interface blink.mojom.FileSystemAccessManager \
--mutate handles,indices,lifetimes --iters 200000 --crash-dir ./crashes
# Triage a saved crashing message for broker-side impact:
python3 mojo_fuzz_harness.py --triage ./crashes/000123.bin --chromium /path/to/chromium/src
PURPOSE:
Targets the two dominant 2024-2026 renderer->browser escape classes:
* Mojo HANDLE-CONFUSION / logic bugs (CVE-2025-2783 "ForumTroll", CVE-2025-4609 ipcz):
the broker trusts a handle/arg it shouldn't. We mutate handle TYPES and permission-relevant
fields to find places the broker skips validation.
* Mojo-reachable MEMORY bugs (GPU process Dawn/WebGPU, ANGLE): OOB indices / lifetime
(UAF) violations in interface messages -> crashes in a privileged process.
DEPENDENCIES: python3.8+. To actually drive a target you need a Chromium build with the
`mojo_core` test harness / a renderer-side message injector; this script provides the
interface parser, the structurally-aware mutator, the corpus/crash plumbing, and the
replay/triage hooks. Wire `_send_to_target()` to your injector (e.g. a patched content_shell
or a Frida agent hooked into the renderer's mojo bindings).
"""
import argparse, os, re, sys, json, random, struct, hashlib, glob, subprocess, time
MOJOM_GLOB = "**/*.mojom"
# ---------------------------------------------------------------------------
# 1) Enumerate interfaces / methods from .mojom files (structurally-aware surface map)
# ---------------------------------------------------------------------------
IFACE_RE = re.compile(r'interface\s+(\w+)\s*\{', re.M)
METHOD_RE = re.compile(r'^\s*([A-Za-z_]\w*)\s*\(([^;]*?)\)\s*(=>\s*\([^;]*?\))?\s*;', re.M)
HANDLE_HINTS = ("handle", "pending_remote", "pending_receiver", "ScopedHandle",
"platform_handle", "DataPipe", "MessagePipe", "SharedBuffer")
def list_interfaces(src_root):
surface = {}
for path in glob.glob(os.path.join(src_root, MOJOM_GLOB), recursive=True):
try:
text = open(path, "r", encoding="utf-8", errors="ignore").read()
except OSError:
continue
for m in IFACE_RE.finditer(text):
iface = m.group(1)
block = text[m.end():]
depth, end = 1, 0
for i, ch in enumerate(block): # find matching close brace
if ch == "{": depth += 1
elif ch == "}":
depth -= 1
if depth == 0: end = i; break
body = block[:end]
methods = []
for mm in METHOD_RE.finditer(body):
name, params = mm.group(1), mm.group(2)
has_handle = any(h in params for h in HANDLE_HINTS)
methods.append({"name": name, "params": params.strip(),
"has_handle": has_handle})
if methods:
surface.setdefault(iface, {"file": os.path.relpath(path, src_root),
"methods": methods})
return surface
# ---------------------------------------------------------------------------
# 2) Structurally-aware mutator (handles / indices / lifetimes)
# ---------------------------------------------------------------------------
class MojoMutator:
def __init__(self, modes, seed=None):
self.modes = set(modes)
self.rng = random.Random(seed)
def mutate(self, msg: bytes) -> bytes:
b = bytearray(msg)
if not b:
return bytes(self.rng.randbytes(self.rng.randint(8, 64)))
if "handles" in self.modes:
b = self._mut_handles(b)
if "indices" in self.modes:
b = self._mut_indices(b)
if "lifetimes" in self.modes:
b = self._mut_lifetimes(b)
if not self.modes: # generic bitflip fallback
for _ in range(self.rng.randint(1, 4)):
i = self.rng.randrange(len(b)); b[i] ^= 1 << self.rng.randrange(8)
return bytes(b)
def _mut_handles(self, b):
# Mojo serializes handle slots as 4-byte indices near the message tail. Swap a handle
# index to point at a DIFFERENT handle (type confusion) or to an invalid/self index.
if len(b) >= 8:
off = self.rng.randrange(max(1, len(b) - 4))
choice = self.rng.choice([0x00000000, 0xffffffff,
self.rng.randrange(0, 8)]) # alias another slot
struct.pack_into("<I", b, off, choice)
return b
def _mut_indices(self, b):
# Flip a 4/8-byte field to a boundary value to probe OOB read/write index handling.
if len(b) >= 8:
off = self.rng.randrange(max(1, len(b) - 8))
val = self.rng.choice([0xffffffff, 0x7fffffff, 0x80000000,
0x100000000, 0xffffffffffffffff])
try: struct.pack_into("<Q", b, off, val & 0xffffffffffffffff)
except struct.error: pass
return b
def _mut_lifetimes(self, b):
# Duplicate/reorder request IDs to provoke double-handling / UAF on interface objects.
if len(b) >= 16:
cut = self.rng.randrange(8, len(b))
b = b[:cut] + b[max(0, cut - 8):cut] + b[cut:] # replay an 8-byte window
return b
# ---------------------------------------------------------------------------
# 3) Target driver (wire to your injector) + crash detection
# ---------------------------------------------------------------------------
def _send_to_target(chromium_src, interface, payload) -> dict:
"""
Replace with a real injector. Expected return:
{"crashed": bool, "process": "browser"|"gpu"|"renderer", "signal": str, "stack": str}
Reference integration points:
* patched content_shell exposing a --mojo-replay fd, or
* Frida agent hooked into the renderer's mojo::Connector::Accept to inject `payload`.
"""
# Placeholder: emulate a target so the harness loop is runnable end-to-end.
crashed = (payload[:1] == b"\xff") and (len(payload) > 24)
proc = "browser" if (payload and payload[-1] & 1) else "gpu"
return {"crashed": crashed, "process": proc,
"signal": "SIGSEGV" if crashed else "", "stack": ""}
def _seed_message(interface):
# Minimal Mojo message header stand-in: [num_bytes][version][interface_id][name][flags]...
return struct.pack("<IIQII", 24, 0, abs(hash(interface)) & 0xffffffffffffffff, 0, 0)
def fuzz(chromium_src, interface, modes, iters, crash_dir, seed):
os.makedirs(crash_dir, exist_ok=True)
mut = MojoMutator(modes, seed)
base = _seed_message(interface)
found = 0
t0 = time.time()
for i in range(iters):
payload = mut.mutate(base)
res = _send_to_target(chromium_src, interface, payload)
if res["crashed"]:
digest = hashlib.sha1(payload).hexdigest()[:12]
fn = os.path.join(crash_dir, f"{i:08d}_{res['process']}_{digest}.bin")
with open(fn, "wb") as f: f.write(payload)
meta = {"iter": i, "interface": interface, **res}
with open(fn + ".json", "w") as f: json.dump(meta, f, indent=2)
found += 1
print(f"[+] CRASH iter={i} proc={res['process']} sig={res['signal']} -> {fn}")
if i and i % 20000 == 0:
rate = i / max(1e-6, time.time() - t0)
print(f"[*] {i}/{iters} crashes={found} {rate:.0f}/s")
print(f"[=] done: {found} crashes in {iters} iters")
return found
def triage(crash_file, chromium_src):
payload = open(crash_file, "rb").read()
res = _send_to_target(chromium_src, "replay", payload)
impact = "PRIVILEGED-PROCESS (browser/broker)" if res["process"] == "browser" \
else "GPU-PROCESS (less-restricted sandbox)"
print(json.dumps({"file": crash_file, "size": len(payload),
"reproduced": res["crashed"], "process": res["process"],
"impact": impact, "signal": res["signal"]}, indent=2))
print("[*] next: confirm a security-relevant effect (broker file write / process launch,\n"
" or controllable GPU-process deref) before scoring exploitability.")
def main():
ap = argparse.ArgumentParser(description="Mojo IPC surface enumerator + mutation fuzzer")
ap.add_argument("--chromium", help="path to chromium/src")
ap.add_argument("--list-interfaces", metavar="SRC",
help="enumerate Mojo interfaces from a chromium/src checkout")
ap.add_argument("--interface", help="target interface, e.g. blink.mojom.FileSystemAccessManager")
ap.add_argument("--mutate", default="handles,indices,lifetimes",
help="comma list: handles,indices,lifetimes (default all)")
ap.add_argument("--iters", type=int, default=100000)
ap.add_argument("--crash-dir", default="./crashes")
ap.add_argument("--seed", type=int, default=None)
ap.add_argument("--triage", metavar="CRASH", help="triage a saved crashing message")
args = ap.parse_args()
if args.list_interfaces:
surface = list_interfaces(args.list_interfaces)
# Prioritise handle-bearing methods (most likely handle-confusion candidates).
for iface, info in sorted(surface.items()):
hcount = sum(1 for m in info["methods"] if m["has_handle"])
print(f"{iface} ({info['file']}) methods={len(info['methods'])} handle_methods={hcount}")
for m in info["methods"]:
if m["has_handle"]:
print(f" [H] {m['name']}({m['params'][:80]})")
print(f"\n[=] {len(surface)} interfaces; [H] = passes a handle (prime handle-confusion target)")
return
if args.triage:
triage(args.triage, args.chromium or "."); return
if not args.interface:
ap.error("need --interface to fuzz (or --list-interfaces / --triage)")
fuzz(args.chromium or ".", args.interface,
[m for m in args.mutate.split(",") if m], args.iters, args.crash_dir, args.seed)
if __name__ == "__main__":
main()
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 |