Expand description
detonate: prove an injected web payload actually executes, not just
reflects.
WAF-bypass ≠ exploit, and reflection ≠ execution: a payload can pass a WAF
and even echo back in the response yet never reach a context where its
JavaScript runs. This crate is the execution oracle that separates “the
bytes came back” from “the script ran”, it extracts the JavaScript an HTTP
response would execute, runs it in Santh’s [jsdet] sandbox (QuickJS
compiled to WASM, every API call observed) behind a DOM/browser bridge, and
reports whether a dialog sink (alert / confirm / prompt) fired, the
minimal, false-positive-free proof of cross-site scripting.
Shared so any Santh tool can gate a finding on real execution. The
canonical use is the classic proof payload alert(1):
let proof = detonate::detonate_html(
r#"<div><script>alert(1)</script></div>"#,
"https://target.example/reflect",
);
assert!(proof.proves("1")); // alert fired with argument "1"Modules§
- breakout
- Context-breakout XSS vectors, payloads that ESCAPE a specific reflection
context (quoted attribute, JS string literal,
javascript:URI) and execute. The offensive complement to the body/markup vectors incrate::mutation. - chrome
- Real-browser (headless Chrome) detonation engine.
- mutation
- Mutation-XSS & browser-only execution vectors, the catalog the chrome engine can validate but jsdet structurally cannot.
Structs§
- Execution
Proof - Proof that injected JavaScript executed in a response.
- SinkHit
- A dangerous capability the injected JavaScript reached, evidence it both
EXECUTED and did something exploitable. Real-world XSS rarely calls
alert; it exfiltrates (fetch/image to an attacker), readsdocument.cookie,evals attacker code, or writes the DOM. Each of these is reachable only by running JS, so any hit proves execution.
Enums§
- Engine
- Which detonation engine to run a candidate response through.
Constants§
- EXEC_
PRESERVING_ VECTORS - Execution-PRESERVING XSS evasion vectors.
Functions§
- detonate_
html - Detonate the JavaScript an HTML response
bodywould execute against a sandbox browser aturl, returning whether a dialog sink fired. - detonate_
html_ with - Detonate
bodywith the selectedEngine, returning the proof of execution. TheChromeengine falls back to jsdet when no browser binary is available, so a caller that requests the accurate oracle still gets a real answer on a host without Chrome rather than a silentexecuted:false. - detonate_
scripts - Detonate an explicit list of JavaScript fragments (each run as a top-level script) and report the first dialog sink that fired. Lower-level entry point for callers that already isolated the injected JS.
- exec_
preserving_ vectors - The
EXEC_PRESERVING_VECTORSwith{{M}}replaced bymarker. - extract_
executable_ js - Extract the JavaScript a reflected HTML response would execute, parsed with
an HTML5-spec parser (html5ever via
scraper) so it is BROWSER-ACCURATE.