Fusion Corp (Get-NPUsers + rcpclient + SeBackupPrivilege privesc)
TrRoom: Fusion Corp
Difficulty: Hard
Overview: In this room we will take advantage of different services on a windows machine, abusing Kerberos pre-authentication to enumerate users, dumping and cracking hashes with the help of impacket tools and John the ripper to finaly privesc exploiting SeBackupPrivilege permissions.
Like always we start our enumeration by running โnmapโ to scan for all open ports on the target system:
nmap -sV -sC -p- fusioncorp.thm -oN nmap.txt
-sV โ Probe open ports to determine service
-sC โ Scan using the default set of scripts
-p- โ Scan all ports
-oN โ Save the ouput of the scan in a fileNormally Active Directory windows machines have alot of open ports, which at times can be scary. But , following the basics.
We will explorer the http webserver:
Since there was not any usefull information on the website we can search for hidden directories with โgobusterโ:
gobuster dir --wordlist /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt --url http://fusioncorp.thm -x .txt,.cgi,.php,.log,.bak,.xxx,.old
dir โ Uses directory/file enumeration mode
--wordlist โ Path to wordlist
--url โ specifies the path of the target url we want to find any hidden directories
-x โ Search for all files with the specified extentions We have found an interesting file in the directory /backup which had a list of of employees and their usernames:
Content of "employees.ods":
With this information we can create a username wordlist and use โkerbrute" which is a enumeration tool used to brute-force and enumerate valid users by abusing the Kerberos pre-authentication.
There is a valid username [email protected]. Now we will use an "impacket" tool called "GetNPUsers.py" to dump the kerberos hash for all kerberoastable accounts. In this case for the account [email protected].
We got the hash, since it is encrypted we need to crack it with โJohn the Ripperโ, โhashcatโ or another tool of your choice.
Success we have โlparkerโ credentials, connect with โevil-winrmโ and we can start doing some reconnaissance of the machine:
We found โjmurphy" and โAdministrator" accounts. Also the first flag of the room.
Now we are going to query the user jmurphy with โrpcclientโ service:
In the description in plaintext we found the password for โjmurphyโ.
Lets login again with โevil-winrmโ but this time with the new user credentials:
Found Second flag:
Now to privesc in order to get the last flag we can check /privs for our user:
We have some privileges that we can exploit and one of them is โSeBackupPrivilegeโ.
Has we can see the contents of user โAdministratorโ can be displayed but we cannot read or execute files like the last "flag.txt" file.
This usefull github repository from "giuliano108" shows us how to take advantage of the SeBackupPrivilege. It allows the user to access directories/files that he doesn't own or doesn't have permission to.
So with โevil-winrmโ we can upload the two โ.dllโ files that we got from the github repository to the target machine:
Like in "meterpreter" shell we can do commands โdownload or uploadโ to transfer files between the target and the attacker machine.
Now after importing the two modules we have to user command โCopy-FileSeBackupPrivilegeโ, this command will make a copy of the โflag.txtโ file to our directory abusing โSeBackupPrivilegeโ:
Now read the last flag!!
We have all the flags but let's explore and see if we can escalate our privileges further.
My first attempt to privesc to user โAdministratorโ failed, because i got an invalid โadministratorโ hash. Let me show:
With user โjmurphyโ we can save โsamโ and โsystemโ files into a directory that we can access by doing:
Now just download the files to your attacker machine:
With the tool "pypykatz" we can extract the hashes from the "sam" file:
As we can see below we failed login with โAdministratorโ hash for whatever reason. Maybe because the โsamโ file was from the windows machine itself and not the Domain Controller.
After reading more on how to privesc this machine through "SeBackupPrivilege" i found a very usefull article in hackingarticles website.
To get all the hashes of the Domain Controller we need โntds.ditโ and โsystemโ files from the target machine.
For getting the โntds.ditโ file we need to use "shadowdisk" functionalities because โntds.ditโ file is always running on the system and doesn't let us make a copy of it.
So we can create a custom โDistributed Shell File" with the commands necessary to make a copy of the Windows drive which then we can extract the โntds.ditโ file:
Use โunix2dosโ to convert the encoding and spacing of the dsh to be windows compatible.
Running โevil-winrmโ with โjmurphyโ user i created a /temp folder in his home directory and uploaded the โhashdump.dshโ:
To ran the commands inside โhashdump.dshโ we will "diskshadow":
Now to make the actual copy of the โntds.ditโ we have to use "robocopy" on the new driver letter that we created just now:
To get the โsystemโ file is easier we just need to use:
We have all the files that we need to get hashes, we just need to download them to our attacker machine:
On our attacker machine we can use โimpacket secretsdumpโ tool to extract all the hashes inside "ntds.dit":
We have a valid โAdministratorโ hash to use with โevil-winrmโ:
Success!
Last updated


































