Skip to content

Zip Slip path traversal in ShadowCopyAction — no independent entry-name sanitization

Moderate
Goooler published GHSA-rr8v-fxxf-c986 Jul 16, 2026

Package

maven com.gradleup.shadow (Maven)

Affected versions

< 9.6.0

Patched versions

9.6.0

Description

Summary

ShadowCopyAction in the Shadow plugin does not validate or sanitize
ZIP entry names before writing them to the output fat JAR. A malicious
upstream dependency containing path traversal sequences (e.g.
../../../../tmp/pwned.txt) in entry names will have those entries
reproduced verbatim in the output shadow JAR.

Details

The vulnerability exists because Shadow relies entirely on Gradle's
ZipFileTree for entry sanitization rather than implementing its own
path validation. This means:

  1. Users on Gradle < 7.6.2 / 8.x < 8.2.0 are directly exploitable
  2. The produced shadow JAR becomes a Zip Slip weapon against any
    downstream consumer using unprotected extraction (raw ZipInputStream,
    older CI tooling, custom Java unpackers)
  3. If Shadow ever uses a non-ZipFileTree code path, protection
    disappears silently

Affected file: src/main/kotlin/com/github/jengelman/gradle/plugins/ shadow/internal/ShadowCopyAction.kt

PoC

  1. Create a malicious JAR with path traversal entry:
import zipfile
with zipfile.ZipFile('evil.jar', 'w') as zf:
    zf.writestr('../../../../tmp/zipslip_proof.txt', 'pwned')
  1. Add as dependency in a shadow project
  2. Run gradle shadowJar
  3. Run unzip -l build/libs/*.jar | grep "\.\."
  4. Traversal entry survives in output JAR

Impact

Any tool extracting the shadow JAR with unprotected extraction is
subject to arbitrary file overwrite. Users on older Gradle versions
are directly vulnerable at build time.

Severity

Moderate

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
None
User interaction
Required
Scope
Changed
Confidentiality
None
Integrity
High
Availability
None

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:N/UI:R/S:C/C:N/I:H/A:N

CVE ID

CVE-2026-75598

Weaknesses

Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

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. Learn more on MITRE.

Credits