Vulnerabilities in pkg:maven/org.scala-sbt/io_2.13
PACKAGECVE-2023-46122 is a LOW (CVSS 3.9) sbt vulnerable to arbitrary file vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Sbt libraries in the Maven ecosystem. The issue involves sbt vulnerable to arbitrary file write via archive extraction (zip slip). Remediation is available by upgrading affected packages to version 1.9.7.
pkg:maven/org.scala-sbt/io_2.13
Vulnerability advisories affecting package pkg:maven/org.scala-sbt/io_2.13. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-h9mw-grgx-2fhf | CVE-2023-46122 | LOW | sbt vulnerable to arbitrary file write via archive extraction (Zip Slip) |
CVE-2023-46122 at a Glance
Security Impact
CVSS: 3.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:L).
How to Fix CVE-2023-46122
To remediate this vulnerability, upgrade all affected Sbt dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>sbt</artifactId>
<version>1.9.7</version>
</dependency>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>io_2.12</artifactId>
<version>1.9.7</version>
</dependency>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>io_2.13</artifactId>
<version>1.9.7</version>
</dependency>
<dependency>
<groupId>org.scala-sbt</groupId>
<artifactId>io_3</artifactId>
<version>1.9.7</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=org.scala-sbt
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2023-46122, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.scala-sbt
Analyze the terminal output to locate any version of Sbt in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.9.7), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.scala-sbt 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Sbt, 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
CVE-2023-46122 Affected Sbt Versions
4 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.scala-sbt:sbt
|
Maven |
≥ 0.3.4
< 1.9.7
|
1.9.7
|
|
org.scala-sbt:io_2.12
|
Maven |
≥ 1.0.0
< 1.9.7
|
1.9.7
|
|
org.scala-sbt:io_2.13
|
Maven |
≥ 1.0.0
< 1.9.7
|
1.9.7
|
|
org.scala-sbt:io_3
|
Maven |
≥ 1.0.0
< 1.9.7
|
1.9.7
|
References
Frequently Asked Questions
What is CVE-2023-46122?
Which Sbt versions are affected?
What version fixes CVE-2023-46122?
Is sbt affected?
Is io_2.12 affected?
What is the CVSS score of CVE-2023-46122?
What CWE is associated with CVE-2023-46122?
How can I check Maven dependencies for CVE-2023-46122?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-h9mw-grgx-2fhf",
"modified" : "2023-11-01T05:51:17Z",
"published" : "2023-10-24T01:51:04Z",
"aliases" : [ "CVE-2023-46122" ],
"summary" : "sbt vulnerable to arbitrary file write via archive extraction (Zip Slip)",
"details" : "### Impact\n\nGiven specially crafted zip or JAR file, `IO.unzip` allows writing of arbitrary file. The follow is an example of a malicious entry:\n\n```\n+2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys\n```\n\nThis would have a potential to overwrite `/root/.ssh/authorized_keys`. Within sbt's main code, `IO.unzip` is used in `pullRemoteCache` task and `Resolvers.remote`; however many projects use `IO.unzip(...)` directly to implement custom tasks - https://github.com/search?q=IO.unzip+language%3AScala&type=code&l=Scala&p=1\n\n### Patches\n\nThe problem has been patched in https://github.com/sbt/io/pull/360\nsbt 1.9.7 is available with the fix.\n\n### Workarounds\nA workaround might be use some other library to unzip.\n\n### References\n\n- https://github.com/snyk/zip-slip-vulnerability\n- https://security.snyk.io/vuln/SNYK-JAVA-ORGCODEHAUSPLEXUS-31680\n- https://github.com/sbt/io/issues/358",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.scala-sbt:sbt"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.3.4"
}, {
"fixed" : "1.9.7"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.scala-sbt:io_2.12"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.0.0"
}, {
"fixed" : "1.9.7"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.scala-sbt:io_2.13"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.0.0"
}, {
"fixed" : "1.9.7"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.scala-sbt:io_3"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.0.0"
}, {
"fixed" : "1.9.7"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/sbt/sbt/security/advisories/GHSA-h9mw-grgx-2fhf"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-46122"
}, {
"type" : "WEB",
"url" : "https://github.com/sbt/io/issues/358"
}, {
"type" : "WEB",
"url" : "https://github.com/sbt/io/pull/360"
}, {
"type" : "WEB",
"url" : "https://github.com/sbt/io/commit/124538348db0713c80793cb57b915f97ec13188a"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/sbt/sbt"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2023-10-24T01:51:04Z",
"nvd_published_at" : "2023-10-23T16:15:09Z"
}
}