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

CVE-2024-27134: MLflow Privilege Escalation Vulnerability

CVE-2024-27134 is a privilege escalation flaw in MLflow that exploits excessive directory permissions in the spark_udf API, allowing local attackers to gain elevated access through ToCToU attacks. This article covers technical details, affected versions, security impact, and mitigation strategies.

Published:

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-27134 Overview

CVE-2024-27134 is a local privilege escalation vulnerability in MLflow, an open-source machine learning lifecycle platform maintained by LF Projects. The flaw stems from excessive directory permissions created when the spark_udf() MLflow API is invoked. A local attacker with low privileges can abuse a Time-of-Check to Time-of-Use (TOCTOU) race condition against the writable directory to gain elevated permissions on the host. The weakness is categorized as [CWE-276] Incorrect Default Permissions and affects workflows that load MLflow models as Spark user-defined functions.

Critical Impact

A local, low-privileged attacker can escalate privileges on hosts running MLflow when spark_udf() is called, leading to full compromise of confidentiality, integrity, and availability.

Affected Products

  • LF Projects MLflow (versions prior to the fix delivered in pull request #10874)
  • MLflow deployments that invoke the spark_udf() API
  • Multi-tenant hosts where MLflow and other local users share filesystem access

Discovery Timeline

  • 2024-11-25 - CVE-2024-27134 published to the National Vulnerability Database
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-27134

Vulnerability Analysis

The vulnerability arises when MLflow's spark_udf() function creates working directories with permissions that are broader than required. These directories are writable by users other than the MLflow process owner. Because the function later reads and executes files from this location, a concurrent local user can replace or modify files between the time MLflow checks them and the time it uses them. This TOCTOU race enables arbitrary file substitution within a trusted execution path. When MLflow later consumes these files, code supplied by the attacker runs under the privileges of the MLflow process. On systems where MLflow runs as a privileged service account, this results in local privilege escalation.

Root Cause

The root cause is incorrect default directory permissions ([CWE-276]) combined with a classic TOCTOU race condition. The spark_udf() code path provisions a temporary working directory that any local user on the system can modify. MLflow trusts the contents of that directory for subsequent model loading and execution without validating file integrity or restricting access to the directory owner.

Attack Vector

Exploitation requires local access and low privileges on the host where MLflow runs. The attacker must also win a race window, which raises attack complexity. The attack sequence involves monitoring for creation of the spark_udf() working directory, writing or replacing files inside it, and waiting for MLflow to consume the planted content. No user interaction is required. Successful exploitation yields code execution under the MLflow service account, which commonly holds broader filesystem and data access than the attacker's own account.

No verified public proof-of-concept code is available. Technical remediation details are documented in the MLflow Pull Request #10874.

Detection Methods for CVE-2024-27134

Indicators of Compromise

  • Unexpected files or symbolic links created inside MLflow temporary directories used by spark_udf().
  • MLflow service account spawning child processes that execute binaries or scripts from world-writable paths.
  • Local user accounts accessing MLflow working directories they do not own.
  • Modified Python modules, pickle files, or model artifacts within MLflow's Spark UDF staging directories.

Detection Strategies

  • Audit filesystem permissions on directories created by the MLflow process and flag any that are group- or world-writable.
  • Monitor for write operations to MLflow temporary paths originating from user IDs other than the MLflow service account.
  • Correlate spark_udf() invocations with subsequent process execution events to identify unauthorized code paths.

Monitoring Recommendations

  • Enable Linux audit (auditd) rules on MLflow working directories to log file creation, modification, and permission changes.
  • Capture process ancestry telemetry for the MLflow service to detect execution of attacker-planted artifacts.
  • Alert on privilege transitions where a low-privileged user action precedes privileged code execution by the MLflow account.

How to Mitigate CVE-2024-27134

Immediate Actions Required

  • Upgrade MLflow to a version that includes the fix from Pull Request #10874.
  • Restrict local shell and interactive access on hosts that run MLflow with spark_udf().
  • Run MLflow under a dedicated, least-privileged service account on dedicated hosts where feasible.
  • Review existing MLflow temporary directories and tighten permissions to owner-only access.

Patch Information

The upstream fix is tracked in MLflow Pull Request #10874, which corrects the directory permissions created by spark_udf(). Deploy the patched release across all MLflow tracking servers, workers, and client environments that may call spark_udf(). Confirm the installed version in production matches the patched release and rebuild container images that embed MLflow.

Workarounds

  • Avoid invoking the spark_udf() API until the patched MLflow version is deployed.
  • Isolate MLflow workloads on single-tenant hosts to eliminate untrusted local users.
  • Set the TMPDIR environment variable for the MLflow process to a directory with 0700 permissions owned by the service account.
  • Apply mandatory access controls such as SELinux or AppArmor profiles to constrain the MLflow process's filesystem access.
bash
# Example: create a restricted temporary directory for the MLflow service account
sudo install -d -o mlflow -g mlflow -m 0700 /var/lib/mlflow/tmp
sudo systemctl set-environment TMPDIR=/var/lib/mlflow/tmp
sudo systemctl restart mlflow

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

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.