Discovery

The adversary is trying to figure out your environment. https://attack.mitre.org/tactics/TA0007/

User Group Membership

Get-ADPrincipalGroupMembership "USERNAME" | Select name

MachineAccountQuote 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

Use 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

Sample theHarvester API Configuration File

This goes in ~/.theHarvester/api-keys.yaml for Kali

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

Built-In Port Lists & Aliases

* `small: 80, 443` * `medium: 80, 443, 8000, 8080, 8443 (same as default)` * `large: 80, 81, 443, 591, 2082, 2087, 2095, 2096, 3000, 8000, 8001, 8008, 8080, 8083, 8443, 8834, 8888` * `xlarge: 80, 81, 300, 443, 591, 593, 832, 981, 1010, 1311, 2082, 2087, 2095, 2096, 2480, 3000, 3128, 3333, 4243, 4567, 4711, 4712, 4993, 5000, 5104, 5108, 5800, 6543, 7000, 7396, 7474, 8000, 8001, 8008, 8014, 8042, 8069, 8080, 8081, 8088, 8090, 8091, 8118, 8123, 8172, 8222, 8243, 8280, 8281, 8333, 8443, 8500, 8834, 8880, 8888, 8983, 9000, 9043, 9060, 9080, 9090, 9091, 9200, 9443, 9800, 9981, 12443, 16080, 18091, 18092, 20720, 28017`

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.txt file is in the following format: range = 192.168.0.0/16 with line breaks

Last updated