Skip to content

sbt vulnerable to arbitrary file write via archive extraction (Zip Slip)

Low severity GitHub Reviewed Published Oct 22, 2023 in sbt/sbt • Updated Nov 10, 2023

Package

maven org.scala-sbt:io_2.12 (Maven)

Affected versions

>= 1.0.0, < 1.9.7

Patched versions

1.9.7
maven org.scala-sbt:io_2.13 (Maven)
>= 1.0.0, < 1.9.7
1.9.7
maven org.scala-sbt:io_3 (Maven)
>= 1.0.0, < 1.9.7
1.9.7
maven org.scala-sbt:sbt (Maven)
>= 0.3.4, < 1.9.7
1.9.7

Description

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 sbt/io#360
sbt 1.9.7 is available with the fix.

Workarounds

A workaround might be use some other library to unzip.

References

References

@eed3si9n eed3si9n published to sbt/sbt Oct 22, 2023
Published by the National Vulnerability Database Oct 23, 2023
Published to the GitHub Advisory Database Oct 24, 2023
Reviewed Oct 24, 2023
Last updated Nov 10, 2023

Severity

Low

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:L

EPSS score

0.050%
(22nd percentile)

Weaknesses

CVE ID

CVE-2023-46122

GHSA ID

GHSA-h9mw-grgx-2fhf

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.