Skip to main content

Crate detonate

Crate detonate 

Source
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 in crate::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§

ExecutionProof
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), reads document.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 body would execute against a sandbox browser at url, returning whether a dialog sink fired.
detonate_html_with
Detonate body with the selected Engine, returning the proof of execution. The Chrome engine 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 silent executed: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_VECTORS with {{M}} replaced by marker.
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.