Enumeration
Create a Domain Map. Repeat enumeration for each new access.
Identify:
Network (Active hosts)
AD Key Services (Kerberos, NetBIOS, LDAP, DNS)
AD computers
AD users
Vulnerabilities
Automated
Install Docker
sudo apt install docker.io && sudo apt install docker-compose
sudo usermod -aG docker $USERInstall Bloodhound
curl -L https://ghst.ly/getbhce > docker-compose.yml
sudo docker-compose pullStart/Stop Bloodhound
sudo docker-compose up
sudo docker-compose down -vStart neo4j
sudo neo4j startNeo4j: http://localhost:7474
Default credentials: neo4j:neo4j
Will ask to change password after first login.
Bloodhound: http://localhost:8080
Default credentials: admin:<PROMPT_IN_LOG_DOCKER>
Will ask to change password after first login.
Linux
From remote attacker with domain credentials (bloodhound.py ingestor)
pipx install bloodhoundbloodhound-python -u <USER> -p <PASS> -ns <IP> -d <DOMAIN> -c all --zipOr with netexec
netexec ldap <IP> -u <USER> [-H <HASH>/-P <PASS>] -d <DOMAIN> --bloodhound --collection All --dns-server <IP>Windows
On the windows host in the AD domain
SharpHound (NEW) (
.exeand.ps1)
.\SharpHound.exe -c All --zipfilename <FILE_NAME>Import-Module .\Sharphound.ps1
Invoke-BloodHound -CollectionMethod All -OutputDirectory C:\<WHERE>\ -OutputPrefix "<NameSTART>"See all flags (ex. loop)
.bin files can be deleted.
Bloodhound uses Neo4j, a graphing database, which uses the Cypher language to query the data.
Remotely
Try with "guest":"" or "":"" (and *:* for LDAP auth)
Initial information such as Domain, Forest, FQDN
nmap -v -p 139,445 --script smb-os-discovery <IP>
Enumeration with SMB (Null Session) and LDAP (Anonymous Binds)
nxc smb <IP> -u <USER> -p <PASS> [-d <DOMAIN>] --users --groups --loggedon-users --pass-pol --rid-brute [-L]
nxc ldap <IP> -u <USER> -p <PASS> [-d <DOMAIN>] --users --groups [--query "(sAMAccountName=*)" ""]
Note:
Try Kerberos authentication with -k
Also try using hostname instead of IP (add to /etc/hosts)
Always try ntpdate first (error KRB_AP_ERR_SKEW)
LDAP Anonymous Binds
ldapsearch -H ldap://<IP> -x -b "DC=goole,DC=com" -s sub "*"
Enumeration with SMB
enum4linux -u <USER> -p <PASS> <IP> -a
Detailed enumeration with specific queries
rpcclient -U [<DOMAIN>/]<USER>[%<PASS>] <IP>
>> <QUERY>
Active Directory information dumper via LDAP
ldapdomaindump -u '<DOMAIN>\<USER>' -p '<PASSWORD>' <IP> -o dump
Enumeration with LDAP query
windapsearch --dc-ip <IP_DC> -u <USER>@<DOMAIN> -p <PASSWORD> -G -U -C -PU --da
Enumerate all DNS records in a domain using a valid domain user account.
adidnsdump -u <DOMAIN>\\<USER> ldap://<DC> [-r]
-r attempt to resolve unknown records by performing an A query.
Manually
The ActiveDirectory PowerShell module is a set of PowerShell cmdlets for administering an Active Directory environment. Before using it, we need to make sure it is imported with Get-Module.
Domain
We get domain information through PowerShell, using LDAP to communicate with AD and extract information.
Workstation
Users
All users
Info about specific user
Groups
All groups
Info about specific group
Share
Policy Password
Deleted AD Objects
Restore with (if you have permissions):
Trust
Tickets Kerberos
SPN
ACL
CN=<VALUE> take from ActiveDirectoryRights
PowerView
It is a PowerSploit script and there are two versions: Old and New (maintained by Empire)
Description Field
PASSWD_NOTREQD Field
Enumerating accounts with this flag set and testing each to see if no password is required
ACL
RDP
WinRM
SYSVOL
The SYSVOL share can be a treasure trove of data, especially in large organizations. We may find many different batch, VBScript, and PowerShell scripts within the scripts directory, which is readable by all authenticated users in the domain. It is worth digging around this directory to hunt for passwords stored in scripts.
GPP Passwords
When a new Group Policy Preferences is created, an .xml file is created in the SYSVOL share.
These files can contain an array of configuration data and defined passwords.
The cpassword attribute value is AES-256 bit encrypted, but Microsoft published the AES private key on MSDN, which can be used to decrypt the password.
The gpp-decrypt utility can be used to decrypt the cpassword
You can also use several tools to locate the GPP and return the decrypted cpassword value. Get-GPPPassword.ps1, the GPP Metasploit Post Module, other Python/Ruby scripts, CrackMapExec, etc.
It is also possible to find passwords in files such as Registry.xml when autologon is configured via Group Policy. We can use CrackMapExec or Get-GPPAutologon.ps1.
Cypher Query Bloodhound
WinRM
SQLAdmin
Kerberos Double Hop Problem
When connecting to a remote system using tools like Evil-WinRM, the user's Kerberos TGT is not forwarded to the remote session, but only the TGS (see with klist command). This means the remote system can authenticate the user for the initial session, but it cannot access other resources in the domain on behalf of the user because the TGT is missing. As a result, commands that require access to additional domain resources, like querying Active Directory with PowerView, fail since there's no way to prove the user's identity beyond the initial connection.
If unconstrained delegation is enabled on a server, it is likely we won't face the "Double Hop" problem. In this scenario, when a user sends their TGS ticket to access the target server, their TGT ticket will be sent along with the request.
Workaround with PSCredential Object
We can also connect to the remote host via host A and set up a PSCredential object to pass our credentials again.
Workaround with Register PSSession Configuration
Here we have another option to change our setup to be able to interact directly with the DC or other hosts/resources without having to set up a PSCredential object and include credentials along with every command (which may not be an option with some tools).
We can also use other methods such as CredSSP, port forwarding, or injecting into a process running in the context of a target user (sacrificial process).
Useful Tools
Powershell tool to automate Active Directory enumeration.
Import-Module .\adPEAS.ps1
Invoke-adPEAS
Invoke-adPEAS -Module [Domain/Rights/GPO/ADCS/Creds/Delegation/Accounts/Computer/Bloodhound -Scope All]
Allows you to see which users are connected to a specified computer. For this to work, the machine must have Remote Registry enabled. (we can get false positives because we are not sure that Remote Registry is enabled on the target)
.\PsLoggedon.exe \<COMPUTER_NAME>
Tool to acquire credentials or other sensitive data in an Active Directory environment by searching between shares.
Snaffler.exe -s -d <DOMAIN> -o <OUTPUT_FILE.log> -v data
A tool purpose-built to find vulnerabilities in Active Directory associated Group Policy.
group3r.exe -f <OUTPUT_FILE.log>
Powerful tool that evaluates the security posture of an AD environment and provides us the results in several different maps and graphs.
PingCastle.exe --help (Terminal User Interface)
Tool which gathers information about the Active Directory and generates a report which can provide a holistic picture of the current state of the target AD environment.
.\ADRecon.ps1
Last updated
Was this helpful?