repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
43-pentesting-whois.mdMarkdown172 lines8.5 KiBsource raw download

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]

Default port: 43

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]

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]

However, TCP/43 is still worth testing because it keeps appearing in:

If your goal is reverse whois, broader asset expansion, or recursive external recon, check the External Recon Methodology page to avoid duplicating work here.

Enumerate#

Get all the information that a whois service has about a domain:

whois -h <HOST> -p <PORT> "domain.tld"
printf 'domain.tld\r\n' | nc -vn <HOST> <PORT>

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:

# Domain
printf 'example.com\r\n' | nc -vn <HOST> 43

# IP / CIDR / ASN examples
printf '8.8.8.8\r\n' | nc -vn <HOST> 43
printf 'AS15169\r\n' | nc -vn <HOST> 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

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]

Useful options and helpers:

# 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 <target>
nmap --script whois-ip <target>

# For IP ranges, disable the WHOIS cache if you care about smaller delegated blocks
nmap --script whois-ip --script-args whois.whodb=nocache <target>

Interesting fields to pivot on when the service is not fully redacted:

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:

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]

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:

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]

That gives the attacker control over the response body seen by:

This matters because a rogue WHOIS response can become an entry point for:

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#

HackTricks Automatic Commands#

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#