Enumeration

Nmap and DNS

Initial nmap scan revealed common Domain Controller ports and MSSQL port were open. Moreover, DNS enumeration revealed the Domain Controller FQDN.

00 - nmap and dns

SMB Enumeration

A user was given to me. Using the given credentials I enumerated SMB Shares. Two of the shares were unusual.

01 - initial suer

The Accounting Department share included 2 excel files.

02 - accounting

I opened them using XLSX Viewer website. Inside it, there was credentials for MSSQL service account and oscar user.

03 - passwords

Exploitation

MSSQL

I logged in to MSSQL using found credentials.

04 - mssql

Then I ran reverse shell using xp_cmdshell.

05 - revshell

Then I tried some privilege escalation methods but it did not work. Later, while I was browsing through directories I found an SQL config file which included service account “sql_svc” and its password.

06 - config file

Checking the credentials I found out it was a valid password.

07 - valid login

Then I tried many things and nothing worked.

I could brute force all users with all valid passwords I found. Before I do that, I checked Users directory and found there was only ryan, sql_svc and Administrator directories. So I thought maybe user “ryan” set the service account so its password may be same as ryan’s password. I tried and it worked.

08 - password reuse

Using evil-winrm I logged in and got the user flag.

09 - user flag

Privilege Escalation

At first, I ran bloodhound and found that Ryan was WriteOwner to CA_SVC which is probably service account that can request certificates.

10 - write owner

So, I applied steps from Hacking Articles blog and changed the password of the target user.

11 - change password

Then I ran certipy and found out a template was vulnerable to ESC4.

12 - certipy

13 - esc4

Following steps from the official certipy wiki I got the administrator hash. Then I logged in with this hash and got the root flag.

14 - root

Pwned

The machine was pwned.

15 - pwned


<
Previous Post
Data - Hack The Box
>
Next Post
Build - Hack The Box