Discovery
The adversary is trying to figure out your environment. https://attack.mitre.org/tactics/TA0007/
User Group Membership
Get-ADPrincipalGroupMembership "USERNAME" | Select nameMachineAccountQuote Lookup
$domain = "burmat.local"
$domainDN = (Get-ADDomain -Identity $domain).DistinguishedName
$addMachineQuota = (Get-ADObject -Identity $domainDN -Properties ms-DS-MachineAccountQuota).'ms-DS-MachineAccountQuota'
Write-Host "Current AddMachineQuota value: $addMachineQuota"AD Enumeration via ADSI DirectorySearcher
DirectorySearcherUse the following to leverage ADSI and PowerShell for LDAP Queries
$users = ([adsisearcher]"<LDAP QUERY HERE>").FindAll();Computer/User Objects
([adsisearcher]'(&(objectCategory=Computer))').FindAll();
([adsisearcher]'(&(objectCategory=User))').FindAll();SPNs
Or
Unconstrained delegation
Local Administrator Password Solution (LAPS)
Retrieve computers that are not configured with LAPS
BOFHound
You can use BOFHound to convert the output from the BOF ldapsearch or from pyldapsearch to BloodHound-compatible JSON files.
Collection
Conversion
References:
BloodHound
Ingester Launch
LDAP Enumeration
Null Sessions
LDAP Queries
Below are some useful LDAP queries that will help you enumerate a system. Some of them require a valid username/password to get more information. My go-to for these queries is ldapsearch. Use the following command and fill in your LDAP query in the placeholder:
Domain Usernames
Get usernames into a list by enumerating user objects:
ASREPRoast
Users with SPNs
If you get valid domain credentials, you can dump them w/ impacket for offline cracking:
User / Computers with Unconstrained Delegation
Domain Administrators
PowerSploit
Use the dev branch or PowerSploit. For an already incredible cheat sheet, check out HarmJ0y's.
Get Domain Users
Retrieve Group Members
Users Allowed to Delegate
User Description Gathering
Enumerate User DACLs
SPN Ticket Request (Kerberoasting)
Domain Controller Discovery
Domain Computers
Unconstrained Delegation (Other than DCs)
Network Shares Enumeration
Authenticated:
Looping a list of hostnames:
theHarvester
An open-source intelligence (OSINT) gathering tool, that will tap into many difference APIs to gather data for you. GitHub: https://github.com/laramies/theHarvester Installation is a PITA. Put your API keys into the api-keys.yaml file in the root of the directory
Email Address Gathering
Getting a list of email addresses from intelx.io:
If you are doing multiple domains, you can use the following bash one-liner, where domains.txt is a list of domain names to search:
Clean up the output to just be emails with the following, if you have problems:
Web Enumeration
aquatone
Found here: GitHub - michenriksen/aquatone: A Tool for Domain Flyovers
Basic Usage
Nmap Scan Results
Using a Proxy via Burp
(Assuming Burp is listening to localhost:8080):
-proxy http://127.0.0.1:8080
Sonar
https://github.com/Cgboal/SonarSearch
Run the following to find domains associated to your scope, and extract the root-level domains for (potentially) additional scope:
for i in $(cat scope.txt); do crobat -r $i >> crobat_out.txt; done
Once you have a list root-level domains, use the results to find additional subdomains:
cat crobat_out.txt | assetfinder -subs-only
Quering the data from the dataset yourself (watch your storage space):
https://opendata.rapid7.com/sonar.fdns_v2/
You’ll wanna pull the most recent copy of the data, so ensure you update the following accordingly:
Using these commands, you should be able to pull out a lot of relevant domain names.
EyeWitness
EyeWitness is designed to take screenshots of websites provide some server header info, and identify default credentials if known.
Basic usage with Nmap results:
EyeWitness.py --web -x /root/port443.xml -d /root/output --no-prompt --jitter 3 --threads 3
You can drive it with a Nessus scan result too:
EyeWitness.py --web -x ~/NessusExport.xml
Network Discovery
Shodan
See here: Shodan
SPF/DMARC/DKIM
DNS Zone Transfer
Windows
Linux
ARP
masscan
This will do a ping sweep, then check for the following ports
Use the sedcommands after putting your IP ranges into a text file:
Note: make sure your
ranges.txtfile is in the following format:range = 192.168.0.0/16with line breaks
Last updated