CVE-2022-1243 (published 2022-04-05T15:15Z)

CRHTLF can lead to invalid protocol extraction potentially leading to XSS in GitHub repository medialize/uri.js prior to 1.19.11.

Severity: MEDIUM
CVSS v2 base score: 4.3 (AV:N/AC:M/Au:N/C:N/I:P/A:N)
CVSS v3 base score: 6.1, MEDIUM (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N)

Weakness information:
cwe_id: NVD-CWE-Other
cwe_name: Other
description: NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
extended_description: Insufficient Information

Fix information:
repo_url: https://github.com/medialize/uri.js
commit_details: repo_url: https://github.com/medialize/uri.js
author: Rodney Rehm
author_date: 2022-04-03 11:24:54+02:00
msg: fix(parse): handle CR,LF,TAB

reported by @haxatron via huntr.dev
repository: repo_url: https://github.com/medialize/uri.js
repo_name: medialize/URI.js
description: Javascript URL mutation library
repo_language: JavaScript
owner: medialize
file_changes: filename: CHANGELOG.md
change_type: ModificationType.MODIFY
diff: @@ -5,6 +5,7 @@ The release notes tracked in this document are also made available on the [relea
 ### master ###
 
 * **SECURITY** fixing [`URI.parse()`](http://medialize.github.io/URI.js/docs.html#static-parse) handle excessive slashes in scheme-relative URLs - disclosed by [zeyu2001](https://github.com/zeyu2001) via https://huntr.dev/
+* **SECURITY** fixing [`URI.parse()`](http://medialize.github.io/URI.js/docs.html#static-parse) remove `\r` (CR), `\n`, (LF) `\t` (TAB) - disclosed by [haxatron](https://github.com/haxatron) via https://huntr.dev/
 
 ### 1.19.10 (March 5th 2022) ###
 

programming_language: Markdown
filename: URI.js
change_type: ModificationType.MODIFY
diff: @@ -240,6 +240,8 @@
     parens: /(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g,
   };
   URI.leading_whitespace_expression = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/
+  // https://infra.spec.whatwg.org/#ascii-tab-or-newline
+  URI.ascii_tab_whitespace = /[\u0009\u000A\u000D]+/g
   // http://www.iana.org/assignments/uri-schemes.html
   // http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers#Well-known_ports
   URI.defaultPorts = {
@@ -497,6 +499,8 @@
     }
 
     string = string.replace(URI.leading_whitespace_expression, '')
+    // https://infra.spec.whatwg.org/#ascii-tab-or-newline
+    string = string.replace(URI.ascii_tab_whitespace, '')
 
     // [protocol"://"[username[":"password]"@"]hostname[":"port]"/"?][path]["?"querystring]["#"fragment]
 

programming_language: JavaScript
filename: urls.js
change_type: ModificationType.MODIFY
diff: @@ -2718,6 +2718,55 @@ var urls = [{
         idn: false,
         punycode: false
       }
+    }, {
+      name: 'ASCII tab or newline',
+      url: 'ja\r\nva\tscript:alert(1)',
+      _url: 'javascript:alert(1)',
+      parts: {
+        protocol: 'javascript',
+        username: null,
+        password: null,
+        hostname: null,
+        port: null,
+        path: 'alert(1)',
+        query: null,
+        fragment: null
+      },
+      accessors: {
+        protocol: 'javascript',
+        username: '',
+        password: '',
+        port: '',
+        path: 'alert(1)',
+        query: '',
+        fragment: '',
+        resource: 'alert(1)',
+        authority: '',
+        origin: '',
+        userinfo: '',
+        subdomain: '',
+        domain: '',
+        tld: '',
+        directory: '',
+        filename: '',
+        suffix: '',
+        hash: '',
+        search: '',
+        host: '',
+        hostname: ''
+      },
+      is: {
+        urn: true,
+        url: false,
+        relative: false,
+        name: false,
+        sld: false,
+        ip: false,
+        ip4: false,
+        ip6: false,
+        idn: false,
+        punycode: false
+      }
     }, {
       name: 'excessive colon in protocol delimiter',
       url: 'http:://www.example.org:8080/hello:world',

programming_language: CoffeeScript