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 package | Versions | Reported by |
|---|---|---|
| sbt sbt | >= 0.3.4, < 1.9.7 | CVE List |
| org.scala-sbt:sbt (Maven) | from 0.3.4 before 1.9.7 | GitHub Advisory Database |
| org.scala-sbt:io_2.12 (Maven) | from 1.0.0 before 1.9.7 | GitHub Advisory Database |
| org.scala-sbt:io_2.13 (Maven) | from 1.0.0 before 1.9.7 | GitHub Advisory Database |
| org.scala-sbt:io_3 (Maven) | from 1.0.0 before 1.9.7 | GitHub Advisory Database |
| scala-sbt io | from 1.0.0 before 1.9.7 | NVD |
| scala-sbt sbt | from 0.3.4 before 1.9.7 | NVD |
All scores
| GitHub_M | 3.9low CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:L |
| GitHub | 3.9low CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:L |
| NVD | 7.1high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H |
Classification
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
| https://github.com/sbt/sbt/security/advisories/GHSA-h9mw-grgx-2fhf | exploit, patch, third-party-advisory, web | |
| https://github.com/sbt/io/issues/358 | issue-tracking, patch, web | |
| https://github.com/sbt/io/pull/360 | patch, web | |
| https://github.com/sbt/io/commit/124538348db0713c80793cb57b915f97ec13188a | patch, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2023-46122 | advisory | |
| https://github.com/sbt/sbt | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2023-46122 changed 2024-09-17 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-h9mw-grgx-2fhf changed 2024-02-16 | CC-BY-4.0 |
| NVD | CVE-2023-46122 changed 2026-06-17 | Public domain |