DNS Infrastructure Attacks & Subdomain Takeovers
Overview
- What is DNS? The Domain Name System translates human‑readable names to IP addresses, making it a high‑value target for red teams.
- Subdomain takeovers occur when an organization loses control of a domain or cloud service but leaves DNS pointing to an abandoned resource.
Attack Workflow
- Recon: Use 'sublist3r', 'amass', and 'dnsenum' to enumerate subdomains of .pk domains.
- Fingerprint: Verify dangling DNS records with 'dig' and 'nslookup' for CNAME, A, or MX pointing to expired services.
- Claim: Register the forgotten service (e.g., an unused Azure or AWS endpoint) to hijack the subdomain.
- Persist: Host a phishing landing page or beacon payload on the captured subdomain, using it as a trusted C2 channel.
Pakistani Case Study
- A mid‑size fintech in Karachi left a CNAME for 'api.jazzcash.com.pk' pointing to a decommissioned Azure blob.
- Red teamers claimed the blob, served a fake OTP page, and harvested credentials that were later used to pivot into the real payment gateway.
- Incident was reported via NCCIA 1799; NADRA’s BVS guidelines recommend periodic DNS audits for all public‑facing domains.
Red Team Lab Setup
- Spin up a Kali VM with 'dnsrecon' and 'dnsenum'.
- Use a free Azure trial to simulate a dangling DNS scenario on a test .pk domain.
- Document findings in TheHive, tagging with MITRE ATT&CK technique T1185 (DNS Hijacking).
Do / Don't
- Do: Regularly audit DNS records for orphaned entries, especially before deprecating cloud services.
- Don't: Trust external subdomains without verifying ownership; assume any dangling record is a potential foothold.
Takeaway: Schedule a weekly DNS sweep of your organization’s .pk domains using 'amass' and review dangling CNAMEs before an adversary does.
