Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2024-21542

CVE-2024-21542: Luigi Package Zip Slip Vulnerability

CVE-2024-21542 is a path traversal flaw in Luigi package versions before 3.6.0 that enables Zip Slip attacks through improper file path validation. This article covers the technical details, affected versions, and remediation.

Published:

CVE-2024-21542 Overview

CVE-2024-21542 affects the Spotify luigi Python package, a workflow management system used for building complex data pipelines. Versions prior to 3.6.0 contain an Arbitrary File Write vulnerability via Archive Extraction, commonly known as Zip Slip. The flaw resides in the _extract_packages_archive function, which fails to validate destination file paths during tar archive extraction. An attacker who supplies a crafted archive can write files outside the intended extraction directory, potentially overwriting application code or configuration on hosts that process untrusted archives.

Critical Impact

Improper destination path validation in _extract_packages_archive allows attackers to write arbitrary files on systems extracting attacker-controlled tar archives, enabling potential code overwrite and integrity compromise.

Affected Products

  • Spotify luigi Python package versions prior to 3.6.0
  • Data pipelines using luigi/contrib/lsf_runner.py for archive extraction
  • Data pipelines using luigi/contrib/sge_runner.py for archive extraction

Discovery Timeline

  • 2024-12-10 - CVE-2024-21542 published to NVD
  • 2026-04-29 - Last updated in NVD database

Technical Details for CVE-2024-21542

Vulnerability Analysis

The vulnerability is classified as a Path Traversal weakness affecting archive extraction logic [CWE-22, CWE-29]. Luigi's compute-node runners extract tar archives containing serialized work packages. The original implementation used Python's tarfile module directly without verifying that each member's resolved path remained inside the target directory. Crafted archives containing members with paths such as ../../etc/cron.d/payload cause tarfile.extractall to write files outside the intended directory. Because the runners execute on compute nodes that process jobs from upstream systems, an attacker who can influence the archive contents can drop files anywhere the runner process has write access.

Root Cause

The root cause is missing canonicalization and containment checks on archive member names before extraction. Python's tarfile module does not enforce safe paths by default and follows attacker-controlled relative path components. Without validating that the joined destination remains within the extraction root, the runner writes files to attacker-chosen locations.

Attack Vector

An attacker delivers a malicious tar archive to a luigi worker that invokes do_work_on_compute_node or _do_work_on_compute_node. When the runner unpacks the archive, traversal sequences in member names redirect writes outside the working directory. The Snyk advisory and public proof-of-concept demonstrate file write to arbitrary filesystem locations.

python
# Security patch in luigi/contrib/lsf_runner.py
 except ImportError:
     import pickle
 import logging
-import tarfile
+from luigi.safe_extractor import SafeExtractor


 def do_work_on_compute_node(work_dir):

Source: GitHub Commit b5d1b96

python
# Security patch in luigi/contrib/sge_runner.py
 import sys
 import pickle
 import logging
-import tarfile
+from luigi.safe_extractor import SafeExtractor


 def _do_work_on_compute_node(work_dir, tarball=True):

Source: GitHub Commit b5d1b96

The patch replaces direct tarfile usage with a SafeExtractor class that validates member paths before extraction. See the GitHub Issue Discussion and Snyk Vulnerability Report for additional context.

Detection Methods for CVE-2024-21542

Indicators of Compromise

  • Unexpected files written outside the luigi worker's working directory, particularly under paths such as /etc, /var, or user home directories.
  • Tar archives containing member names with .. traversal sequences received by luigi compute nodes.
  • Modifications to Python site-packages, cron directories, or SSH configuration on hosts running luigi workers.

Detection Strategies

  • Inventory installed luigi versions across data engineering hosts and flag any version below 3.6.0.
  • Audit archive sources consumed by _extract_packages_archive and verify that producers are trusted and authenticated.
  • Inspect filesystem audit logs on luigi worker nodes for write events outside the configured work directory by the worker process.

Monitoring Recommendations

  • Enable filesystem integrity monitoring on directories that should never be modified by luigi workers, such as /etc/cron.d, ~/.ssh, and Python site-packages.
  • Log archive ingestion events including source identity, archive hash, and extraction path for forensic correlation.
  • Alert on luigi worker processes invoking tarfile on hosts that still run pre-3.6.0 releases.

How to Mitigate CVE-2024-21542

Immediate Actions Required

  • Upgrade luigi to version 3.6.0 or later across all worker, scheduler, and compute nodes.
  • Restrict luigi worker processes to least-privilege filesystem permissions to limit blast radius if extraction is abused.
  • Validate and authenticate the origin of any tar archive consumed by luigi runners before extraction.

Patch Information

The fix is included in luigi v3.6.0 via commit b5d1b96. The patch introduces a SafeExtractor class in luigi.safe_extractor that validates archive member paths before extraction, replacing direct calls to the standard library tarfile module in lsf_runner.py and sge_runner.py.

Workarounds

  • If immediate upgrade is not possible, isolate luigi workers in containers with read-only mounts for system directories.
  • Reject or pre-scan incoming tar archives for entries containing .. or absolute paths before passing them to luigi.
  • Run luigi workers under dedicated unprivileged service accounts with no write access outside designated work directories.
bash
# Upgrade luigi to a patched version
pip install --upgrade 'luigi>=3.6.0'

# Verify installed version
python -c "import luigi; print(luigi.__version__)"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.