Three-layer defense: scanner blocking, header validation, and URI-based C2 routing.
Every request that reaches the Apache redirector passes through three sequential security layers. A request must clear all three to reach a C2 backend. Requests that fail at any layer receive the CloudEdge CDN decoy page or a 403 Forbidden response — they are never proxied to Mythic, Sliver, or Havoc.
/etc/apache2/redirect.rules is included in both the HTTP and HTTPS VirtualHosts:
# Inside redirector-http.conf and redirector-https.confInclude /etc/apache2/redirect.rules
The file is downloaded at boot from BaddKharma/redRules, an adapted version of curi0usJack’s redirect rules. It contains RewriteCond directives that match requests from known AV vendors, security scanner IP ranges, and TOR exit nodes.
Scanner blocking is controlled by the enable_redirector_htaccess_filtering Terraform variable. It defaults to true (enabled) and is automatically set to false in closed-environment mode (HTB/VL/PG). In closed mode, redirect.rules is replaced with a comment-only placeholder and no IP blocking is applied.
Requests that pass scanner blocking must include a specific HTTP header with the correct token. Without it, Apache falls through to the DocumentRoot (/var/www/html/decoy/) and serves the CloudEdge CDN maintenance page.
Each proxy rule in both VirtualHosts is conditional on the header:
# Request must carry the correct X-Request-ID valueRewriteCond %{HTTP:X-Request-ID} ^<your-token>$RewriteRule ^/cdn/media/stream/(.*) http://<mythic-private-ip>/$1 [P,L]
If the condition is not met, the RewriteRule is skipped. With no matching rule, the request falls through to the decoy page. The check is repeated independently for each C2 backend.
# Should return the CloudEdge CDN decoy page (no header)curl -s http://localhost/ | head -5# Should be proxied to Mythic (correct header)curl -v -H "X-Request-ID: <your-token>" http://localhost/cdn/media/stream/
A request with a valid header is routed to the C2 backend whose URI prefix matches the request path. Each framework uses a distinct CDN-style prefix to blend in with normal web traffic.
Havoc’s listener validates that incoming URI paths match the demon’s configured paths exactly. Do not strip the prefix for Havoc. If you see Havoc demons connecting but receiving no tasks, check that the URI prefix in the listener matches the prefix in redirect.rules and the demon configuration.
SSL terminates at the redirector. All traffic forwarded through VPC peering to C2 backends is plain HTTP, regardless of whether the implant connected over HTTPS. C2 servers listen on port 80; the redirector handles TLS on their behalf.