Summary
A critical path traversal vulnerability in MLflow's artifact extraction logic allows crafted tar.gz archives to write files outside the intended cache directory.
When an attacker controls the archive contents, they can overwrite arbitrary files or escalate privileges, particularly in multi-tenant or shared cluster deployments.
Affected context
This vulnerability appears in environments where MLflow uses the extract_archive_to_dir function from dbconnect_artifact_cache.py to unpack tar.gz artifacts.
It is most relevant when:
- Artifact archives are sourced from locations that tenants or users can influence
- Extraction occurs into a sandbox or cache directory assumed to be isolated
- The surrounding infrastructure treats the MLflow runtime as a trusted component with broad filesystem access
Exploit preconditions
- Attack surface: MLflow artifact ingestion or cache population mechanism that accepts tar.gz files
- Required access: Ability to supply or alter tar.gz artifacts processed by
extract_archive_to_dir - Trigger point: Automatic or manual extraction of an attacker-controlled archive by MLflow
- Why exploitation is possible: Tar member paths are not validated or normalized, enabling
../sequences and absolute paths to redirect writes outside the target directory
Why this happens
The core issue stems from trusting archive metadata without enforcing directory confinement.
The extraction routine iterates over tar members and writes them to disk based directly on their embedded paths, without checking for traversal patterns such as ../ or absolute paths.
This behavior aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory and CWE-29: Path Traversal in Archives, where unvalidated paths within container formats are allowed to escape an intended sandbox.
Potential impact
- Overwrite of arbitrary files accessible to the MLflow process
- Introduction of malicious configuration or code into the host filesystem
- Escaping the artifact cache directory and writing into shared or system locations
- Local privilege escalation if sensitive system or service files can be modified
- Compromise of other tenants' data or workloads in shared cluster environments
General mitigation guidance
Effective mitigation focuses on constraining extraction targets and reducing trust in archive metadata.
Common defensive patterns include:
- Normalizing and validating tar member paths before extraction, rejecting entries that resolve outside the intended directory
- Enforcing a strict, whitelisted extraction root and ignoring absolute paths or
../segments - Treating user- or tenant-supplied archives as untrusted and applying additional validation or filtering
- Running MLflow components with least-privilege filesystem access, limiting the damage from any escaped writes
- Isolating artifact processing in dedicated containers or sandboxes to contain potential traversal effects
How teams detect issues like this
Detection typically involves a mix of code-centric and operational approaches:
- Static analysis rules that flag archive extraction code using unvalidated member names or paths
- Code review checklists requiring path normalization when interacting with tar, zip, or similar archives
- Runtime logging of extraction targets, with alerting when writes occur outside expected cache or sandbox directories
- Policy enforcement in CI/CD to block unsafe archive-handling patterns and encourage vetted helper utilities for extraction

