target://chained-ssti-rce
extremeOPEN
Template Preview Gateway
extremechained-bugssstiauth-bypass
// Scenario (Chained Vulnerabilities)
PreviewGateway renders admin email templates from a request dict req = {"headers": ..., "template": ..., "context": ...}.
// The Chained Bugs
- Header Auth Bypass:
is_authorizedtrustsx-forwarded-role: adminifx-internal-proxyis present (without verifying an HMAC signature on a canonical header string), AND uses prefix/substring checks onx-api-key. - Server-Side Template Injection (SSTI) -> Code Execution: Once past the gate (or even if someone calls
render_templatedirectly),{{ expr }}placeholders are evaluated witheval()/new Function(...), allowing attackers to leakGATEWAY_SECRETor execute arbitrary code via__builtins__/constructor.constructor.
// Your Task
Fix both links in the chain:
- Enforce strict constant-time HMAC-SHA256 verification of
x-gateway-sigover"{role}:{timestamp}"(with header keys case-insensitive, timestamp freshness checkabs(now_ts - ts) <= 60, androle == "admin") — ignore spoofable forwarding headers. - Eliminate
eval/new Functioncompletely: render{{ key }}placeholders strictly by looking up allowlisted plain string/number keys incontext(HTML-escaped), rejecting nested dunder/prototype property access.
Sample Sanity Checks (1)
- Authorized HMAC preview renders safe templateValid x-gateway-ts + x-gateway-sig renders {{name}}
Hints (0/3)
initializing editor...
[idle] Press RUN to execute visible sample checks, or SUBMIT to run hidden exploit & functionality suites.