REDHAT-BUG-2521777: High severity npm/fast-uri vulnerability
fast-uri is a URI parser for Node.js. It canonicalizes a host to its ASCII form only when the input carries an explicit scheme, so a scheme-relative reference such as a host preceded by two slashes is returned with its host verbatim and no error set. As a result fast-uri's own entry points disagree with each other: parse, resolve, normalize, and equal can yield different hosts for the same input depending only on whether a scheme is written out, and equal can return opposite verdicts for the same pair of hosts. An application that extracts a host with fast-uri to check it against a policy list and then resolves the same reference can make its decision on one host while the destination is another, enabling host confusion and policy bypass. The affected versions are 2.4.2 up to but not including 2.4.5, 3.1.3 up to but not including 3.1.6, and 4.0.1 up to but not including 4.1.3. The issue is fixed in 2.4.5, 3.1.6, and 4.1.3, which canonicalize the host consistently across the resolve path. Users should upgrade to a patched version.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
fast-urito a version that resolves this vulnerability.Fixed in 2.4.5 - Upgrade
Upgrade
fast-urito a version that resolves this vulnerability.Fixed in 3.1.6 - Upgrade
Upgrade
fast-urito a version that resolves this vulnerability.Fixed in 4.1.3
Event History
Frequently Asked Questions
Which deployments are affected?
Deployments using npm/fast-uri versions 2.4.2 through 2.4.4, 3.1.3 through 3.1.5, or 4.0.1 through 4.1.2 are affected. Versions 2.4.5, 3.1.6, and 4.1.3 contain the fix.
What application behavior makes this exploitable?
An application must make a security or policy decision using a host extracted by fast-uri, such as checking it against an allowlist or denylist, and then resolve the same scheme-relative reference. The inconsistent host canonicalization can cause the checked host to differ from the resolved destination.
What input form is involved in the host confusion?
The issue involves scheme-relative URI references, where the host is preceded by two slashes but no explicit scheme is present. In this form, the host can be returned verbatim by parsing while other fast-uri operations may produce a different canonicalized host.
What should teams do if they use affected versions?
Upgrade fast-uri to 2.4.5, 3.1.6, or 4.1.3, as appropriate for the major version in use. Until upgraded, avoid relying on fast-uri host extraction for policy enforcement when the same URI is later resolved.