GitHub Advisoryadvisory · npm
GHSA-3vjf-82ff-p4r3 Incorrect protocol extraction via \r, \n and \t characters
HIGH
Official page ↗
- Aliases
- CVE-2022-1243
- Ecosystem
- npm
- Packages
- urijs
- Severity
- High
- CVSS vector
- CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N
- Weaknesses
- CWE-20
- Reviewed
- 2022-04-07
Affected packages
• npm urijs: < 1.19.11 → fixed in 1.19.11
Description
\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("CLICK ME!")}
})
app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
})
````
Related
Alias · CVE (1)
- CVE-2022-1243 CRHTLF can lead to invalid protocol extraction potentially leading to XSS in GitHub repository medialize/uri.js prior to 1.19.11. vulnerability
Weakness · CWE (1)
- CWE-20 Improper Input Validation weakness