--- title: "43 - Pentesting WHOIS" section: "Network Services" sectionSlug: "network-services-pentesting" sourcePath: "src/network-services-pentesting/43-pentesting-whois.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/network-services-pentesting/43-pentesting-whois.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0" --- # 43 - Pentesting WHOIS ## Basic Information The **WHOIS** protocol provides text-based queries for information about Internet resources, including domain names, IP address blocks, and autonomous systems. The data model and query syntax are service-specific; RFC 3912 standardizes only the simple transport exchange.[[3]](#references) **Default port:** 43 ```text PORT STATE SERVICE 43/tcp open whois? ``` From an offensive point of view, remember that **WHOIS is a plain-text TCP service**: the client sends a query terminated by CRLF, the server returns text, and the **connection close marks the end of the response**. The protocol has no built-in authentication, integrity, or confidentiality.[[3]](#references) ### Modern Reality: WHOIS vs RDAP For Internet domain registration data, **WHOIS is no longer the authoritative option for many public gTLD workflows**. ICANN sunset WHOIS for gTLD registration data on **2025-01-28**, making **RDAP** the protocol to prefer for machine-readable domain registration lookups.[[1]](#references) However, TCP/`43` is still worth testing because it keeps appearing in: - **Legacy or private WHOIS services** - **RIR / IP allocation workflows** - **Internal registries and custom asset databases** - **Third-party web tools and old automation** that still trust WHOIS responses If your goal is **reverse whois**, broader asset expansion, or recursive external recon, check [the External Recon Methodology page](https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/generic-methodologies-and-resources/external-recon-methodology/README.md) to avoid duplicating work here. ## Enumerate Get all the information that a whois service has about a domain: ```bash whois -h -p "domain.tld" printf 'domain.tld\r\n' | nc -vn ``` If you find a public-facing WHOIS service, test both **domain** and **IP/ASN** style queries because many implementations expose different backends or parsers depending on the object type: ```bash # Domain printf 'example.com\r\n' | nc -vn 43 # IP / CIDR / ASN examples printf '8.8.8.8\r\n' | nc -vn 43 printf 'AS15169\r\n' | nc -vn 43 ``` Sometimes a WHOIS response identifies the database or upstream registry being queried: ![Domain - IP / CIDR / ASN examples: Notice than sometimes when requesting for some information to a WHOIS service the database being used appears in the response](https://raw.githubusercontent.com/HackTricks-wiki/hacktricks/188de82beb54e70956b2952367a0af91d26758b8/src/images/image%20%28301%29.png) ### Referral Chasing and Better Enumeration Useful WHOIS enumeration is often hidden behind **referrals**. One server may only identify the next authoritative service for a TLD or RIR. Test referral handling manually because custom clients and gateways can redact fields inconsistently or expose backend metadata.[[4]](#references) Useful options and helpers: ```bash # Ask IANA first and then follow the authoritative referral (common Linux whois clients) whois -I example.com whois -I 8.8.8.8 # Let Nmap follow domain/IP WHOIS referrals automatically nmap --script whois-domain nmap --script whois-ip # For IP ranges, disable the WHOIS cache if you care about smaller delegated blocks nmap --script whois-ip --script-args whois.whodb=nocache ``` Interesting fields to pivot on when the service is not fully redacted: - **Registrar / Org / abuse contact** for phishing reporting or org-mapping - **Creation / update / expiration times** to spot newly registered infrastructure - **Nameservers** to cluster domains managed by the same operator - **Referral server names** to find legacy or forgotten WHOIS infrastructure ### RDAP as the Structured Successor Even if the exposed service is classic WHOIS on port `43`, check whether the same provider also offers **RDAP** because RDAP is often easier to parse and better for automation: ```bash curl -s https://www.rdap.net/domain/example.com | jq curl -s https://rdap.arin.net/registry/ip/8.8.8.8 | jq ``` A 2024 measurement study comparing WHOIS and RDAP at scale found that they are **not always interchangeable**, with inconsistencies in fields such as registrar identifiers, creation dates, and nameservers. If a recon pipeline depends on those values, compare both sources before making decisions.[[5]](#references) ## Offensive Notes ### Backend Injection in Custom WHOIS Gateways Custom WHOIS gateways commonly query a registry database or proxy another directory. If input is concatenated into a backend query, **SQL injection** or another injection class may be possible. For example, an authorized lab test might send `whois -h 10.10.10.155 -p 43 "a') or 1=1#"`; this is an implementation flaw, not a property of the WHOIS protocol. Do not limit testing to SQLi. In internal or niche WHOIS deployments, the query can be proxied to: - SQL / NoSQL backends - LDAP directories - shell wrappers around other lookup tools - HTTP APIs used by registrar or asset-management portals So fuzz with payloads for **SQLi**, **LDAP injection**, delimiter abuse, very long strings, and malformed UTF-8 / control characters. The protocol itself is simple; the dangerous part is usually the **parser or backend glue code**. ### Rogue / Stale WHOIS Servers A relevant 2024-2025 attack path is abusing **outdated WHOIS trust**. If a registry or tool changes its WHOIS hostname and the old domain expires, an attacker may be able to register the old hostname and operate a **rogue WHOIS server**.[[2]](#references) That gives the attacker control over the response body seen by: - old WHOIS clients with hardcoded server mappings - web applications that fetch WHOIS output and render it back to users - automation that still uses WHOIS for domain validation or ownership workflows This matters because a rogue WHOIS response can become an entry point for: - **stored/reflected XSS** in web WHOIS frontends - **parser bugs / command injection / eval bugs** in libraries consuming the text response - **bad automation decisions** when systems trust attacker-controlled WHOIS contact data When you find a private or legacy WHOIS service, always check whether the returned `refer:` / `Whois Server:` values, banners, or TLD mappings point to **expired or attacker-registerable domains**. ## Shodan - `port:43 whois` ## HackTricks Automatic Commands ```yaml Protocol_Name: WHOIS #Protocol Abbreviation if there is one. Port_Number: 43 #Comma separated if there is more than one. Protocol_Description: WHOIS #Protocol Abbreviation Spelled out Entry_1: Name: Notes Description: Notes for WHOIS Note: | The WHOIS protocol serves as a standard method for inquiring about the registrants or holders of various Internet resources through specific databases. These resources encompass domain names, blocks of IP addresses, and autonomous systems, among others. Beyond these, the protocol finds application in accessing a broader spectrum of information. https://book.hacktricks.wiki/en/network-services-pentesting/43-pentesting-whois.html Entry_2: Name: Banner Grab Description: Grab WHOIS Banner Command: whois -h {IP} -p 43 {Domain_Name} && printf '{Domain_Name}\r\n' | nc -vn {IP} 43 Entry_3: Name: Nmap WHOIS Referrals Description: Follow WHOIS referrals for domain and IP lookups Command: nmap --script whois-domain,whois-ip --script-args whois.whodb=nocache {IP} ``` ## References - [1] [ICANN Update: Launching RDAP; Sunsetting WHOIS](https://www.icann.org/en/announcements/details/icann-update-launching-rdap-sunsetting-whois-27-01-2025-en) - [2] [watchTowr Labs - We Spent $20 To Achieve RCE And Accidentally Became The Admins Of .MOBI](https://labs.watchtowr.com/we-spent-20-to-achieve-rce-and-accidentally-became-the-admins-of-mobi/) - [3] [RFC 3912 - WHOIS Protocol Specification](https://www.rfc-editor.org/rfc/rfc3912) - [4] [Nmap NSE documentation - `whois-ip`](https://nmap.org/nsedoc/scripts/whois-ip.html) - [5] [WHOIS Right? An Analysis of WHOIS and RDAP Consistency](https://arxiv.org/abs/2406.02046)