CVE-2025-46567: CWE-502: Deserialization of Untrusted Data in hiyouga LLaMA-Factory
LLama Factory enables fine-tuning of large language models. Prior to version 1.0.0, a critical vulnerability exists in the `llamafy_baichuan2.py` script of the LLaMA-Factory project. The script performs insecure deserialization using `torch.load()` on user-supplied `.bin` files from an input directory. An attacker can exploit this behavior by crafting a malicious `.bin` file that executes arbitrary commands during deserialization. This issue has been patched in version 1.0.0.
AI Analysis
Technical Summary
CVE-2025-46567 is a medium-severity vulnerability classified under CWE-502 (Deserialization of Untrusted Data) affecting versions of the hiyouga LLaMA-Factory product prior to 1.0.0. LLaMA-Factory is a tool designed to enable fine-tuning of large language models, a critical function in AI development workflows. The vulnerability resides specifically in the `llamafy_baichuan2.py` script, which insecurely deserializes user-supplied `.bin` files using the PyTorch `torch.load()` function. This function is known to be unsafe when loading data from untrusted sources because it can execute arbitrary code during the deserialization process. An attacker who can supply a crafted `.bin` file to the input directory processed by this script can trigger arbitrary command execution on the host system. This can lead to a compromise of confidentiality, integrity, and availability of the affected system. The vulnerability requires local access with limited privileges (PR:L), and user interaction (UI:R) to supply the malicious file. The attack vector is local (AV:L), meaning remote exploitation is not straightforward without prior access. The vulnerability has been patched in version 1.0.0 of LLaMA-Factory, and no known exploits are currently reported in the wild. The CVSS 3.1 base score is 6.1, reflecting medium severity, with high impact on confidentiality, low impact on integrity, and low impact on availability. The scope remains unchanged (S:U).
Potential Impact
For European organizations utilizing LLaMA-Factory versions prior to 1.0.0, this vulnerability poses a significant risk, especially in AI research, development, and deployment environments. Successful exploitation could allow attackers to execute arbitrary code, potentially leading to data theft, unauthorized access to sensitive AI model parameters, or disruption of AI training pipelines. This could undermine intellectual property protection, compromise AI model integrity, and cause operational downtime. Given the increasing adoption of AI technologies in sectors such as finance, healthcare, automotive, and government within Europe, the impact could extend to critical infrastructure and sensitive data environments. The requirement for local access and user interaction somewhat limits the attack surface; however, insider threats or compromised internal systems could facilitate exploitation. Additionally, organizations relying on automated or semi-automated AI model fine-tuning workflows that ingest external `.bin` files are at higher risk. The vulnerability could also be leveraged as a foothold for lateral movement within networks, escalating the overall threat landscape for affected entities.
Mitigation Recommendations
Upgrade LLaMA-Factory to version 1.0.0 or later, where the insecure deserialization vulnerability has been patched. Implement strict input validation and sanitization for all `.bin` files before processing, including verifying file provenance and integrity using cryptographic signatures or checksums. Restrict access to directories where `.bin` files are placed to trusted users and processes only, minimizing the risk of malicious file injection. Run the LLaMA-Factory fine-tuning processes within isolated environments such as containers or sandboxes with minimal privileges to limit the impact of potential code execution. Monitor file system activity and process execution logs for unusual behavior related to `.bin` file handling and deserialization operations. Educate internal users and developers about the risks of deserializing untrusted data and enforce policies that prevent the use of unverified input files in AI workflows. Consider implementing application-level allowlisting for deserialization operations or replacing `torch.load()` with safer alternatives that do not execute arbitrary code during deserialization.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Denmark
CVE-2025-46567: CWE-502: Deserialization of Untrusted Data in hiyouga LLaMA-Factory
Description
LLama Factory enables fine-tuning of large language models. Prior to version 1.0.0, a critical vulnerability exists in the `llamafy_baichuan2.py` script of the LLaMA-Factory project. The script performs insecure deserialization using `torch.load()` on user-supplied `.bin` files from an input directory. An attacker can exploit this behavior by crafting a malicious `.bin` file that executes arbitrary commands during deserialization. This issue has been patched in version 1.0.0.
AI-Powered Analysis
Technical Analysis
CVE-2025-46567 is a medium-severity vulnerability classified under CWE-502 (Deserialization of Untrusted Data) affecting versions of the hiyouga LLaMA-Factory product prior to 1.0.0. LLaMA-Factory is a tool designed to enable fine-tuning of large language models, a critical function in AI development workflows. The vulnerability resides specifically in the `llamafy_baichuan2.py` script, which insecurely deserializes user-supplied `.bin` files using the PyTorch `torch.load()` function. This function is known to be unsafe when loading data from untrusted sources because it can execute arbitrary code during the deserialization process. An attacker who can supply a crafted `.bin` file to the input directory processed by this script can trigger arbitrary command execution on the host system. This can lead to a compromise of confidentiality, integrity, and availability of the affected system. The vulnerability requires local access with limited privileges (PR:L), and user interaction (UI:R) to supply the malicious file. The attack vector is local (AV:L), meaning remote exploitation is not straightforward without prior access. The vulnerability has been patched in version 1.0.0 of LLaMA-Factory, and no known exploits are currently reported in the wild. The CVSS 3.1 base score is 6.1, reflecting medium severity, with high impact on confidentiality, low impact on integrity, and low impact on availability. The scope remains unchanged (S:U).
Potential Impact
For European organizations utilizing LLaMA-Factory versions prior to 1.0.0, this vulnerability poses a significant risk, especially in AI research, development, and deployment environments. Successful exploitation could allow attackers to execute arbitrary code, potentially leading to data theft, unauthorized access to sensitive AI model parameters, or disruption of AI training pipelines. This could undermine intellectual property protection, compromise AI model integrity, and cause operational downtime. Given the increasing adoption of AI technologies in sectors such as finance, healthcare, automotive, and government within Europe, the impact could extend to critical infrastructure and sensitive data environments. The requirement for local access and user interaction somewhat limits the attack surface; however, insider threats or compromised internal systems could facilitate exploitation. Additionally, organizations relying on automated or semi-automated AI model fine-tuning workflows that ingest external `.bin` files are at higher risk. The vulnerability could also be leveraged as a foothold for lateral movement within networks, escalating the overall threat landscape for affected entities.
Mitigation Recommendations
Upgrade LLaMA-Factory to version 1.0.0 or later, where the insecure deserialization vulnerability has been patched. Implement strict input validation and sanitization for all `.bin` files before processing, including verifying file provenance and integrity using cryptographic signatures or checksums. Restrict access to directories where `.bin` files are placed to trusted users and processes only, minimizing the risk of malicious file injection. Run the LLaMA-Factory fine-tuning processes within isolated environments such as containers or sandboxes with minimal privileges to limit the impact of potential code execution. Monitor file system activity and process execution logs for unusual behavior related to `.bin` file handling and deserialization operations. Educate internal users and developers about the risks of deserializing untrusted data and enforce policies that prevent the use of unverified input files in AI workflows. Consider implementing application-level allowlisting for deserialization operations or replacing `torch.load()` with safer alternatives that do not execute arbitrary code during deserialization.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2025-04-24T21:10:48.175Z
- Cisa Enriched
- true
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 682d9838c4522896dcbebe0b
Added to database: 5/21/2025, 9:09:12 AM
Last enriched: 6/26/2025, 2:14:09 AM
Last updated: 7/29/2025, 1:02:01 AM
Views: 14
Related Threats
CVE-2025-8978: Insufficient Verification of Data Authenticity in D-Link DIR-619L
HighCVE-2025-8946: SQL Injection in projectworlds Online Notes Sharing Platform
MediumCVE-2025-51965: n/a
UnknownCVE-2025-8976: Cross Site Scripting in givanz Vvveb
MediumCVE-2025-8980: Insufficient Verification of Data Authenticity in Tenda G1
HighActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.