Junglewise Threat Intelligence

CVE-2022-24723: URI.js leading whitespace bypasses protocol validation

CVE-2022-24723 · Severity: low · CVSS 3.1 · Published 2022-03-03

Technologies: Medialize Uri-Js, urijs (npm). Vendors: npm.

Executive brief

URI.js is a JavaScript library used to parse and manipulate URLs. A flaw in whitespace handling allows attackers to craft malicious URLs with leading whitespace that bypass protocol validation checks, potentially enabling phishing attacks or protocol smuggling attacks that could redirect users to unintended destinations.

Technical details

The vulnerability is an improper input validation issue (CWE-20) in URI.js where leading whitespace characters are not stripped from URLs before parsing. This causes the protocol validation mechanism to fail, as whitespace-prefixed URLs are not recognized as having a protocol. An attacker can craft a URL with leading whitespace (e.g., "\x00javascript:alert(1)") that bypasses security checks intended to prevent dangerous protocols. The flaw affects all versions prior to 1.19.9 and can be exploited via network delivery of a malicious URL, requiring no authentication or user interaction beyond clicking the link. The patch removes leading whitespace before protocol validation.

Affected products

  • medialize URI.js < 1.19.9

Timeline

  • 2022-03-03: disclosed: Published via GitHub Security Advisory
  • 2022-03-03: patched: Fix released in version 1.19.9

References

Related threats