/

CVE-2025-15379

Severity:

CRITICAL RISK

(9.8)

Command Injection in MLflow Model Serving Local Environment

CVE-2025-15379

Undergoing Analysis

Vulnerability type

Category:

Command Injection

CWE:

CWE-77, CWE-78

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A command injection vulnerability in MLflow's model serving initialization allows attacker-controlled dependency specifications from python_env.yaml to be interpolated directly into a shell command.

When a malicious model artifact is deployed with env_manager=LOCAL, this flaw can enable arbitrary command execution on the host running the MLflow model serving container.

Affected context

This vulnerability arises in MLflow deployments that:

  • Use MLflow model serving with env_manager=LOCAL, and
  • Automatically install model dependencies from a python_env.yaml file inside the model artifact, and
  • Construct shell commands from these dependencies without robust quoting or sanitization.

It primarily affects environments where untrusted or externally supplied model artifacts can be registered, stored, or deployed, such as shared model registries or CI/CD-driven model promotion pipelines.

Exploit preconditions

  • Attack surface: MLflow model serving API or any deployment pipeline that pulls and serves MLflow model artifacts.
  • Required access: Ability to upload, register, replace, or otherwise influence the model artifact containing python_env.yaml.
  • Trigger point: Deployment or initialization of a model with env_manager=LOCAL, where _install_model_dependencies_to_env() processes the python_env.yaml and constructs a shell command.
  • Why exploitation is possible: Dependency entries from python_env.yaml are interpolated directly into a shell command without strict quoting, escaping, or validation, allowing shell metacharacters to introduce additional commands.

Why this happens

The root cause maps to CWE-77: Command Injection. The _install_model_dependencies_to_env() function implicitly trusts data from python_env.yaml, which is part of the model artifact and can be crafted by an attacker.

Instead of treating dependency specifications as data passed to a parameterized process invocation, the implementation builds a shell command string and interpolates these values directly. In shells, characters like ;, &&, |, backticks, and $() are interpreted as control operators or subshells. When unvalidated user-controlled values reach such command contexts, the shell parser merges them into the executable logic, enabling arbitrary commands to run under the privileges of the MLflow serving process.

Potential impact

  • Arbitrary OS command execution on the host or container running MLflow model serving.
  • Unauthorized access to environment variables, credentials, and secrets available to the MLflow process.
  • Exfiltration or tampering with training data, model artifacts, or inference traffic.
  • Lateral movement within the surrounding infrastructure or Kubernetes cluster.
  • Deployment of persistence mechanisms or additional malware on the serving host.
  • Compromise of CI/CD or MLOps pipelines that automatically deploy newly registered models.

General mitigation guidance

Effective mitigation focuses on eliminating shell-based interpolation of untrusted data and tightening trust boundaries around model artifacts:

  • Prefer API-level or library-level process invocation (e.g., subprocess with argument lists, package manager APIs) instead of constructing raw shell command strings.
  • Treat python_env.yaml and similar artifact configuration files as untrusted input, even when sourced from internal registries; enforce strict schema validation and reject unexpected fields or characters.
  • Apply robust quoting and escaping only as a secondary safeguard; the primary defense should be avoiding the shell where possible.
  • Introduce an allowlist-based policy for dependency sources and formats (e.g., only standard PyPI specifiers, no inline scripts, no arbitrary URLs or VCS references unless explicitly required and constrained).
  • Run model serving infrastructure with least privileges, restricting filesystem access, network egress, and access to sensitive credentials to limit blast radius if a similar issue occurs.
  • Segment environments so that models from low-trust sources are deployed into isolated runtimes with tighter controls and reduced access to production data and systems.

How teams detect issues like this

Detection typically combines code-level and operational monitoring approaches:

  • Static analysis and code review:
  • Flag any usage of shell-based process execution (sh -c, bash -c, or subprocess with shell=True) that includes data derived from model artifacts, configuration files, or user input.
  • Highlight string concatenation or f-strings used to build command lines from python_env.yaml fields or other external data.
  • Enforce secure coding guidelines through linters or SAST tools that specifically look for command injection patterns and shell metacharacters in constructed commands.
  • Configuration and policy enforcement:
  • Require security review for any code path that executes package managers or system tools based on runtime configuration.
  • Implement CI policies that block new uses of shell invocation APIs where arguments are not passed as separate parameters.
  • Runtime monitoring:
  • Monitor model serving hosts or containers for anomalous process trees spawned from the MLflow service.
  • Use logging and SIEM integration to detect unusual command executions, unexpected network activity, or access to sensitive files during model deployment.

Sources

SourceLink
github.comgithub.com/mlflow/mlflow/commit/361b6f620adf98385c6721e384fb5ef9a30bb05e
huntr.comhuntr.com/bounties/dc9c1c20-7879-4050-87df-4d095fe5ca75
access.redhat.comaccess.redhat.com/security/cve/CVE-2025-15379
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2452949
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-15379.json

Frequently asked

questions

Yes, in many deployments it can be. If an attacker can remotely submit or influence model artifacts that are later deployed with env_manager=LOCAL, they may achieve remote code execution when the model is served, even if they cannot directly access the serving host.

An attacker needs the ability to control a model artifact containing python_env.yaml that will be deployed by MLflow. This might be through write access to a model registry, object storage bucket, CI pipeline, or any integration that feeds models into MLflow serving.

The most robust fix is to remove shell interpolation of untrusted data entirely: invoke package managers or environment setup tools using parameterized APIs (or subprocess calls with argument lists) and treat all fields from python_env.yaml as data, not as part of a shell command. Complement this with strict validation and allowlists for dependency formats.

Adopt a defensive design posture where model artifacts and configuration files are always considered untrusted. Prohibit shell command construction from external inputs, enforce secure coding practices via code review and automated checks, and isolate model serving environments so that compromise of a single model deployment has limited impact on the broader infrastructure.

Find out what's already
exploitable in your codebase.