CVE-2023-28628: Uri Lambdaisland/uri `authority-regex` Returns The Wrong Vulnerability

MODERATE
Advisory Identifier: GHSA-cp4w-6x4w-v2h5
CVSS 6.5
CWE-706 CWE-601
Published
Advisory Summary

CVE-2023-28628 is a MODERATE (CVSS 6.5) lambdaisland/uri `authority-regex` returns the wrong vulnerability (CWE-706: Use of Incorrectly-Resolved Name or Reference) affecting Uri libraries in the Maven ecosystem. The issue involves lambdaisland/uri `authority-regex` returns the wrong authority. Remediation is available by upgrading affected packages to version 1.14.120.

CVE-2023-28628 at a Glance

CVE Identifier CVE-2023-28628
GHSA Identifier GHSA-cp4w-6x4w-v2h5
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-706: Use of Incorrectly-Resolved Name or Reference
Affected Product Uri
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2023-28628

To remediate this vulnerability, upgrade all affected Uri dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

lambdaisland:uri fixed: 1.14.120
<dependency>
    <groupId>lambdaisland</groupId>
    <artifactId>uri</artifactId>
    <version>1.14.120</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=lambdaisland

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2023-28628, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=lambdaisland

Analyze the terminal output to locate any version of Uri in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.14.120), your application is affected.

Note: The mvn dependency:tree -Dincludes=lambdaisland command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-706: Use of Incorrectly-Resolved Name or Reference, where the product uses a name or reference to access a resource, but the name/reference resolves to a resource that is outside of the intended control sphere. In Uri, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary `authority-regex` allows an attacker to send malicious URLs to be parsed by the `lambdaisland/uri` and return the wrong authority. This issue is similar to CVE-2020-8910. ### Details https://github.com/lambdaisland/uri/blob/d3355fcd3e235238f4dcd37be97787a84e580072/src/lambdaisland/uri.cljc#L9 This regex doesn't handle the backslash (`\`) character in the username correctly, leading to a wrong output. **Payload:** `https://example.com\\@google.com` The returned host is `google.com`, but the correct host should be `example.com`. `urllib3` (Python) and `google-closure-library` (Javascript) return `example.com` as the host. Here the correct (or current) regex used by `google-closure-library`: https://github.com/google/closure-library/blob/0e567abedb058e9b194a40cfa3ad4c507653bccf/closure/goog/uri/utils.js#L189 ### PoC ``` (ns poc.core) (require '[lambdaisland.uri :refer (uri)]) (def myurl "https://example.com\\@google.com") (defn -main [] (println myurl) (println (:host (uri myurl))) ) ``` ### Impact The library returns the wrong authority, and it can be abused to bypass host restrictions. ### Reference WHATWG Living URL spec, section 4.4 URL Parsing, host state: https://url.spec.whatwg.org/#url-parsing

CVE-2023-28628 Affected Uri Versions

1 component(s)
Fixed Versions:
1.14.120
Product / Package Ecosystem Affected Versions Fixed Version
lambdaisland:uri
Maven
< 1.14.120
1.14.120

References

Frequently Asked Questions

What is CVE-2023-28628?
CVE-2023-28628 is a security vulnerability in Uri involving lambdaisland/uri `authority-regex` returns the wrong authority under CWE-706: Use of Incorrectly-Resolved Name or Reference.
Which Uri versions are affected?
Affected versions include releases prior to 1.14.120 across affected packages: lambdaisland:uri.
What version fixes CVE-2023-28628?
Upgrading to 1.14.120 (or the latest patched release for your respective branch) resolves the vulnerability.
Is uri affected?
Yes, lambdaisland:uri is affected in releases prior to 1.14.120. Upgrade your dependency to 1.14.120 or later.
What is the CVSS score of CVE-2023-28628?
CVE-2023-28628 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2023-28628?
CVE-2023-28628 is classified under CWE-706: Use of Incorrectly-Resolved Name or Reference (The product uses a name or reference to access a resource, but the name/reference resolves to a resource that is outside of the intended control sphere.).
How can I check Maven dependencies for CVE-2023-28628?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=lambdaisland'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-cp4w-6x4w-v2h5",
  "modified" : "2023-03-27T22:31:13Z",
  "published" : "2023-03-27T22:31:13Z",
  "aliases" : [ "CVE-2023-28628" ],
  "summary" : "lambdaisland/uri `authority-regex` returns the wrong authority",
  "details" : "### Summary\n`authority-regex` allows an attacker to send malicious URLs to be parsed by the `lambdaisland/uri` and return the wrong authority. This issue is similar to CVE-2020-8910.\n\n### Details\n\nhttps://github.com/lambdaisland/uri/blob/d3355fcd3e235238f4dcd37be97787a84e580072/src/lambdaisland/uri.cljc#L9\n\nThis regex doesn't handle the backslash (`\\`) character in the username correctly, leading to a wrong output.\n**Payload:** `https://example.com\\\\@google.com`\nThe returned host is `google.com`, but the correct host should be `example.com`.\n\n`urllib3` (Python) and `google-closure-library` (Javascript) return `example.com` as the host. Here the correct (or current) regex used by `google-closure-library`:\n\nhttps://github.com/google/closure-library/blob/0e567abedb058e9b194a40cfa3ad4c507653bccf/closure/goog/uri/utils.js#L189\n\n### PoC\n\n```\n(ns poc.core)\n(require '[lambdaisland.uri :refer (uri)])\n\n(def myurl \"https://example.com\\\\@google.com\")\n\n(defn -main\n  []\n   (println myurl)\n   (println (:host (uri myurl)))\n)\n```\n\n\n### Impact\n\nThe library returns the wrong authority, and it can be abused to bypass host restrictions.\n\n### Reference\n\nWHATWG Living URL spec, section 4.4 URL Parsing, host state: https://url.spec.whatwg.org/#url-parsing",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "lambdaisland:uri"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.14.120"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/lambdaisland/uri/security/advisories/GHSA-cp4w-6x4w-v2h5"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-28628"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lambdaisland/uri/commit/f46db3e84846f79e14bfee0101d9c7a872321820"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/google/closure-library/blob/0e567abedb058e9b194a40cfa3ad4c507653bccf/closure/goog/uri/utils.js#L189"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/lambdaisland/uri"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lambdaisland/uri/blob/d3355fcd3e235238f4dcd37be97787a84e580072/src/lambdaisland/uri.cljc#L9"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lambdaisland/uri/releases/tag/v1.14.120"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-601", "CWE-706" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-03-27T22:31:13Z",
    "nvd_published_at" : "2023-03-27T21:15:00Z"
  }
}