Mlflow: Command Injection when serving models with enable_mlserver=True
The model_uri parameter is inserted unsanitised into a shell command run via bash -c, so shell metacharacters allow command substitution. An attacker who can control the model_uri could execute arbitrary commands, potentially escalating privileges if a higher-privileged service serves models from a writable directory.
mlflow/mlflow
Originally disclosed on huntr
A command injection vulnerability exists in Mlflow when serving a model with enable_mlserver=True. The model_uri is embedded directly into a shell command executed via bash -c without proper sanitization. If the model_uri contains shell metacharacters, such as $() or backticks, it allows for command substitution and execution of attacker-controlled commands. This vulnerability affects the latest version of mlflow/mlflow and can lead to privilege escalation if a higher-privileged service serves models from a directory writable by lower-privileged users.
From the GitHub Advisory Database (GHSA-rvhj-8chj-8v3c, 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 model_uri is concatenated into a shell command string passed to bash -c without escaping or validation, allowing shell metacharacters to be interpreted.
Impact
An attacker could execute arbitrary commands, and this may lead to privilege escalation if a higher-privileged service serves models from a directory writable by lower-privileged users.
What the attacker needed
Enable_mlserver=True; control over model_uri; writable model directory for escalation
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 builds a command line by gluing user input into it, special characters in that input can be interpreted by the shell as instructions rather than data. Here the model location is placed straight into a shell command, so characters that trigger command substitution let an attacker run their own commands. This is dangerous when a more powerful service processes files from a place a weaker user can write to.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.