BOFScale Runs Tailscale In-Memory to Route C2 Traffic Through CDN-Fronted WebSockets

· Original article ↗

Summary

BOFScale runs a modified Tailscale daemon inside a BOF-PE implant and routes traffic through CDN-fronted WebSockets. The article details its Headscale setup, an NTLM relay workflow, and detection opportunities.

Key points

  • BOFScale runs a modified Tailscale daemon in-process as an asynchronous BOF-PE, using userspace networking and in-memory state without a driver or service.
  • Patches enable Tailscale’s DERP relay and TS2021 control traffic to use standard WebSockets, allowing a Headscale tailnet to operate behind CloudFront or Fastly.
  • A companion SOCKS5 port forwarder bridges local connections to tailnet hosts; implants can also advertise routes into the victim network.
  • The demonstrated workflow uses PetitPotam to coerce domain-controller authentication and relay it through the implant to AD CS, obtaining a certificate for the DC machine account.
  • Stealth measures include avoiding disk state and child processes; the daemon exposes a SOCKS5 listener on 0.0.0.0:1080, which defenders can monitor.
  • Suggested detections include YARA scans of process memory and monitoring WebSocket upgrades using the derp or ts2021 subprotocols; network inspection requires TLS visibility.

Article Details

Attack Vectors
  • The research implementation runs a modified network daemon as an asynchronous, memory-resident BOF-PE inside an implant process, without a kernel driver, service, persistent node state, or post-startup child processes.
  • Control-plane and relay connections use standard RFC 6455 WebSockets through CDN infrastructure, allowing operator-controlled infrastructure to blend with ordinary CDN traffic.
  • Advertised subnet routes allow an operator machine to reach internal victim-network hosts through the implant.
  • A local TCP forwarder carries incoming authentication traffic through the daemon's SOCKS5 proxy to an operator-controlled relay listener.
  • The demonstration coerces a domain controller into WebDAV authentication, relays its NTLM authentication to a web enrollment endpoint, and obtains a certificate for the domain controller machine account.
Defensive Notes
  • Scan process memory using the supplied component-specific and generic YARA rules. The source reports zero false positives against legitimate binaries compiled from the same source tree, not against all software.
  • Look for Go runtime signatures and heaps inside processes that are not expected to contain Go code.
  • Inspect randomly named UUID pipes with the permissive SDDL D:(A;;GA;;;WD), which the source says differs from a legitimate installation.
  • Enumerate listening sockets and their owning processes. The daemon exposes an unauthenticated SOCKS5 listener on 0.0.0.0:1080, making it reachable beyond loopback where network access permits.
  • With TLS inspection, detect outbound WebSocket upgrades whose Sec-WebSocket-Protocol header contains derp or ts2021, especially from unrelated processes or hosts without an authorized installation.
  • Correlate unexpected SOCKS5 listeners, anomalous process ownership, and outbound CDN WebSocket traffic; individual signals are not conclusive.
  • Memory signatures can fail after string changes, recompilation, or binary obfuscation. Review generic-rule matches in context because other BOF-PE tooling may match.
  • Without TLS inspection or a TLS-terminating proxy, the WebSocket subprotocol headers are not visible to network-layer detection.

MITRE ATT&CK

Vendors

Products

Tools

Related Articles