CVE-2023-46122 Arbitrary file write via archive extraction (Zip Slip) vulnerability in sbt

Low 3.9 Published Updated

Attackers can write arbitrary files via crafted archives in sbt, potentially overwriting SSH keys to gain unauthorized access.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2023-46122?

CVE-2023-46122 is a low-severity path traversal vulnerability in sbt, published on 23 Oct 2023. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official description

sbt is a build tool for Scala, Java, and others. Given a specially crafted zip or JAR file, `IO.unzip` allows writing of arbitrary file. This would have 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. This vulnerability has been patched in version 1.9.7.

Weakness: CWE-22

Which versions are affected by CVE-2023-46122?

8 open source packages ship an affected version, including org.scala-sbt:io_2.12, org.scala-sbt:io_2.13 and org.scala-sbt:io_3. It affects 2 products.

PackageAffectedFixed in
org.scala-sbt:io_2.12 MavenFrom 1.0.01.9.7
org.scala-sbt:io_2.12 MavenFrom 1.0.01.9.7
org.scala-sbt:io_2.13 MavenFrom 1.0.01.9.7
org.scala-sbt:io_2.13 MavenFrom 1.0.01.9.7
org.scala-sbt:io_3 MavenFrom 1.0.01.9.7
org.scala-sbt:io_3 MavenFrom 1.0.01.9.7
2 more packages
org.scala-sbt:sbt MavenFrom 0.3.41.9.7
org.scala-sbt:sbt MavenFrom 0.3.41.9.7
Linux distribution packages (32)
maven SUSE:Enterprise Storage 7.1All versions3.9.4-150200.4.18.1
maven-resolver SUSE:Enterprise Storage 7.1All versions1.9.15-150200.3.14.2
xmvn SUSE:Enterprise Storage 7.1All versions4.2.0-150200.3.14.1
xmvn-connector SUSE:Enterprise Storage 7.1All versions4.2.0-150200.3.14.1
xmvn-mojo SUSE:Enterprise Storage 7.1All versions4.2.0-150200.3.14.1
xmvn-tools SUSE:Enterprise Storage 7.1All versions4.2.0-150200.3.14.1
maven SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSSAll versions3.9.4-150200.4.18.1
maven-resolver SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSSAll versions1.9.15-150200.3.14.2
xmvn SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSSAll versions4.2.0-150200.3.14.1
xmvn-connector SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSSAll versions4.2.0-150200.3.14.1
xmvn-mojo SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSSAll versions4.2.0-150200.3.14.1
xmvn-tools SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSSAll versions4.2.0-150200.3.14.1
maven SUSE:Linux Enterprise High Performance Computing 15 SP3-ESPOSAll versions3.9.4-150200.4.18.1
maven-resolver SUSE:Linux Enterprise High Performance Computing 15 SP3-ESPOSAll versions1.9.15-150200.3.14.2
xmvn SUSE:Linux Enterprise High Performance Computing 15 SP3-ESPOSAll versions4.2.0-150200.3.14.1
xmvn-connector SUSE:Linux Enterprise High Performance Computing 15 SP3-ESPOSAll versions4.2.0-150200.3.14.1
xmvn-mojo SUSE:Linux Enterprise High Performance Computing 15 SP3-ESPOSAll versions4.2.0-150200.3.14.1
xmvn-tools SUSE:Linux Enterprise High Performance Computing 15 SP3-ESPOSAll versions4.2.0-150200.3.14.1
maven SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSSAll versions3.9.4-150200.4.18.1
maven-resolver SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSSAll versions1.9.15-150200.3.14.2
xmvn SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSSAll versions4.2.0-150200.3.14.1
xmvn-connector SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSSAll versions4.2.0-150200.3.14.1
xmvn-mojo SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSSAll versions4.2.0-150200.3.14.1
xmvn-tools SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSSAll versions4.2.0-150200.3.14.1
maven SUSE:Linux Enterprise Module for Development Tools 15 SP4All versions3.9.4-150200.4.18.1
maven-resolver SUSE:Linux Enterprise Module for Development Tools 15 SP4All versions1.9.15-150200.3.14.2
xmvn SUSE:Linux Enterprise Module for Development Tools 15 SP4All versions4.2.0-150200.3.14.1
xmvn-connector SUSE:Linux Enterprise Module for Development Tools 15 SP4All versions4.2.0-150200.3.14.1
xmvn-mojo SUSE:Linux Enterprise Module for Development Tools 15 SP4All versions4.2.0-150200.3.14.1
xmvn-tools SUSE:Linux Enterprise Module for Development Tools 15 SP4All versions4.2.0-150200.3.14.1
maven SUSE:Linux Enterprise Module for Development Tools 15 SP5All versions3.9.4-150200.4.18.1
maven-resolver SUSE:Linux Enterprise Module for Development Tools 15 SP5All versions1.9.15-150200.3.14.2

Products include Scala-Sbt Io, Scala-Sbt Sbt.

How do I fix CVE-2023-46122?

Upgrade org.scala-sbt:io_2.12 to 1.9.7 or later.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2023-46122 being exploited?

There is no known exploitation of CVE-2023-46122 in the wild and no public exploit code.

Sources

Also known as GHSA-h9mw-grgx-2fhf, OESA-2024-2422, SUSE-SU-2023:4527-1.

Is CVE-2023-46122 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free