OPSECTLAS you are here: Active Directory
Active Directory

Initial Enumeration

reference 31 commands 6 tools

  1. Recon
  2. Enumerate
  3. Foothold
  4. PrivEsc
  5. Lateral
  6. Post-Ex
toolsenum4linuxcrackmapexecldapsearchnmapkerbruterpcclient
Without Credentials (Unauthenticated)

SMB null session

enum4linux-ng -A <TARGET-IP> | tee scans/enum4linux.txt
crackmapexec smb <TARGET-IP> -u '' -p ''
crackmapexec smb <TARGET-IP> -u 'guest' -p ''

LDAP anonymous bind

ldapsearch -x -H ldap://<TARGET-IP> -b "DC=domain,DC=local"
ldapsearch -x -H ldap://<TARGET-IP> -b "" -s base namingContexts    # Get base DN

Nmap AD scripts

nmap --script ldap-rootdse -p 389 <TARGET-IP>
nmap --script smb-enum-domains,smb-enum-users,smb-os-discovery -p 445 <TARGET-IP>

Kerbrute · valid user enumeration without logging

kerbrute userenum --dc <TARGET-IP> -d <DOMAIN> \
  /usr/share/wordlists/seclists/Usernames/xato-net-10-million-usernames.txt \
  | tee scans/kerbrute_users.txt

rpcclient null session

rpcclient -U "" -N <TARGET-IP>
rpcclient> enumdomusers          # List domain users
rpcclient> enumdomgroups         # List domain groups
rpcclient> querydominfo          # Domain info
rpcclient> querydispinfo         # Detailed user info
With Credentials

CrackMapExec · everything

crackmapexec smb <TARGET-IP> -u <USER> -p <PASS>
crackmapexec smb <TARGET-IP> -u <USER> -p <PASS> --users
crackmapexec smb <TARGET-IP> -u <USER> -p <PASS> --groups
crackmapexec smb <TARGET-IP> -u <USER> -p <PASS> --shares
crackmapexec smb <TARGET-IP> -u <USER> -p <PASS> --pass-pol   # Password policy

LDAP enumeration

ldapsearch -x -H ldap://<TARGET-IP> -D "<USER>@<DOMAIN>" -w <PASS> \
  -b "DC=<DOMAIN>,DC=LOCAL" "(objectClass=person)" \
  sAMAccountName mail memberOf | tee scans/ldap_users.txt

All users

ldapsearch -x -H ldap://<TARGET-IP> -D "<USER>@<DOMAIN>" -w <PASS> \
  -b "DC=<DOMAIN>,DC=LOCAL" "(objectClass=user)" sAMAccountName

Computers

ldapsearch -x -H ldap://<TARGET-IP> -D "<USER>@<DOMAIN>" -w <PASS> \
  -b "DC=<DOMAIN>,DC=LOCAL" "(objectClass=computer)" name operatingSystem

Native Windows commands (from domain-joined machine or RDP session)

net user /domain
net group /domain
net group "Domain Admins" /domain
net group "Enterprise Admins" /domain
net group "Domain Controllers" /domain
net localgroup administrators

PowerShell enumeration

Get-ADUser -Filter * -Properties * | Select Name,SamAccountName,Enabled,MemberOf
Get-ADGroup -Filter * | Select Name
Get-ADComputer -Filter * | Select Name,OperatingSystem,DNSHostName
Get-ADGroupMember -Identity "Domain Admins"
connected