πŸ•΅οΈ
VeryLazyTech
πŸ“œ MediumπŸ›’ My ShopπŸ‘Ύ GithubπŸ“© Telegram πŸ“Ί YouTubeβœ– Twitter
  • πŸ•΅οΈWelcome!
    • VeryLazyTech
    • Support VeryLazyTech
      • πŸ‘Ύ GitHub
      • πŸ“œ Medium
      • β˜• My Shop
      • πŸ“Ί YouTube
      • βœ– Twitter
      • πŸ“© Telegram
  • πŸ›‘οΈ Vulnerabilities and Exploits
    • CVE - POC
      • Unauthenticated RCE Flaw in Rejetto HTTP File Server - CVE-2024-23692
      • POC - CVE-2024–4956 - Nexus Repository Manager 3 Unauthenticated Path Traversal
      • POC - CVE-2024-45241: Path Traversal in CentralSquare's CryWolf
      • Telerik Auth Bypass CVE-2024-4358
      • Check Point Security Gateways Information Disclosure - CVE-2024-24919
      • CVE-2024-23897 - Jenkins File Read Vulnerability
      • CVE-2024–10914- Command Injection Vulnerability in name parameter for D-Link NAS
      • POC - CVE-2024-21534 Jsonpath-plus vulnerable to Remote Code Execution (RCE)
      • CVE-2024-9935 - PDF Generator Addon for Elementor Page Builder <= 1.7.5 - Unauthenticated Arbitrary
      • CVE-2024-50623- Cleo Unrestricted file upload and download
      • POC - WordPress File Upload plugin, in the wfu_file_downloader.php file before version <= 4.24.11
      • POC - Remote and unauthenticated attacker can send crafted HTTP requests to RCE - cve-2025-3248
      • POCβ€Š-β€ŠCVE-2025–2539 File Away <= 3.9.9.0.1β€Š-β€ŠMissing Authorization to Unauthenticated Arbitrary File
      • POC - CVE-2025-29306 FOXCMS /images/index.html Code Execution Vulnerability
  • πŸ•΅οΈβ€β™‚οΈDorks
    • GitHub Dorks
    • Google Dork Online Tool
  • πŸ“š Resources
    • Top Hacking Books for 2024: FREE and Paid
    • How to Study for OSCP with the PWK Book PDF
    • Top 20 phishing tools to use in 2024
    • Top 8 Bug Bounty Books for 2025: Must-Reads for Ethical Hackers
    • Top Hacking Tools and Skills You Need to Learn in 2025
    • Offensive Cloud
    • Penetration Testing & Hacking Tools List
    • Top Cybersecurity Books by Topic
  • The Ultimate Penetration Testing Methodology (2025 Edition)
  • πŸ•ΈοΈPentesting Web
    • Client Side Template Injection (CSTI)
    • Identify a Server’s Origin IP
    • 2FA/MFA/OTP Bypass
  • IDOR
  • Open Redirect
  • Subdomain Takeover
  • Penetration Testing WiFi Networks
  • Client-Side Path Traversal
  • Clickjacking
  • Command Injection
  • JWT Vulnerabilities
  • Bypass rating limit
  • CORS - Misconfigurations & Bypass
  • LDAP Injection
  • File upload vulnerabilities
  • Content Security Policy (CSP) bypass
  • 🐧Linux
    • Practical Linux Commands
    • Bypassing Bash Restrictions - Rbash
    • Privilege escalation - Linux
  • Linux Environment Variables
  • πŸͺŸWindows
    • Active Directory Methodology
  • 🌐Network Pentesting
    • FTP - Port 21
    • SSH- Port 22
    • Telnet - Port 23
    • SMTP/s - Port 25,465,587
    • WHOIS - Port 43
    • TACACS+ - Port 49
    • DNS - Port 53
    • TFTP/Bittorrent-tracker - Port 69/UDP
    • Finger - Port 79
    • Web - Port 80,443
    • Kerberos - Port 88
    • POP - Port 110/995
    • Portmapper - Port 111/TCP/UDP
    • Ident - Port 113
    • NTP - Port 123/UDP
    • MSRPC - Port 135, 539
    • NetBios - Port 137,138,139
    • SMB - Port 139 445
    • IMAP - Port 143, 993
    • SNMP - Ports 161, 162, 10161, and 10162/UDP
    • IRC - Ports 194,6667,6660-7000
    • Check Point Firewall - Port 264
    • LDAP - Ports 389, 636, 3268, 3269
    • IPsec/IKE VPN - Port 500/UDP
    • Modbus - Port 502
    • Rexec - Port 512
    • Rlogin - Port 513
    • Rsh - Port 514
    • Line Printer Daemon (LPD) - Port 515
    • Apple Filing Protocol (AFP) - PORT 548
    • RTSP - Port 554, 8554
    • IPMI - Port 623/UDP/TCP
    • Internet Printing Protocol (IPP) - Port 631
    • EPP - Port 700
    • Rsync - Port 873
    • Rusersd Service - Port 1026
    • Socks - Port 1080
    • Java RMI - RMI-IIOP - Port 1098/1099/1050
    • MSSQL (Microsoft SQL Server) - Port 1433
    • Oracle TNS Listener - Port 1521,1522-1529
  • PPTP - Port 1723
  • MQTT (Message Queuing Telemetry Transport) - Port 1883
  • Compaq HP Insight Manager - Port 2301, 2381
  • NFS Service - Port 2049
  • Docker - Port 2375,2376
  • Squid - Port 3128
  • iScsi - Port 3260
  • SAPRouter - Port 3299
  • 😎Post-exploitation
    • File Transfer Cheatsheet: Windows andΒ Linux
  • πŸ§‘β€πŸ”§Technical guides
    • Kali Linux - Installation
Powered by GitBook
On this page
  • Basic info
  • Config files
  • Attack workflow
  • Penetration Testing Techniques for DNS
  • Banner Grabbing
  • Zone Transfer
  • ANY Query Enumeration
  • Subdomain Brute-Forcing
  • Reverse DNS Enumeration
  • DNSSEC Vulnerability Scanning
  • DNS Recursion Testing
  • Mail Server Enumeration via DNS
  • Active Directory DNS Service Enumeration
  • IPv6 DNS Bruteforce

Was this helpful?

  1. Network Pentesting

DNS - Port 53

PreviousTACACS+ - Port 49NextTFTP/Bittorrent-tracker - Port 69/UDP

Last updated 8 months ago

Was this helpful?

Support VeryLazyTech πŸŽ‰
  • Become VeryLazyTech ! 🎁

  • Follow us on Twitter , Github , and Medium .

  • Visit our for e-books and courses. πŸ“š

  • Support us and . β˜•

Basic info

DNS (Domain Name System) is a critical protocol that acts as the internet's directory. It translates human-readable domain names like example.com into IP addresses, allowing browsers to connect to web services. Due to its essential role in internet functionality, DNS servers are common attack targets.

Default port: 53

PORT     STATE SERVICE  REASON
53/tcp   open  domain  Microsoft DNS 6.1.7601 (1DB15D39) (Windows Server 2008 R2 SP1)
5353/udp open  zeroconf udp-response
53/udp   open  domain  Microsoft DNS 6.1.7601 (1DB15D39) (Windows Server 2008 R2 SP1)

Key DNS Concepts

  • DNS Root Servers: The highest level in the DNS hierarchy, maintaining top-level domain information.

  • Authoritative Nameservers: Provide definitive answers about domain zones they manage.

  • Caching DNS Servers: Temporarily store DNS query results to improve performance.

  • Forwarding Servers: Forward DNS queries to another server for resolution.


Config files

host.conf
/etc/resolv.conf
/etc/bind/named.conf
/etc/bind/named.conf.local
/etc/bind/named.conf.options
/etc/bind/named.conf.log
/etc/bind/*

Dangerous settings when configuring a Bind server:

Option

Description

allow-query

Defines which hosts are allowed to send requests to the DNS server.

allow-recursion

Defines which hosts are allowed to send recursive requests to the DNS server.

allow-transfer

Defines which hosts are allowed to receive zone transfers from the DNS server.

zone-statistics

Collects statistical data of zones.


Attack workflow

1. Reconnaissance and Enumeration

  • Banner Grabbing: Identify DNS version and services running on port 53. Banner Grabbing

2. DNS Zone Transfer Attack

  • Zone Transfer (AXFR): If DNS misconfigurations allow zone transfers, attackers can obtain sensitive domain records. Zone Transfer

3. DNS Subdomain Bruteforcing

  • Bruteforce Subdomains: Use wordlists to identify valid subdomains via DNS queries. Subdomain Brute-Forcing

4. Reverse DNS Lookup

  • Reverse DNS Lookup: Query PTR records to map IP addresses back to domain names. Reverse DNS Enumeration

5. DNS ANY Query

  • ANY Query: Query the DNS server for all available records it is willing to disclose. ANY Query Enumeration

6. DNSSEC Exploitation

  • DNSSEC Enumeration: Identify DNSSEC configurations and attempt exploitation or abuse. DNSSEC Vulnerability Scanning

7. DNS Amplification Attack (DDoS Simulation)

  • DNS Recursion Check: If recursion is enabled, the server may allow amplification attacks. DNS Recursion Testing

8. Active Directory DNS Service Enumeration

  • Service Enumeration: Query for Active Directory-related DNS services like LDAP, Kerberos, and Global Catalog. Active Directory DNS Service Enumeration

9. IPv6 DNS Bruteforcing

  • IPv6 DNS Bruteforce: Target AAAA records to uncover subdomains with IPv6 addresses. IPv6 DNS Bruteforce

10. Exploit Misconfigured Mail Servers

  • Mail Nondelivery Exploitation: Use misconfigured DNS for email servers to gather internal network information. Mail Server Enumeration via DNS


Penetration Testing Techniques for DNS

Banner Grabbing

Banner grabbing for DNS may involve querying for version information or other metadata that a DNS server discloses. A classic way to gather this is by querying the version.bind using DNS CHAOS requests or nmap scripts.

Dig:

dig version.bind CHAOS TXT @<DNS_SERVER_IP>

Nmap:

nmap -sV --script dns-nsid <DNS_SERVER_IP>

fpdns:

fpdns <DNS_SERVER_IP>

Zone Transfer

DNS zone transfer (AXFR) can leak entire domain zone information, including subdomains, services, and IP addresses. It's often a result of misconfigured DNS servers.

Dig:

dig axfr @<DNS_SERVER_IP> <DOMAIN>

Fierce:

fierce --domain <DOMAIN> --dns-servers <DNS_SERVER_IP>

Dnsrecon:

dnsrecon -t axfr -d <DOMAIN> -n <DNS_SERVER_IP>

ANY Query Enumeration

Using an ANY query, testers can attempt to retrieve all records a DNS server is willing to share.

Dig:

dig ANY <DOMAIN> @<DNS_SERVER_IP>

Dnsenum:

dnsenum --dnsserver <DNS_SERVER_IP> --enum -p 0 -s 0 -o output.txt <DOMAIN>

Dnsrecon:

dnsrecon -d <DOMAIN> -t any -n <DNS_SERVER_IP>

Subdomain Brute-Forcing

Subdomain brute-forcing is an effective technique to uncover hidden services or subdomains associated with a target domain.

Dnsenum:

dnsenum --dnsserver <DNS_SERVER_IP> -f subdomains.txt <DOMAIN>

Dnscan:

dnscan -d <DOMAIN> -w subdomains.txt -r

Dnsrecon:

dnsrecon -D subdomains.txt -d <DOMAIN> -n <DNS_SERVER_IP>

Reverse DNS Enumeration

Reverse DNS lookups allow attackers to map IP ranges to associated domain names, potentially exposing internal or less public-facing resources.

Dnsrecon:

dnsrecon -r <IP_RANGE> -n <DNS_SERVER_IP>

Reverse-Scan: Use reverse-scan for efficient reverse DNS enumeration.

reverse-scan -i <IP_RANGE> -d <DNS_SERVER_IP>

Dig:

dig -x <IP_ADDRESS> @<DNS_SERVER_IP>

DNSSEC Vulnerability Scanning

DNSSEC is designed to provide an additional layer of security, but vulnerabilities can still exist in misconfigured setups. You can exploit DNSSEC records for potential DDoS or data exfiltration attacks.

Nmap:

nmap -p 53 --script dns-nsec-enum --script-args dns-nsec-enum.domains=<DOMAIN> <DNS_SERVER_IP>

Dig (manual DNSSEC check):

dig DNSKEY <DOMAIN> @<DNS_SERVER_IP>

DNS Recursion Testing

DNS recursion allows DNS servers to query other DNS servers on behalf of a client. If improperly configured, this can be exploited for DNS amplification attacks.

Dig:

dig google.com A @<DNS_SERVER_IP>

Nmap:

nmap --script dns-recursion <DNS_SERVER_IP>

Nslookup:

nslookup
> SERVER <DNS_SERVER_IP>
> google.com

Mail Server Enumeration via DNS

Misconfigured DNS records often leak internal infrastructure information. By querying for mail exchange (MX) or service (SRV) records, you can learn about target email servers.

Dig:

dig MX <DOMAIN> @<DNS_SERVER_IP>
dig SRV _ldap._tcp.<DOMAIN> @<DNS_SERVER_IP>

Nslookup:

nslookup
> server <DNS_SERVER_IP>
> set type=MX
> <DOMAIN>

Nmap:

nmap --script dns-srv-enum --script-args dns-srv-enum.domain=<DOMAIN> <DNS_SERVER_IP>

Active Directory DNS Service Enumeration

Enumerate DNS services related to Active Directory for additional attack vectors.

Service Enumeration: Query for Active Directory-related DNS services like LDAP, Kerberos, and Global Catalog.

bashCopy code# Dig for AD services
dig -t _gc._tcp.lab.domain.com
dig -t _ldap._tcp.lab.domain.com
dig -t _kerberos._tcp.lab.domain.com

# Nslookup AD services
nslookup
> set type=srv
> _kerberos._tcp.<DOMAIN>

IPv6 DNS Bruteforce

Dnsdict6:

dnsdict6 -t <DOMAIN>

Dnsrevenum6:

dnsrevenum6 <DNS_SERVER_IP> <IPV6_RANGE>
🌐
member
@VeryLazyTech
@VeryLazyTech
@VeryLazyTech
shop
buy me a coffee