hunting-for-domain-fronting-c2-traffic skill (Anthropic-Cybersecurity-Skills)

From Public Agent Wiki

What it does. Detects domain fronting C2 traffic by analyzing SNI-vs-HTTP-Host-header Part of mukul975/Anthropic-Cybersecurity-Skills (817 security skills) (mukul975/Anthropic-Cybersecurity-Skills).

Upstream mukul975/Anthropic-Cybersecurity-Skills
Skill file skills/hunting-for-domain-fronting-c2-traffic/SKILL.md
License Apache-2.0 (skill folder LICENSE)
Author mukul975
Fetched 2026-09-10

Install

  • npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill hunting-for-domain-fronting-c2-traffic, or copy the skill folder into ~/.claude/skills/hunting-for-domain-fronting-c2-traffic/.
  • Raw file: curl -sL https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/HEAD/skills/hunting-for-domain-fronting-c2-traffic/SKILL.md

SKILL.md (verbatim)

name: hunting-for-domain-fronting-c2-traffic
description: Detects domain fronting C2 traffic by analyzing SNI-vs-HTTP-Host-header
  mismatches in proxy logs and inspecting TLS certificate discrepancies with pyOpenSSL.
  Use when hunting for command-and-control traffic hidden behind legitimate CDN domains,
  or when investigating proxy/TLS logs for signs of domain fronting evasion.
domain: cybersecurity
subdomain: threat-hunting
tags:
- domain-fronting
- c2-detection
- tls-inspection
- proxy-logs
- pyopenssl
- threat-hunting
- network-security
version: '1.0'
author: mahipal
license: Apache-2.0
d3fend_techniques:
- Application Protocol Command Analysis
- Network Isolation
- Network Traffic Analysis
- Client-server Payload Profiling
- Network Traffic Community Deviation
nist_csf:
- DE.CM-01
- DE.AE-02
- DE.AE-07
- ID.RA-05
mitre_attack:
- T1046
- T1057
- T1082
- T1083
- T1071

Hunting for Domain Fronting C2 Traffic

Overview

Domain fronting (MITRE ATT&CK T1090.004) is a technique where attackers use different domain names in the TLS SNI field and the HTTP Host header to disguise C2 traffic behind legitimate CDN-hosted domains. This skill detects domain fronting by parsing proxy/web gateway logs for SNI-Host header mismatches, analyzing TLS certificates for CDN provider identification, flagging connections where the SNI points to a high-reputation domain but the Host header targets an attacker-controlled domain, and correlating with known CDN provider IP ranges.

When to Use

  • When investigating security incidents that require hunting for domain fronting c2 traffic
  • When building detection rules or threat hunting queries for this domain
  • When SOC analysts need structured procedures for this analysis type
  • When validating security monitoring coverage for related attack techniques

Prerequisites

  • Web proxy or secure web gateway logs with SNI and Host header fields
  • Python 3.8+ with pyOpenSSL and cryptography libraries
  • TLS inspection enabled on proxy for Host header visibility
  • CDN provider IP range lists (CloudFront, Azure CDN, Cloudflare)

Steps

  1. Parse proxy logs for connections with both SNI and Host header fields
  2. Compare SNI domain against HTTP Host header for mismatches
  3. Extract TLS certificate Subject and SAN fields using pyOpenSSL
  4. Identify CDN-hosted connections via certificate issuer and IP ranges
  5. Flag high-confidence domain fronting where SNI and Host differ on CDN IPs
  6. Score alerts based on domain reputation differential
  7. Generate detection report with network flow context

Expected Output

JSON report containing detected domain fronting indicators with SNI-Host pairs, certificate details, CDN provider identification, confidence scores, and MITRE ATT&CK technique mapping.

Other files in this skill

references/api-reference.md (verbatim)

Domain Fronting C2 Traffic Detection API Reference

Domain Fronting Mechanism

TLS ClientHello:  SNI = legitimate-cdn-domain.cloudfront.net
HTTP Request:     Host: attacker-c2-server.evil.com

The CDN accepts the TLS connection based on SNI, then routes the HTTP request to the backend specified in the Host header. Network monitoring sees only the legitimate SNI domain.

MITRE ATT&CK

Technique ID Description
Proxy: Domain Fronting T1090.004 Route C2 through CDN using SNI/Host mismatch

CDN Provider Identification

Certificate Issuers

CDN Certificate CN Pattern
CloudFront *.cloudfront.net
Azure CDN *.azureedge.net
Cloudflare sni.cloudflaressl.com
Akamai *.akamaiedge.net
Fastly *.fastly.net

Proxy Log Detection

Squid Proxy Log Fields

timestamp src_ip CONNECT sni:443 -> status Host: host_header

Palo Alto Threat ID

Threat ID 86467: Domain fronting detected (SNI/Host mismatch)

Splunk Detection Query

index=proxy sourcetype=squid OR sourcetype=bluecoat
| eval sni_root=mvindex(split(sni, "."), -2) + "." + mvindex(split(sni, "."), -1)
| eval host_root=mvindex(split(host_header, "."), -2) + "." + mvindex(split(host_header, "."), -1)
| where sni_root != host_root
| stats count by sni, host_header, src_ip
| sort -count

pyOpenSSL Certificate Inspection

from OpenSSL import crypto
import ssl, socket

ctx = ssl.create_default_context()
with ctx.wrap_socket(socket.socket(), server_hostname=hostname) as s:
    s.connect((hostname, 443))
    der_cert = s.getpeercert(True)

x509 = crypto.load_certificate(crypto.FILETYPE_ASN1, der_cert)
subject_cn = x509.get_subject().CN
issuer_cn = x509.get_issuer().CN

for i in range(x509.get_extension_count()):
    ext = x509.get_extension(i)
    if ext.get_short_name() == b"subjectAltName":
        print(str(ext))  # DNS:*.cloudfront.net, DNS:cloudfront.net

CLI Usage

python agent.py --proxy-log squid_access.csv --output fronting_report.json
python agent.py --proxy-log logs.csv --check-certs

Back to mukul975/Anthropic-Cybersecurity-Skills (817 security skills) or Agent skills.