p PatchFirst

CVE-2023-35947

CVE-2023-35947 · Path traversal vulnerabilities in handling of Tar archives in Gradle

CVSS 6.9 · Medium · EPSS 0.5%

Compare with your installed version

Affected products and known fixed versions are public information. Compare them with your installed version.

  • gradleNo fix published
  • gradle Debian 12No fix published
  • gradle Debian 13No fix published
  • gradle Debian 14No fix published
  • and 8 more

Check the installed version:

dpkg-query -W -f='${source:Package} ${binary:Package} ${Version}\n' | awk '$1=="gradle"'

Assess your server’s risks

The free check gives you a rating and a risk summary by technology stack, without signing up. It does not answer whether this particular vulnerability affects you.

Monitoring matches public information against your servers’ software. Detailed findings for your servers include the order of updates.

curl -fsSL https://patchfirst.dev/check.sh | sh
Check your server for free →

Channels carry general technology news; monitoring reports new findings on your servers in your dashboard, through browser notifications, in Telegram or via a webhook.

This page contains facts from public vulnerability sources. Check the original advisory before updating.

Gradle is a build tool with a focus on build automation and support for multi-language development. In affected versions when unpacking Tar archives, Gradle did not check that files could be written outside of the unpack location. This could lead to important files being overwritten anywhere the Gradle process has write permissions. For a build reading Tar entries from a Tar archive, this issue could allow Gradle to disclose information from sensitive files through an arbitrary file read. To exploit this behavior, an attacker needs to either control the source of an archive already used by the build or modify the build to interact with a malicious archive. It is unlikely that this would go unnoticed. A fix has been released in Gradle 7.6.2 and 8.2 to protect against this vulnerability. Starting from these versions, Gradle will refuse to handle Tar archives which contain path traversal elements in a Tar entry name. Users are advised to upgrade. There are no known workarounds for this vulnerability.

Impact

This is a path traversal vulnerability when Gradle deals with Tar archives, often referenced as TarSlip, a variant of ZipSlip.

  • When unpacking Tar archives, Gradle did not check that files could be written outside of the unpack location. This could lead to important files being overwritten anywhere the Gradle process has write permissions.
  • For a build reading Tar entries from a Tar archive, this issue could allow Gradle to disclose information from sensitive files through an arbitrary file read.

To exploit this behavior, an attacker needs to either control the source of an archive already used by the build or modify the build to interact with a malicious archive. It is unlikely that this would go unnoticed.

Gradle uses Tar archives for its [Build Cache](https://docs.gradle.org/current/userguide/build_cache.html). These archives are safe when created by Gradle. But if an attacker had control of a remote build cache server, they could inject malicious build cache entries that leverage this vulnerability. This attack vector could also be exploited if a man-in-the-middle can be performed between the remote cache and the build.

Patches

A fix has been released in Gradle 7.6.2 and 8.2 to protect against this vulnerability. Starting from these versions, Gradle will refuse to handle Tar archives which contain path traversal elements in a Tar entry name.

It is recommended that users upgrade to a patched version.

Workarounds

There is no workaround.

  • If your build deals with Tar archives that you do not fully trust, you need to inspect them to confirm they do not attempt to leverage this vulnerability.
  • If you use the Gradle remote build cache, make sure only trusted parties have write access to it and that connections to the remote cache are properly secured.

References

  • [CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')](https://cwe.mitre.org/data/definitions/22.html)
  • [Gradle Build Cache](https://docs.gradle.org/current/userguide/build_cache.html)
  • [ZipSlip](https://security.snyk.io/research/zip-slip-vulnerability)
Published
Updated

Fixes in distributions

  • SUSE-SU-2024:3923-1 · openSUSE Leap 15.5, openSUSE Leap 15.6, SUSE Enterprise Storage 7.1, SUSE Linux Enterprise High Performance Computing 15 SP2-LTSS, SUSE Linux Enterprise High Performance Computing 15 SP3-LTSS, SUSE Linux Enterprise High Performance Computing 15 SP4-ESPOS, SUSE Linux Enterprise High Performance Computing 15 SP4-LTSS, SUSE Linux Enterprise Module for Development Tools 15 SP5, SUSE Linux Enterprise Module for Development Tools 15 SP6, SUSE Linux Enterprise Server 15 SP2-LTSS, SUSE Linux Enterprise Server 15 SP3-LTSS, SUSE Linux Enterprise Server 15 SP4-LTSS, SUSE Linux Enterprise Server for SAP Applications 15 SP2, SUSE Linux Enterprise Server for SAP Applications 15 SP3, SUSE Linux Enterprise Server for SAP Applications 15 SP4 ·

Stack: system

Affected products and versions

  • gradle

    Versions
    • < 7.6.1: Affected
    • >= 8.0, < 8.2: Affected

    No fix published

  • gradle Debian 12

    Versions
    • 4.10.3-1
    • 4.4.1-18
    • 4.4.1-19
    • 4.4.1-20
    • 4.4.1-21
    • 4.4.1-22
    All versions (16)
    • 4.4.1-23
    • 4.5.1-1
    • 4.6-1
    • 4.6-2
    • 4.6-3
    • 4.6-4
    • 4.6-5
    • 4.7-1
    • 4.8-1
    • 4.9-1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • gradle Debian 13

    Versions
    • 4.10.3-1
    • 4.4.1-22
    • 4.4.1-23
    • 4.5.1-1
    • 4.6-1
    • 4.6-2
    All versions (12)
    • 4.6-3
    • 4.6-4
    • 4.6-5
    • 4.7-1
    • 4.8-1
    • 4.9-1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • gradle Debian 14

    Versions
    • 4.10.3-1
    • 4.4.1-22
    • 4.4.1-23
    • 4.5.1-1
    • 4.6-1
    • 4.6-2
    All versions (12)
    • 4.6-3
    • 4.6-4
    • 4.6-5
    • 4.7-1
    • 4.8-1
    • 4.9-1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • gradle Ubuntu 16.04 LTS

    Versions
    • 2.5-3
    • 2.7-1
    • 2.7-2
    • 2.7-3
    • 2.10-1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • gradle Ubuntu Pro 18.04 LTS

    Versions
    • 3.2.1-3build2
    • 3.2.1-4
    • 3.2.1-5
    • 3.4.1-4
    • 3.4.1-6
    • 3.4.1-7ubuntu1
    All versions (8)
    • 4.4.1-5ubuntu2~18.04
    • 4.4.1-5ubuntu2~18.04+esm1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • gradle Ubuntu 20.04 LTS

    Versions
    • 4.4.1-8
    • 4.4.1-9
    • 4.4.1-10
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • gradle Ubuntu 22.04 LTS

    Versions
    • 4.4.1-13
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • gradle Ubuntu 24.04 LTS

    Versions
    • 4.4.1-18
    • 4.4.1-20
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • gradle Ubuntu 25.10

    Versions
    • 4.4.1-22
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • gradle Ubuntu 26.10

    Versions
    • 4.4.1-22ubuntu1
    • 4.4.1-23
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

  • gradle Ubuntu 26.04 LTS

    Versions
    • 4.4.1-22
    • 4.4.1-22build1
    • 4.4.1-22ubuntu1
    Affected ranges
    • ECOSYSTEM: (−∞, +∞)

    No fix published

Original sources

Check your server →