CVE-2023-46122
JSON

3.9low

Arbitrary file write via archive extraction (Zip Slip) vulnerability in sbt

Severity
3.9low CVSS:3.1 by GitHub_M
Exploit likelihood
0.37% (higher than 32% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-h9mw-grgx-2fhf

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.

Affected

Product or packageVersionsReported by
sbt sbt>= 0.3.4, < 1.9.7CVE List
org.scala-sbt:sbt (Maven)from 0.3.4 before 1.9.7GitHub Advisory Database
org.scala-sbt:io_2.12 (Maven)from 1.0.0 before 1.9.7GitHub Advisory Database
org.scala-sbt:io_2.13 (Maven)from 1.0.0 before 1.9.7GitHub Advisory Database
org.scala-sbt:io_3 (Maven)from 1.0.0 before 1.9.7GitHub Advisory Database
scala-sbt iofrom 1.0.0 before 1.9.7NVD
scala-sbt sbtfrom 0.3.4 before 1.9.7NVD

All scores

GitHub_M3.9low CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:L
GitHub3.9low CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:L
NVD7.1high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H

Classification

CWE-22

SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.

What each source says

CVE List

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.

GitHub Advisory Database
Impact

Given specially crafted zip or JAR file, IO.unzip allows writing of arbitrary file. The follow is an example of a malicious entry:

+2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys

This 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

Patches

The problem has been patched in https://github.com/sbt/io/pull/360 sbt 1.9.7 is available with the fix.

Workarounds

A workaround might be use some other library to unzip.

References
NVD (es)

sbt es una herramienta de compilación para Scala, Java y otros. Dado un archivo zip o JAR especialmente manipulado, `IO.unzip` permite escribir archivos arbitrarios. Esto tendría potencial para sobrescribir `/root/.ssh/authorized_keys`. Dentro del código principal de sbt, `IO.unzip` se usa en la tarea `pullRemoteCache` y `Resolvers.remote`; sin embargo, muchos proyectos utilizan `IO.unzip(...)` directamente para implementar tareas personalizadas. Esta vulnerabilidad ha sido parcheada en la versión 1.9.7.

References

Sources

SourceRecordLicence
CVE ListCVE-2023-46122 changed 2024-09-17CVE Terms of Use
GitHub Advisory DatabaseGHSA-h9mw-grgx-2fhf changed 2024-02-16CC-BY-4.0
NVDCVE-2023-46122 changed 2026-06-17Public domain