First published: Tue Apr 05 2022(Updated: )
\r, \n and \t characters in user-input URLs can potentially lead to incorrect protocol extraction when using npm package urijs prior to version 1.19.11. This can lead to XSS when the module is used to prevent passing in malicious javascript: links into HTML or Javascript (see following example): ```` const parse = require('urijs') const express = require('express') const app = express() const port = 3000 input = "ja\r\nvascript:alert(1)" url = parse(input) console.log(url) app.get('/', (req, res) => { if (url.protocol !== "javascript:") {res.send("<iframe src=\'" + input + "\'>CLICK ME!</iframe>")} }) app.listen(port, () => { console.log(`Example app listening on port ${port}`) }) ````
Credit: security@huntr.dev security@huntr.dev security@huntr.dev
Affected Software | Affected Version | How to fix |
---|---|---|
Uri.js Project Uri.js | <1.19.11 |
Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.
CVE-2022-1243 is a vulnerability where \r, \n, and \t characters in user-input URLs can lead to incorrect protocol extraction when using npm package urijs prior to version 1.19.11.
The severity of CVE-2022-1243 is high with a CVSS score of 7.2.
CVE-2022-1243 can lead to XSS when the module is used to prevent passing in malicious javascript: links into HTML or JavaScript.
Versions of npm package urijs prior to 1.19.11 are affected by CVE-2022-1243.
To fix CVE-2022-1243, update to version 1.19.11 or later of the urijs npm package.