indutny / indutny/node-ip

Additional SSRF Bypass: Null Route Format (`"0"`)

Open
#160 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.5k
Forks
228
PR merge metrics
No merged PRs in 30d

Description

# Additional SSRF Bypass: Null Route Format (`"0"`)

## Summary
An additional critical SSRF bypass vulnerability affecting the `ip.isPublic()` function that was not covered in the existing [Issue #150](https://github.com/indutny/node-ip/issues/150).

## Vulnerability Details
The input `"0"` (null route) is incorrectly classified as a public IP address, allowing SSRF bypass attacks:

```javascript
const ip = require('ip');

console.log(ip.isPublic("0")); // true ❌ (should be false)
console.log(ip.isPrivate("0")); // false ❌ (should be true)

// Correct behavior:
console.log(ip.isPublic("127.0.0.1")); // false ✅
```

## Impact
- **Severity**: Critical SSRF bypass
- **Attack vector**: `http://0:port/path` URLs bypass IP validation
- **Network behavior**: `"0"` resolves to `127.0.0.1` (localhost)

## Proof of Concept
```javascript
// Typical vulnerable application
function makeRequest(userUrl) {
const hostname = new URL(userUrl).hostname;

if (ip.isPublic(hostname)) {
return fetch(userUrl); // BYPASSED!
}
throw new Error("Private IP blocked");
}

// Attack succeeds:
makeRequest("http://0:3000/admin"); // Accesses localhost:3000
```

## Reproduction Steps
1. Install: `npm install ip@2.0.1`
2. Test: `node -e "const ip=require('ip'); console.log(ip.isPublic('0'));"`
3. Result: `true` (indicates bypass)

## Relationship to Issue #150
This null route bypass complements the other techniques reported in Issue #150 (`127.1`, `127.0.1`, etc.) but was not included in that list.

## Affected Version
- **Package**: `ip@2.0.1` (current latest)
- **Downloads**: 5+ million weekly

---

**Request**: Please consider adding this bypass to the existing security advisory or assign a CVE for comprehensive coverage of all bypass techniques.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the ip.isPublic() and ip.isPrivate() entry points mentioned in the report and compare their handling of the input "0" with the existing Issue #150 cases. Done should include verified behavior for the reported input and a decision on whether the security advisory or CVE coverage needs updating.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.