DNS as a Command and Control Channel

▶ Watch (01:26)

Unit 42 puts the number at 85%: that share of APTs use DNS for command and control. Volt Typhoon used DNS beaconing for data exfiltration. Cozy Bear and OceanLotus did the same. DNS is the first packet every cloud protocol sends, firewalls keep its ports open by design, and logs are rarely monitored. Three attack forms exploit this channel. DNS C2 embeds commands in subdomain labels for persistent control. Tunneling wraps blocked protocols through DNS queries. Raw exfiltration sends data once, then kills the implant.

How C2 Infrastructure Evades Static Detection

▶ Watch (07:20)

APT botnet operators don’t register a single domain. They deploy fleets of redirector servers to hide C2 server locations, then register domains across multiple registrars for maximum evasion. Domain generation algorithms compound this by producing thousands of candidate domains algorithmically. If one gets blacklisted, the implant queries the next. Each domain resolves to multiple IPs so the implant load-balances its beaconing.

“the DNS. DNSC2 being the most damaging.” Vedang Parasnis

Time-based and seed-based DGAs are easier to predict once you have the clock or seed. Wordlist-based variants are harder because their pseudo-random generators resist reverse engineering.

eBPF Kernel Enforcement Architecture

▶ Watch (11:15)

eBPF programs injected at ring zero attach to the kernel’s network stack, process scheduler, and socket layer. No userland process can hide from them. The EDR agent loads these programs at runtime, reads process telemetry from eBPF maps, and runs a quantized dense neural network trained on 60 million domains to classify each DNS query.

Active mode redirects the UDP packet to user space; if malicious, the process gets blacklisted and the implant is trapped retrying until the agent kills it. Passive mode clone-redirects the packet, preserving original flow, while accumulating behavioral evidence before issuing a kernel drop.

Live Enforcement Against Sliver C2

▶ Watch (28:00)

Parasnis ran the Sliver C2 DNS implant termination demo (28:32) against a local infrastructure using Kafka as a message broker and PowerDNS as the authoritative server. He started the Sliver server, deployed the implant, then started the EDR agent. Once eBPF programs loaded, the implant immediately hit query errors. Process 409711 was identified, forced into exponential backoff, and eventually killed. The domain got blacklisted in RPZ. Kernel telemetry streamed to Prometheus and Grafana showed per-process packet counts and process lifetime in real time.

Model Performance and Future Directions

▶ Watch (31:13)

The detection model hit 99.89% precision on a 60-million-domain dataset, built from ISP traffic and adversary emulation runs across multiple open-source C2 tools. Response time in active mode averaged 76 microseconds per exfiltration attempt. The model is serialized as ONNX and quantized to integer arithmetic to match kernel processing speed. A 0.7 binary classification threshold controls false positive rate.

“when AI is paired with eBPF it matures” Vedang Parasnis

Three extensions are in progress: eBPF-based TLS fingerprinting for encrypted C2 pivots, LSTM behavioral analysis over kernel ring buffer sequences, and XDP-layer DoS protection at the network driver.

Notable Quotes

the DNS. DNSC2 being the most damaging. Vedang Parasnis · ▶ 3:28

The main challenges here are it is slow Vedang Parasnis · ▶ 9:50

when AI is paired with eBPF it matures Vedang Parasnis · ▶ 33:54

Key Takeaways

  • 85% of APTs use DNS for C2, exploiting always-open firewall ports and stateless UDP.
  • eBPF programs attached at ring zero intercept DNS packets before userland evasion applies.
  • A 60-million-domain dense neural network reaches 99.89% precision with 76-microsecond response time.