REDHAT-BUG-2533602: High severity npm/proxy-addr vulnerability
proxy-addr is a Node.js module that determines a request's client address behind trusted reverse proxies, and it backs Express req.ip and req.ips. In versions 1.1.0 through 2.0.7, a trust subnet written in IPv4-mapped IPv6 notation with an IPv4-sized prefix, such as ::ffff:10.0.0.0/8 instead of the correct ::ffff:10.0.0.0/104, is accepted without error but trusts every IPv4 address on the internet rather than the block it names. Because the socket peer then becomes trusted at hop 0, any unauthenticated client can supply an arbitrary X-Forwarded-For header and control the address the application reads, which defeats IP-based access control, rate limiting, geolocation, and audit logging. This is a fail-open regression introduced in version 1.1.0. The issue is fixed in proxy-addr 2.0.8, and users should upgrade to 2.0.8 or later. As a workaround, ensure any IPv4-mapped IPv6 trust subnet uses a prefix length of at least 97, or express the range in plain IPv4 notation.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
proxy-addrto a version that resolves this vulnerability.Fixed in 2.0.8 - Configuration
Use a prefix length of at least 97 for any IPv4-mapped IPv6 trust subnet, or express the range in plain IPv4 notation.
proxy-addr IPv4-mapped IPv6 trust subnet prefix length = at least 97
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Deployments using proxy-addr versions 1.1.0 through 2.0.7 are exposed only if they configure a trusted subnet using IPv4-mapped IPv6 notation with an IPv4-sized prefix, such as ::ffff:10.0.0.0/8. Applications using Express req.ip or req.ips can be affected because they rely on proxy-addr.
What does an attacker need to exploit the issue?
An unauthenticated client only needs network access to the application or proxy path where it can provide an X-Forwarded-For header. The misconfigured trust rule causes the socket peer to be trusted, allowing the client to control the address read by the application.
How can I identify an affected trust configuration?
Review proxy trust subnet settings for IPv4-mapped IPv6 ranges beginning with ::ffff: that use an IPv4-sized prefix such as /8. These ranges should use a prefix length of at least 97; for example, the intended ::ffff:10.0.0.0/8 range requires /104.
What can be done if upgrading is not immediately possible?
Change IPv4-mapped IPv6 trust subnets to use a prefix length of at least 97, or express the trusted range in plain IPv4 notation. Upgrade proxy-addr to version 2.0.8 or later when possible.