← Home

express-rate-limit

Basic IP rate-limiting middleware for Express. Use to limit repeated requests to public APIs and/or endpoints such as password reset.

51
Versions
MIT
License
No
Install Scripts
Verified
Provenance

Supply chain provenance

Status for the latest visible version.

SLSA provenance attestation npm registry signatures gitHead linked

Maintainers

nfriedlygamemaker1

Keywords

express-rate-limitexpressratelimitratelimitrate-limitmiddlewareipauthauthorizationsecuritybruteforcebruteforcebrute-forceattack

Accepted risks

Findings the reviewer chose to accept rather than block on.

SourceRuleReasonAccepted byWhen
provenance publisher-changed AI (provenance): Publisher changed to GitHub Actions with SLSA provenance — this is a CI/CD publishing migration, standard for mature packages. ai

Versions (showing 51 of 112)

View all versions
Version Deps Published
8.5.2 1 / 23
8.5.1 1 / 23
8.5.0 1 / 23
8.4.1 1 / 23
8.4.0 1 / 23
8.3.2 1 / 23
8.3.1 1 / 23
8.0.0 1 / 24
7.5.1 0 / 22
7.5.0 0 / 22
7.4.1 0 / 22
7.4.0 0 / 22
7.3.1 0 / 22
7.3.0 0 / 22
7.2.0 0 / 22
7.1.5 0 / 22
7.1.4 0 / 21
7.1.3 0 / 21
7.1.2 0 / 21
7.1.1 0 / 21
7.1.0 0 / 21
7.0.2 0 / 21
7.0.1 0 / 22
7.0.0 0 / 22
6.11.2 0 / 22
6.11.1 0 / 22
6.11.0 0 / 22
6.10.0 0 / 22
6.9.0 0 / 19
6.8.1 0 / 19
6.8.0 0 / 19
6.7.2 0 / 19
6.7.1 0 / 19
6.7.0 0 / 19
6.6.0 0 / 19
6.5.2 0 / 19
6.5.1 0 / 19
6.4.0 0 / 19
6.3.0 0 / 19
6.2.1 0 / 19
6.2.0 0 / 19
6.1.0 0 / 19
6.0.5 0 / 19
6.0.4 0 / 19
6.0.3 0 / 19
6.0.2 0 / 19
6.0.1 0 / 18
6.0.0 0 / 17
5.5.1 0 / 11
5.5.0 0 / 11
5.4.1 0 / 11

v8.5.2

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v8.5.1

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v8.5.0

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v8.4.1

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v8.4.0

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v8.3.1

2 findings
HIGH Publisher changed: gamemaker1 → GitHub Actions (on 2026-03-09) provenance

This version was published by a different npm account than previous versions on 2026-03-09. This could indicate a legitimate maintainer transition or an account compromise.

INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v8.0.0

2 findings
HIGH GHSA-46wh-pxpv-q5gq: express-rate-limit: IPv4-mapped IPv6 addresses bypass per-client rate limiting on servers with dual-stack network osv

CVSS 7.5 (HIGH) — CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H ## 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`: ```typescript 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 ```javascript 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.

INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v7.5.1

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v7.5.0

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v7.4.1

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v7.4.0

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v7.3.1

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v7.3.0

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v7.2.0

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v7.1.5

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v7.1.4

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v7.1.3

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v7.1.2

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v7.1.1

1 finding
INFO Has SLSA provenance attestation provenance

Published via CI/CD with Sigstore attestation (predicate: https://slsa.dev/provenance/v1). This is the strongest supply chain integrity signal.

v7.1.0

1 finding
LOW No provenance attestation provenance

Package was published without Sigstore provenance. Consider requesting the maintainer enable provenance via CI/CD.

v7.0.2

1 finding
LOW No provenance attestation provenance

Package was published without Sigstore provenance. Consider requesting the maintainer enable provenance via CI/CD.

v7.0.1

1 finding
LOW No provenance attestation provenance

Package was published without Sigstore provenance. Consider requesting the maintainer enable provenance via CI/CD.

v7.0.0

1 finding
LOW No provenance attestation provenance

Package was published without Sigstore provenance. Consider requesting the maintainer enable provenance via CI/CD.