REDHAT-BUG-2556007: Low severity npm/fast-uri vulnerability
fast-uri is a dependency-free RFC 3986 URI parser and serializer for Node.js. In versions before 2.4.8, from 3.0.0 through 3.1.8, and from 4.0.0 through 4.2.2, when serialize(), normalize(), or resolve() are called with the non-default option reference set to suffix on a reference that has no authority, the emitted relative reference can contain a bare colon in its first path segment without escaping it, even though RFC 3986 forbids that because it makes the string reparse as an absolute URI with a scheme. An application that serializes or normalizes a relative reference with the suffix option and then treats the result as a URI can turn inert input into a live javascript, data, or vbscript URL, a cross-site scripting vector, and the equal() comparison can conflate a scheme-bearing reference with a relative one. Exposure is limited to applications using the non-default suffix reference option. The issue is fixed in fast-uri 2.4.8, 3.1.9, and 4.2.3, and users should upgrade to one of these versions or later. As a workaround, avoid the suffix reference option on untrusted input, or percent-encode a colon in the first path segment of the result before treating it as a URI.
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.8 - Upgrade
Upgrade
fast-urito a version that resolves this vulnerability.Fixed in 3.1.9 - Upgrade
Upgrade
fast-urito a version that resolves this vulnerability.Fixed in 4.2.3 - Compensating control
For untrusted input, avoid the non-default suffix reference option, or percent-encode a colon in the result’s first path segment before treating it as a URI.
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Exposure is limited to applications that use fast-uri with the non-default reference option set to suffix. Applications that do not use that option are not affected by this behavior.
What conditions are required for exploitation?
An application must call serialize(), normalize(), or resolve() with reference set to suffix on a reference with no authority, then treat the emitted result as a URI. The resulting first path segment must contain an unescaped colon that can cause the value to be reparsed as a scheme-bearing URI.
What could happen if the vulnerable output is used in a URI context?
A relative reference can be transformed into a javascript:, data:, or vbscript: URL, creating a cross-site scripting vector. The equal() comparison may also treat a scheme-bearing reference as equivalent to a relative reference.
What can be done if an upgrade cannot be applied immediately?
Avoid using the suffix reference option with untrusted input. If the result must be treated as a URI, percent-encode any colon in its first path segment before doing so.
Which versions contain fixes?
Upgrade to fast-uri 2.4.8, 3.1.9, or 4.2.3, or a later version in the applicable release line.