Remote code execution in mlflow
The mlflow HTTP dataset loader used an unsanitised filename from the Content-Disposition header or URL path to build the destination file path, allowing path traversal or absolute paths. An attacker could write files to arbitrary locations and potentially execute commands on the vulnerable machine.
mlflow/mlflow
Originally disclosed on huntr
A vulnerability in mlflow/mlflow version 8.2.1 allows for remote code execution due to improper neutralization of special elements used in an OS command ('Command Injection') within the mlflow.data.http_dataset_source.py module. Specifically, when loading a dataset from a source URL with an HTTP scheme, the filename extracted from the Content-Disposition header or the URL path is used to generate the final file path without proper sanitization. This flaw enables an attacker to control the file path fully by utilizing path traversal or absolute path techniques, such as '../../tmp/poc.txt' or '/tmp/poc.txt', leading to arbitrary file write. Exploiting this vulnerability could allow a malicious user to execute commands on the vulnerable machine, potentially gaining access to data and model information. The issue is fixed in version 2.9.0.
From the GitHub Advisory Database (GHSA-5q6c-ffvg-xcm9, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the filename taken from the Content-Disposition header or URL path was joined to a base directory without sanitising path traversal sequences or absolute paths.
Impact
An attacker could write files to arbitrary locations and potentially execute commands, gaining access to data and model information.
What the attacker needed
Mlflow version 8.2.1; loading a dataset from an HTTP URL; attacker controls the HTTP source
The fix
The issue was fixed in version 2.9.0.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When mlflow downloads a dataset over HTTP, it takes the suggested filename from the server and saves the file under that name. Because it did not clean the name, a malicious server could suggest a name like a path that climbs out of the intended folder, so the file lands somewhere else on the disk. Writing a file to the wrong place can sometimes let an attacker run their own commands.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.