CVE-2026-30827

ADVISORY - github

Summary

Summary

The default keyGenerator in express-rate-limit applies IPv6 subnet masking (/56 by default) to all addresses that net.isIPv6() returns true for. This includes IPv4-mapped IPv6 addresses (::ffff:x.x.x.x), which Node.js returns as request.ip on dual-stack servers.

Because the first 80 bits of all IPv4-mapped addresses are zero, a /56 (or any /32 to /80) subnet mask produces the same network key (::/56) for every IPv4 client. This collapses all IPv4 traffic into a single rate-limit bucket: one client exhausting the limit causes HTTP 429 for all other IPv4 clients.

Details

Root Cause

In source/ip-key-generator.ts:

export function ipKeyGenerator(ip: string, ipv6Subnet: number | false = 56) {
  if (ipv6Subnet && isIPv6(ip)) {
    return `${new Address6(`${ip}/${ipv6Subnet}`).startAddress().correctForm()}/${ipv6Subnet}`
  }
  return ip
}

net.isIPv6('::ffff:192.168.1.1') returns true, so IPv4-mapped addresses enter the subnet masking path. With a /56 prefix, the start address for any ::ffff:x.x.x.x is ::, producing the key ::/56.

Proof of Concept

const { isIPv6 } = require('net');
const { Address6 } = require('ip-address');

function ipKeyGenerator(ip, ipv6Subnet = 56) {
  if (ipv6Subnet && isIPv6(ip)) {
    return `${new Address6(`${ip}/${ipv6Subnet}`).startAddress().correctForm()}/${ipv6Subnet}`;
  }
  return ip;
}

console.log(ipKeyGenerator('::ffff:192.168.1.1', 56)); // ::/56
console.log(ipKeyGenerator('::ffff:10.0.0.1', 56));    // ::/56
console.log(ipKeyGenerator('::ffff:8.8.8.8', 56));     // ::/56
// ALL produce '::/56' — same bucket

End-to-End Validation

On a dual-stack Express server (app.listen(port, '::')), tested with Express 5.2.1:

  • request.ip for IPv4 clients is ::ffff:127.0.0.1
  • Rate limit key resolves to ::/56
  • After limit requests from any IPv4 client, all other IPv4 clients receive 429

When This Occurs

  • Node.js dual-stack servers (default on Linux when listening on ::)
  • Any environment where request.ip contains IPv4-mapped IPv6 addresses
  • Only affects the default keyGenerator (custom key generators are not affected)

Impact

  • Denial of Service: A single client can block all IPv4 traffic by exhausting the shared rate limit
  • Affects default configuration: No special options needed to trigger this

Affected Versions

All versions of express-rate-limit between v8.0.0 and v8.2.1.

Fix

This issue was fixed in commit 14e53888cdfd1b9798faf5b634c4206409e27fc4. This fix has been included in release v8.3.0, and backported to all affected minor versions in the form of releases v8.2.2, v8.1.1, and v8.0.2.

EPSS Score: 0.00013 (0.020)

Common Weakness Enumeration (CWE)

ADVISORY - nist

Allocation of Resources Without Limits or Throttling

ADVISORY - github

Allocation of Resources Without Limits or Throttling


GitHub

CREATED

UPDATED

EXPLOITABILITY SCORE

3.9

EXPLOITS FOUND
-
COMMON WEAKNESS ENUMERATION (CWE)

CVSS SCORE

7.5high
PackageTypeOS NameOS VersionAffected RangesFix Versions
express-rate-limitnpm-->=8.2.0,<8.2.28.2.2
express-rate-limitnpm--=8.1.08.1.1
express-rate-limitnpm-->=8.0.0,<8.0.28.0.2

CVSS:3 Severity and metrics

The CVSS metrics represent different qualitative aspects of a vulnerability that impact the overall score, as defined by the CVSS Specification.

The vulnerable component is bound to the network stack, but the attack is limited at the protocol level to a logically adjacent topology. This can mean an attack must be launched from the same shared physical (e.g., Bluetooth or IEEE 802.11) or logical (e.g., local IP subnet) network, or from within a secure or otherwise limited administrative domain (e.g., MPLS, secure VPN to an administrative network zone). One example of an Adjacent attack would be an ARP (IPv4) or neighbor discovery (IPv6) flood leading to a denial of service on the local LAN segment (e.g., CVE-2013-6014).

Specialized access conditions or extenuating circumstances do not exist. An attacker can expect repeatable success when attacking the vulnerable component.

The attacker is unauthorized prior to attack, and therefore does not require any access to settings or files of the vulnerable system to carry out an attack.

The vulnerable system can be exploited without interaction from any user.

An exploited vulnerability can only affect resources managed by the same security authority. In this case, the vulnerable component and the impacted component are either the same, or both are managed by the same security authority.

There is no loss of confidentiality.

There is no loss of trust or accuracy within the impacted component.

There is a total loss of availability, resulting in the attacker being able to fully deny access to resources in the impacted component; this loss is either sustained (while the attacker continues to deliver the attack) or persistent (the condition persists even after the attack has completed). Alternatively, the attacker has the ability to deny some availability, but the loss of availability presents a direct, serious consequence to the impacted component.

NIST

CREATED

UPDATED

EXPLOITABILITY SCORE

3.9

EXPLOITS FOUND
COMMON WEAKNESS ENUMERATION (CWE)

CVSS SCORE

7.5high