NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · MLflow

CVE-2023-6940: mlflow Command Injection vulnerability

highCVSS 3.1 8.8GHSA-hvc6-42vf-jhf8

MLflow before 2.9.2 renders YAML config files through an unsandboxed Jinja2 environment. A crafted config file that a user downloads and loads can run arbitrary commands on their machine. The fix in 2.9.2 switches to a sandboxed Jinja2 environment.

Published Dec 19, 2023 · Updated Jan 2, 2024 · Analysis Nov 2, 2026

What an attacker can do

The function render_and_merge_yaml(root, template_name, context_name) in mlflow/utils/file_utils.py renders a YAML file as a Jinja2 template. Before the fix it used a plain jinja2.Environment, so template expressions inside the file could reach Python objects and call methods. That is server-side template injection, which the advisory classifies as command injection (CWE-77). The advisory text is short: with one user interaction, downloading a malicious config, an attacker gains full command execution.

The attacker needs the victim to obtain and use a malicious config file, so this is a supply chain style attack. It could come from a shared repository, a project folder or a file passed around a team. The victim does not need to do anything unusual beyond loading it with MLflow. The vector has no privileges and requires user interaction.

Code runs as the user or service running MLflow. On a developer laptop that exposes source, SSH keys and cloud credentials. On a shared tracking or training server it can expose other users' experiments, models and stored secrets.

Who is affected

The pip package mlflow below 2.9.2. Check your version:

pip show mlflow

Any environment that loads YAML config files from sources you do not control is at risk, including CI jobs and shared notebooks.

mlflow

Ecosystem
PyPI
Affected
< 2.9.2
Fixed in
2.9.2
Check
pip show mlflow

How to fix it

Upgrade to mlflow 2.9.2.

pip install -U "mlflow>=2.9.2"

The fix (pull request 10676, commit 5139b10) changes render_and_merge_yaml to use Jinja2's SandboxedEnvironment, keeping the same loader, StrictUndefined and comment prefix settings. The sources list no workaround. Until you upgrade, do not load YAML config files from untrusted sources.

How to tell if you were hit

The advisory gives no indicators. Review YAML config files that were downloaded or received from outside your team for Jinja2 syntax such as {{ ... }} or {% ... %}, especially expressions that touch __class__, __globals__, os or subprocess. Check shell history and process logs on machines that run MLflow for unexpected child processes, outbound connections or new files written around the time a config was loaded.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

with only one user interaction(download a malicious config), attackers can gain full command execution on the victim system.

Questions

Is MLflow 2.9.2 affected by CVE-2023-6940?

No. 2.9.2 is the patched version. Versions below it are affected.

Does this need user interaction?

Yes. The victim must download and load a malicious config file. No credentials are needed by the attacker, but the file has to reach the victim.

Is the flaw really command injection?

The advisory labels it command injection. The fix pull request describes it as server-side template injection in the Jinja2 YAML renderer, which is how arbitrary commands become reachable.

Is it exploited in the wild?

No source I read says so, and the entry has no CISA KEV data.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More MLflow vulnerabilities

All MLflow entries