Chapter 50

Infrastructure Pivoting

Infrastructure pivoting is the process of starting from a known attacker IP or domain and expanding the picture: finding other IPs on the same ASN, certificates shared across domains, WHOIS registration patterns, and passive DNS history that links separate campaigns to the same actor. This is the technical foundation of threat intelligence attribution.

Scenario

You found the C2 IP 185.220.101.47. That's one data point. Infrastructure pivoting turns it into 12 related IPs and 3 clusters of domains — all used by the same actor across different targets. You can now check whether your organization was uniquely targeted, share indicators with sector peers before they're hit, and map the actor's operational infrastructure for law enforcement referral.

Passive DNS Investigation

Passive DNS databases record what DNS names resolved to what IPs over time. Since attackers reuse infrastructure, an IP used in your incident may have resolved to many domains — revealing the broader campaign:

Bashpassive-dns-pivot.sh
C2_IP="185.220.101.47"

# DNSDB (Farsight Security) — query via CLI
# Requires API key; also accessible via VirusTotal, RiskIQ, SecurityTrails
dnsdb_query -r "ip:$C2_IP" | jq '.'
# Shows: all DNS names that have resolved to this IP over time

# VirusTotal via API (passive DNS for an IP)
VT_KEY="your-api-key"
curl -s "https://www.virustotal.com/api/v3/ip_addresses/$C2_IP/resolutions?limit=40" \
    -H "x-apikey: $VT_KEY" | \
    jq '.data[].attributes | {date: .date, hostname: .host_name}'

# Shodan — what services is this IP running?
shodan host $C2_IP
# Shows: open ports, banners, TLS certificate subjects, org info

# Certificate Transparency — find all certificates issued for domains on this IP
# (attackers often register multiple domains with the same TLS cert)
curl -s "https://crt.sh/?q=$C2_IP&output=json" | \
    jq '.[].name_value' | sort -u

Certificate Transparency Pivoting

  Certificate Transparency (CT) Pivoting
  ═══════════════════════════════════════════════════════════════════

  TLS certificates are publicly logged in Certificate Transparency logs.
  Attackers can't avoid this — even self-signed certs used on C2 infra
  appear in CT logs if they were issued by a CA.

  Pivoting via certificates:
    1. Start: C2 domain corp-finance-portal.evil.com
    2. Find cert: issued to *.evil.com (wildcard)
    3. Find all domains using same cert: evil.com, hr.evil.com, it.evil.com
    4. Find other certs issued to evil.com registrant email/org
    5. Those certs may cover different domains used in other campaigns

  Pivoting via Subject Alternative Names (SANs):
    - One certificate often covers multiple domains
    - All SANs on the same cert = likely same attacker infrastructure
    - crt.sh query: https://crt.sh/?q=%.evil.com

  Pivoting via certificate fingerprint:
    - If attacker reuses the same TLS certificate across multiple IPs
    - Shodan/Censys certificate search finds all IPs hosting that cert
    - shodan search "ssl.cert.fingerprint:"
    - censys.io search: "services.tls.certificates.leaf_data.fingerprint:"
Pythoninfrastructure-pivot.py
#!/usr/bin/env python3
"""
Infrastructure pivoting from a single C2 IP
Using: crt.sh (CT logs), VirusTotal pDNS, WHOIS
"""
import requests
import json
import time

def crt_sh_domains(ip_or_domain):
    """Find all certificate SANs for domains on this IP via crt.sh"""
    url = f"https://crt.sh/?q={ip_or_domain}&output=json"
    r = requests.get(url, timeout=15)
    if r.status_code == 200:
        certs = r.json()
        domains = set()
        for c in certs:
            # name_value may contain multiple SANs separated by newlines
            for d in c.get('name_value', '').split('\n'):
                d = d.strip().lstrip('*.')
                if d and '.' in d:
                    domains.add(d)
        return sorted(domains)
    return []

def vt_resolutions(ip, api_key):
    """Get passive DNS resolutions from VirusTotal"""
    url = f"https://www.virustotal.com/api/v3/ip_addresses/{ip}/resolutions"
    headers = {"x-apikey": api_key}
    r = requests.get(url, headers=headers, params={"limit": 40}, timeout=15)
    if r.status_code == 200:
        return [item['attributes']['host_name']
                for item in r.json().get('data', [])]
    return []

# Pivot from C2 IP
C2_IP = "185.220.101.47"
VT_KEY = "your-api-key-here"  # Replace with real key

print(f"=== Infrastructure Pivot: {C2_IP} ===\n")

print("[1] Certificate Transparency domains:")
ct_domains = crt_sh_domains(C2_IP)
for d in ct_domains[:20]:
    print(f"  {d}")

time.sleep(1)  # Rate limit

print(f"\n[2] Passive DNS resolutions (VirusTotal):")
pdns = vt_resolutions(C2_IP, VT_KEY)
for d in pdns[:20]:
    print(f"  {d}")

# Combine all domains found
all_domains = set(ct_domains + pdns)
print(f"\n[Summary] Total unique domains found: {len(all_domains)}")

# Save for further investigation
with open("/cases/CASE-2026-009/attribution/infrastructure.json", "w") as f:
    json.dump({"seed_ip": C2_IP, "related_domains": sorted(all_domains)}, f, indent=2)

Q & A

Q: The attacker used a VPS rented through a privacy-protecting provider with cryptocurrency payment. Can you still pivot beyond the IP?

Yes — the IP alone is rarely the end of the pivot chain. The attacker is behind the VPS, but the VPS has observable properties: (1) ASN and hosting provider: Shodan/Censys show the ASN. Many actors reuse the same hosting providers (e.g., specific bulletproof hosters). Other actors' infrastructure on the same ASN may be related. (2) Open ports and server banners: Shodan shows what the server exposes. A specific web server version, HTTP banner, or combination of open ports may uniquely identify the server setup and be found on other IPs operated by the same actor. (3) TLS certificate: even a self-signed certificate has a Subject line (Common Name, Organization). Actors often reuse the same self-signed cert template. Censys/Shodan certificate searches find all IPs with the same cert. (4) Cookie/tracking values: some C2 frameworks include unique identifiers in HTTP responses (Cobalt Strike malleable C2 response headers, for example). Searching Shodan for those headers finds all active servers using the same profile. (5) Timing: new VPS provisioned shortly before your attack date, from the same ASN, with similar open ports as known past infrastructure = circumstantial but meaningful correlation when combined with other indicators.