πDNS Attacks
π― Overview
This document covers exploitation techniques against DNS services, focusing on practical attack methodologies from HTB Academy's "Attacking Common Services" module. DNS attacks can lead to information disclosure, domain takeover, traffic redirection, and man-in-the-middle attacks.
"The Domain Name System (DNS) translates domain names (e.g., hackthebox.com) to the numerical IP addresses (e.g., 104.17.42.72). Since nearly all network applications use DNS, attacks against DNS servers represent one of the most prevalent and significant threats today."
ποΈ DNS Attack Methodology
Attack Chain Overview
Service Discovery β Zone Transfer Exploitation β Subdomain Enumeration β Domain Takeover β DNS SpoofingKey Attack Objectives
DNS zone transfers for information gathering
Subdomain enumeration to expand attack surface
Domain/subdomain takeover for content control
DNS cache poisoning for traffic redirection
DNS spoofing for man-in-the-middle attacks
π Service Discovery & Enumeration
Default DNS Port Detection
Comprehensive DNS Scanning
Key Information to Extract
DNS server software (BIND, Microsoft DNS, etc.)
Version information for vulnerability research
Zone information (SOA records)
Recursion capabilities
DNS security features (DNSSEC status)
ποΈ DNS Zone Transfer Attacks
Understanding Zone Transfers
HTB Academy Zone Transfer Example
Using DIG for AXFR
Alternative Zone Transfer Methods
Fierce for Comprehensive DNS Analysis
π Subdomain Enumeration & Domain Takeover
Subdomain Discovery Techniques
HTB Academy Subfinder Example
Subbrute for Internal Networks
Domain Takeover Attacks
Understanding Subdomain Takeover
HTB Academy Takeover Example
Subdomain Takeover Detection Tools
π·οΈ DNS Spoofing & Cache Poisoning
Understanding DNS Cache Poisoning
HTB Academy Ettercap DNS Spoofing
Step 1: Configure DNS Spoofing
Step 2: Execute MITM Attack
Step 3: Verify DNS Spoofing
Alternative DNS Spoofing Tools
π― HTB Academy Lab Scenarios
Scenario 1: DNS Zone Transfer Exploitation
Task: Find all DNS records for "inlanefreight.htb" domain and submit flag found as DNS record
HTB Academy Solution Workflow
Step 1: Setup Subbrute Tool
Step 2: Configure DNS Resolver
Step 3: Subdomain Enumeration
Step 4: Zone Transfer on Discovered Subdomains
Alternative Methods
Advanced DNS Reconnaissance
π DNS Attack Checklist
Discovery & Enumeration
Information Gathering
Exploitation Techniques
Post-Exploitation
π‘οΈ Defense & Mitigation
DNS Server Hardening
Disable zone transfers - Restrict AXFR to authorized servers only
Enable DNSSEC - Cryptographic DNS response validation
Implement access controls - IP-based query restrictions
Regular updates - Patch DNS server software
Rate limiting - Prevent DNS amplification attacks
Network Security
DNS filtering - Block malicious domains
Encrypted DNS - DNS over HTTPS (DoH) or DNS over TLS (DoT)
Split DNS - Separate internal and external DNS
DNS monitoring - Unusual query pattern detection
Cache poisoning protection - Source port randomization
Monitoring & Detection
Zone transfer attempts - Log AXFR queries
Unusual DNS queries - Detect reconnaissance patterns
DNS response validation - Monitor for spoofed responses
Subdomain monitoring - Track new subdomain creation
Certificate transparency - Monitor SSL certificate logs
π Related Techniques
Subdomain Enumeration - Information gathering techniques
Domain Hijacking - Web-based domain attacks
Man-in-the-Middle - Traffic interception
Social Engineering - Phishing with spoofed domains
Network Pivoting - Internal network access
π References
HTB Academy - Attacking Common Services Module
RFC 1035 - Domain Names Implementation and Specification
OWASP DNS Security - DNS attack vectors and mitigations
Subfinder Documentation - Subdomain discovery tool
Ettercap Manual - MITM attack framework
can-i-take-over-xyz - Subdomain takeover reference
This document provides comprehensive DNS attack methodologies based on HTB Academy's "Attacking Common Services" module, focusing on practical exploitation techniques for penetration testing and security assessment.
Last updated