GitHub Advisoryadvisory · npm
GHSA-rxp7-6hxx-x8q5 ip-address: Address6 matches a zone identifier in quadratic time ahead of its length limit, allowing a single long string to stall the process
MEDIUM
Official page ↗
- Aliases
- CVE-2026-111997
- Ecosystem
- npm
- Packages
- ip-address
- Severity
- Moderate
- CVSS vector
- CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N
- Weaknesses
- CWE-1333
- Reviewed
- 2026-10-22
Affected packages
• npm ip-address: < 10.7.4 → fixed in 10.7.4
Description
Summary
`new Address6()` and `Address6.isValid()` strip a zone identifier with the pattern `/%.*$/` before they apply the 45-character length limit. When the string holds many `%` characters followed by a line terminator, the pattern is retried from every `%` and each attempt scans to the line terminator before failing, so rejecting the string takes time proportional to the square of its length. 10,000 `%` characters and a newline take 41 ms, 40,000 take 632 ms and 100,000 take 3.9 s of synchronous work. The same strings without the newline are rejected in under a millisecond.
An application that validates an attacker-supplied string with these methods can be stalled by a single long request. The input is rejected with the correct `AddressError`; the cost of reaching that rejection is the defect.
Details
The constructor in `src/ipv6.ts` removes the CIDR suffix, then the zone, then checks the length of what is left:
```ts
const zone = constants6.RE_ZONE_STRING.exec(address);
if (zone) {
this.zone = zone[0];
address = address.replace(constants6.RE_ZONE_STRING, '');
}
const longest = this.groups * 5 + 5;
if (address.length > longest) {
throw new AddressError(`IPv6 addresses are at most ${longest} characters.`);
}
```
`RE_ZONE_STRING` is `/%.*$/`. It has no anchor at its start, `.` does not match a line terminator (`\n`, `\r`, U+2028 or U+2029), and without the `m` flag `$` matches only at the end of the input. For `%` repeated N times and then `\n`, the engine starts a match at the first `%`, `.*` consumes the remaining `%` characters up to the newline, `$` fails there, and backtracking through every shorter `.*` fails too. The engine then starts again at the second `%`, and so on: N starts, each proportional to N. The length limit that follows rejects the string in constant time, after the scan has already run.
The line terminator need not be last. Any string in which many `%` characters precede a line terminator behaves the same way.
Every entry point that passes a caller's string to the `Address6` constructor is affected: `new Address6()`, `isValid()`, both arguments of `fromAddressAndMask()` and `fromAddressAndWildcardMask()`, and the prefix argument of `fromAddress4Nat64()` and `toAddress4Nat64()`. `fromWildcard()` rejects a `%` before it constructs anything, `fromURL()` admits only hex digits, colons and dots in a host, and `fromArpa()` checks the nibble grammar first, so those three are unaffected. `Address4` has no zone and is unaffected.
Affected versions
` 64) throw new Error('not an IP address');
```
Related
Alias · CVE (1)
- CVE-2026-111997 ip-address before 10.7.4 allows a denial of service (CPU consumption from quadratic complexity, and application stall) via many %… vulnerability
Weakness · CWE (1)
- CWE-1333 Inefficient Regular Expression Complexity weakness
References
- https://github.com/beaugunderson/ip-address/security/advisories/GHSA-rxp7-6hxx-x8q5 web
- https://nvd.nist.gov/vuln/detail/CVE-2026-111997 advisory
- https://github.com/beaugunderson/ip-address/commit/ec80fcd5d7b97defecfd39717d782a9f9f8b89dd web
- https://github.com/beaugunderson/ip-address package
- https://github.com/beaugunderson/ip-address/releases/tag/v10.7.4 web