Hack The Box - Chatterbox (Medium)

Summary

Nmap finds AChat on port 9256. The initial foothhold is trivial: we use AChat Remote Buffer Overflow to get a user shell as alfred.

In the privilege escalation phase, we find a credential in registry. Using this credential, we can construct port forwarding and use winexe to spawn a SYSTEM shell.

HTB now filters all outbound connections going through port 22, so we have to map SSH to some other port.

IP

  • RHOST: 10.129.29.216

  • LHOST: 10.10.14.79

Nmap

Port 9255 and 9256 are open. The service running on port 9256 is AChat.

User Shell: AChat Remote Buffer Overflow

Searchsploit:

searchsploit

The exploit uses shellcode and we have to generate our own shellcode. Generate shellcode using Msfvenom:

Update the exploit, start a Netcat listener on port 443 and run the exploit:

User shell

Now we have a user shell as chatterbox\alfred.

Privilege Escalation: Port Forwarding with plink.exe

The victim machine runs 32-bit Windows 7:

systeminfo

Search for passwords in registry:

We find Welcome1!:

Welcome1!

Query this registry:

Here we learn that the username is Alfred:

Alfred

Note that SMB is running on internal ports 139 and 445:

SMB

Although we can't access these ports publicly, it is possible to gain this access using port forwarding.

On our attack machine, edit /etc/ssh/sshd_config:

/etc/ssh/sshd_config

Restart SSH service:

Download 32-bit plink.exe:

Transfer it to the victim machine:

Port forwarding:

However, we are getting a "connection timed out" error:

Connection timed out

Recall that port forwarding is a SSH feature. This is because now HTB firewall rule filters any outbound connections on port 22. This was anonced in the HTB discord server:

HTB discord anoncement

Here we can edit /etc/ssh/sshd_config and map SSH to some other port, for example, port 2222:

/etc/ssh/sshd_config revisited

Restart the SSH service again:

Do port forward again, but this time we set the port to 2222:

Press "Enter" a few times until you see the output. Spawn a root shell using winexe:

Again, press "Enter" a few times until you see the output. Now we get a SYSTEM shell:

SYSTEM shell

Last updated