mlflow Creates of Temporary File in Directory with Insecure Permissions
The temporary directory used by mlflow for Python virtual environments was created with world-writable permissions, allowing an attacker with write access to /tmp to race and overwrite .py files. This could lead to arbitrary code execution.
mlflow/mlflow
Originally disclosed on huntr
In mlflow version 2.20.3, the temporary directory used for creating Python virtual environments is assigned insecure world-writable permissions (0o777). This vulnerability allows an attacker with write access to the /tmp directory to exploit a race condition and overwrite .py files in the virtual environment, leading to arbitrary code execution. The issue is resolved in version 3.4.0.
From the GitHub Advisory Database (GHSA-4x5p-f36r-mxxr, 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 temporary directory was created with permissions 0o777 instead of a restrictive mode, allowing other local users to modify its contents.
Impact
An attacker with write access to /tmp could exploit a race condition to overwrite .py files and achieve arbitrary code execution.
What the attacker needed
Local write access to /tmp; mlflow version 2.20.3
The fix
The issue was fixed in version 3.4.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 a program creates a temporary folder, it should restrict who can write to it. Here, the folder was open to anyone on the system, so another user could replace files inside it before the program used them. That let them run their own code.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.