Enumeration

Nmap

The Nmap scan revealed open ports for SMB, LDAP, Kerberos, HTTP, and HTTPS. Additionally, it identified one domain and one subdomain.

00 - nmap and domains

01 - 2 domains

Directory BruteForce

Performed directory brute-forcing on the HTTPS port for both the domain and subdomain, which led to the discovery of additional hidden directories.

02 - watch dirbuster

03 - admin

04 - admin master

Exploitation

SQLi

Discovered search.php under the subdomain, which was vulnerable to SQL injection. Exploiting this vulnerability allowed me to enumerate the database and identify valid user credentials for the website.

05 - found sqli

06 - sqli string_agg

07 - sqli password hashes

Cracking Hashes

The credentials retrieved via SQL injection were hashed. I used hashes.com to crack the hashes and recover the plaintext passwords. Using these, I performed a brute-force attack against the login page and successfully identified valid credentials, which granted access to the admin panel.

08 - cracked

09 - got the user

10 - can login admin panel with yoshihide

Parameter Fuzzing

Within the admin panel, I identified a GET parameter responsible for rendering different pages. Using parameter fuzzing, I discovered an additional undocumented parameter vulnerable to PHP file inclusion. This vulnerability also allowed the inclusion of Base64-encoded PHP payloads, enabling further exploitation.

11 - parameters

12 - parameter fuzzing

13 - parameter debug

14 - base64 pages

PHP File Inclusion to RCE

I obtained the Base64-encoded source code of index.php and master.php. The index.php file directly includes files using the previously discovered GET parameter, confirming the Local File Inclusion vulnerability. More critically, master.php accepts an include parameter via POST, which it processes using file_get_contents and eval. This allowed me to remotely supply and execute arbitrary PHP code, ultimately resulting in a web shell on the target system.

15 - index directly includes files

16 - master executes files

17 - send post data

18 - got the shell

Checking MSSQL Databases

From the web shell, I was able to execute the sqlcmd utility and enumerate available databases. I identified a backup database, but initially lacked the necessary permissions to access it. However, upon reviewing the index.php source code, I found a hardcoded database administrator password. Using these credentials, I successfully authenticated and queried the backup database.

19 - no permission

20 - index php db user

21 - got some users

Using the database query, I retrieved the user’s password. With these credentials, I accessed a WinRM shell since the user had permission to run PowerShell Remoting (PSRemote).

22 - got the user

Privilege Escalation

WinPEAS

Running WinPEAS revealed that LAPS (Local Administrator Password Solution) was enabled on the system. Additionally, stored Firefox credentials were discovered.

23 - winpeas output

BloodHound

I began downloading the stored Firefox credentials for later decryption. While the download was in progress, I ran BloodHound-Python, which revealed that the user JDGodd has privileges that can be leveraged to read the LAPS password.

24 - ran bloodhound python

25 - bloodhound

Firefox Decrypt

Decrypting the Firefox credentials revealed several usernames and passwords. After brute-forcing, I obtained a valid password for the user JDGodd. However, this user did not have permission to use PowerShell Remoting (PSRemote).

26 - decrypted

27 - JDGodd

Exploiting WriteOwner to Add Member to Group

Although JDGodd lacked PSRemote permissions, I discovered that this user had WriteOwner permissions over the Core Staff group. Using my current session, I created a credential object for JDGodd. Then, leveraging these credentials, I added JDGodd to the Core Staff group, which possessed the ReadLapsPassword permission.

28 - added jdgodd to group

Reading LAPS Password

I then read the LAPS password directly and gained administrative access to the system.

29 - got the password for admin

30 - gg

Pwned

The machine was fully compromised.

pwned


<
Previous Post
Support - Hack The Box
>
Next Post
Blackfield - Hack The Box