IncidentResponsev2

4.28 Stop C2 Beaconing

Task

Stop Command and Control (C2) Beaconing


Conditions


Standards


End State


Notes

C2 Beaconing Techniques Include:

Known Ports and Protocols (Example — Cobalt Strike):

Protocol Port Notes
HTTPS (TCP) 443 Default beaconing (encrypted)
HTTP (TCP) 80 C2 in clear-text
TCP (custom ports) 50050, 2222, 8080, 8443 Often used in red team or attacker deployments
DNS (UDP/TCP) 53 DNS beaconing and tunneling

Cobalt Strike — one of the most common commercial/offensive C2 platforms — often uses HTTP/HTTPS and DNS-based beaconing as default profiles.


Manual Steps

Step 1 → Detect Beaconing

Using Network Tools (Zeek, Wireshark, SIEM)

Example Zeek command:
zeek -r traffic.pcap dns.log http.log conn.log
Suspicious DNS Example:
xyz987dnscommand.c2malicious.net

Using EDR / AV Telemetry

Using DNS Server Logs


Step 2 → Isolate Infected Hosts

EDR Isolation

falconctl -g --isolation

Manual Isolation

New-NetFirewallRule -DisplayName "Block C2 IP" -Direction Outbound -RemoteAddress <C2_IP> -Action Block

Step 3 → Block Malicious Domains and IPs

Flush DNS Cache (Local)

ipconfig /flushdns
sudo systemd-resolve --flush-caches
sudo killall -HUP mDNSResponder

Block at DNS (Sinkhole)

Windows DNS
  1. Open DNS Manager.
  2. New Zone → Primary → maliciousdomain.com.
  3. Disable dynamic updates.
  4. Add A record → Point to 127.0.0.1.
Linux (Bind)
zone "maliciousdomain.com" {
    type master;
    file "/etc/bind/db.null";
};
AWS Route53 / Azure DNS

Block at Network Firewall

iptables -A OUTPUT -p tcp --dport 443 -d <C2_IP> -j DROP

Cerberus.exe --analyze
Cerberus.exe --kill
Windows
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "Backdoor"
macOS
launchctl remove com.malware.launcher
Linux
crontab -l
crontab -r

Step 5 → Monitor and Validate

zeek -i eth0 dns.log http.log conn.log

Running Script Examples

Block Domain via Hosts File (Quick Block)
Add-Content -Path "C:\Windows\System32\drivers\etc\hosts" -Value "`n127.0.0.1 beacon.badactor.com"
Block IP via Firewall (Linux)
iptables -A OUTPUT -p tcp -d 192.168.100.100 --dport 8080 -j DROP

Dependencies


Other Available Tools

Tool Platform Installation Usage
Zeek Cross-platform Installed Network and DNS beaconing detection
Splunk Cross-platform Installed Detect C2 beaconing
CrowdStrike / SentinelOne Cross-platform Installed Endpoint and C2 process detection
Cerberus Windows Included in toolkit Identify + kill injected threads
BIND Linux Installed Sinkhole domains
Windows DNS Server Windows Installed Create sinkhole zones

Operator Recommendations and Best Practices

Operator Checklist

Best Practices


References


Revision History

Date Version Description Author
2025-05-02 1.2 Integrated original instructions + expanded with Cobalt Strike ports, advanced C2 detection, blocking, and DNS handling Leo