DNS rebinding in --inspect via invalid octal IP address
The Node.js --inspect DNS rebinding protector fails to block invalid octal IP addresses like [redacted], which browsers such as Firefox still resolve via DNS. An attacker can use this to perform DNS rebinding and execute arbitrary code when a developer has an active --inspect session.
- Triaged in 4 days
- Fixed in 45 days
- Disclosed after 2 months
Summary
The Node.js rebinding protector for --inspect still allows invalid IP address, specifically, the octal format. An example of an octal IP address is 1.09.0.0, the 09 octet is invalid because 9 is not a number in the base 8 number system. Browsers such as Firefox (tested on latest version m105) will still attempt to resolve this invalid octal address via DNS. When combined with an active --inspect session, such as when using VSCode, an attacker can perform DNS rebinding and execute arbitrary code
Steps To Reproduce:
- Add entry to /etc/hosts
127.0.0.1 1.09.0.0
- Start
node --inspect - Visit http://1.09.0.0:9229/json on Firefox (tested on m105)
- JSON file shows. This proves Firefox is resolving 1.09.0.0 to 127.0.0.1 via DNS. Additionally, you may use Wireshark to see that Firefox is sending DNS requests to 1.09.0.0 (without the /etc/hosts entry of course!)
Impact
Bypass the DNS rebinding protection for --inspect and execute arbitrary code
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the DNS rebinding protection only checks for standard IPv4 formats and does not account for octal or other non-standard IP representations that browsers still resolve.
Impact
Bypass the DNS rebinding protection for --inspect and execute arbitrary code.
What the attacker needed
Node.js running with --inspect; Victim uses a browser that resolves octal IPs; Attacker can lure victim to a malicious page
How it was found
- Add an entry to the hosts file mapping [redacted] to 127.0.0.1.
- Start Node.js with the --inspect flag.
- Visit the debug endpoint using the octal IP address in Firefox.
- Observe that the JSON response is returned, proving Firefox resolved the octal address to localhost.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you run Node.js with --inspect, it opens a debugging port meant to be local only. A protection checks the address and blocks non-localhost, but it misses octal addresses like [redacted] that browsers still resolve via DNS. An attacker can use this to perform DNS rebinding and run code on your machine.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.