You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/network-services-pentesting/43-pentesting-whois.md
+107-5Lines changed: 107 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,33 +8,127 @@ The **WHOIS** protocol serves as a standard method for **inquiring about the reg
8
8
9
9
**Default port:** 43
10
10
11
-
```
11
+
```text
12
12
PORT STATE SERVICE
13
13
43/tcp open whois?
14
14
```
15
15
16
+
From an offensive point of view, remember that **WHOIS is just a plain-text TCP service**: the client sends a query, the server returns human-readable text, and the **connection close marks the end of the response**. There is **no built-in authentication, integrity, or confidentiality** in the protocol.
17
+
18
+
### Modern Reality: WHOIS vs RDAP
19
+
20
+
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.
21
+
22
+
However, TCP/`43` is still worth testing because it keeps appearing in:
23
+
24
+
-**Legacy or private WHOIS services**
25
+
-**RIR / IP allocation workflows**
26
+
-**Internal registries and custom asset databases**
27
+
-**Third-party web tools and old automation** that still trust WHOIS responses
28
+
29
+
If your goal is **reverse whois**, broader asset expansion, or recursive external recon, check [the External Recon Methodology page](../generic-methodologies-and-resources/external-recon-methodology/README.md) to avoid duplicating work here.
30
+
16
31
## Enumerate
17
32
18
33
Get all the information that a whois service has about a domain:
19
34
20
35
```bash
21
36
whois -h <HOST> -p <PORT>"domain.tld"
22
-
echo"domain.ltd"| nc -vn <HOST><PORT>
37
+
printf'domain.tld\r\n'| nc -vn <HOST><PORT>
38
+
```
39
+
40
+
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:
41
+
42
+
```bash
43
+
# Domain
44
+
printf'example.com\r\n'| nc -vn <HOST> 43
45
+
46
+
# IP / CIDR / ASN examples
47
+
printf'8.8.8.8\r\n'| nc -vn <HOST> 43
48
+
printf'AS15169\r\n'| nc -vn <HOST> 43
23
49
```
24
50
25
51
Notice than sometimes when requesting for some information to a WHOIS service the database being used appears in the response:
26
52
27
53
.png>)
28
54
55
+
### Referral Chasing and Better Enumeration
56
+
57
+
A lot of useful WHOIS enumeration is hidden behind **referrals**. For example, one server may only point you to the next authoritative WHOIS server for a TLD or an RIR. This is worth testing manually because some custom services mishandle follow-up queries, redact fields inconsistently, or leak extra backend metadata.
58
+
59
+
Useful options and helpers:
60
+
61
+
```bash
62
+
# Ask IANA first and then follow the authoritative referral (common Linux whois clients)
63
+
whois -I example.com
64
+
whois -I 8.8.8.8
65
+
66
+
# Let Nmap follow domain/IP WHOIS referrals automatically
67
+
nmap --script whois-domain <target>
68
+
nmap --script whois-ip <target>
69
+
70
+
# For IP ranges, disable the WHOIS cache if you care about smaller delegated blocks
-**Nameservers** to cluster domains managed by the same operator
79
+
-**Referral server names** to find legacy or forgotten WHOIS infrastructure
80
+
81
+
### RDAP as the Structured Successor
82
+
83
+
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:
A practical offensive nuance: 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 your recon pipeline depends on those values, compare both sources before making decisions.
91
+
92
+
## Offensive Notes
93
+
94
+
### Backend Injection in Custom WHOIS Gateways
95
+
29
96
Also, the WHOIS service always needs to use a **database** to store and extract the information. So, a possible **SQLInjection** could be present when **querying** the database from some information provided by the user. For example doing: `whois -h 10.10.10.155 -p 43 "a') or 1=1#"` you could be able to **extract all** the **information** saved in the database.
30
97
98
+
Do not limit testing to SQLi. In internal or niche WHOIS deployments, the query can be proxied to:
99
+
100
+
- SQL / NoSQL backends
101
+
- LDAP directories
102
+
- shell wrappers around other lookup tools
103
+
- HTTP APIs used by registrar or asset-management portals
104
+
105
+
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**.
106
+
107
+
### Rogue / Stale WHOIS Servers
108
+
109
+
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**.
110
+
111
+
That gives the attacker control over the response body seen by:
112
+
113
+
- old WHOIS clients with hardcoded server mappings
114
+
- web applications that fetch WHOIS output and render it back to users
115
+
- automation that still uses WHOIS for domain validation or ownership workflows
116
+
117
+
This matters because a rogue WHOIS response can become an entry point for:
118
+
119
+
-**stored/reflected XSS** in web WHOIS frontends
120
+
-**parser bugs / command injection / eval bugs** in libraries consuming the text response
121
+
-**bad automation decisions** when systems trust attacker-controlled WHOIS contact data
122
+
123
+
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**.
124
+
31
125
## Shodan
32
126
33
127
-`port:43 whois`
34
128
35
129
## HackTricks Automatic Commands
36
130
37
-
```
131
+
```yaml
38
132
Protocol_Name: WHOIS #Protocol Abbreviation if there is one.
39
133
Port_Number: 43#Comma separated if there is more than one.
40
134
Protocol_Description: WHOIS #Protocol Abbreviation Spelled out
- [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/)
0 commit comments