CVE-2025-14921

Hugging · Hugging Face Transformers

A high-severity vulnerability has been discovered in the Hugging Face Transformers library, specifically affecting the Transformer-XL model.

Executive summary

A high-severity vulnerability has been discovered in the Hugging Face Transformers library, specifically affecting the Transformer-XL model. This flaw allows an attacker to execute arbitrary code on a system by tricking it into loading a malicious model file. Successful exploitation could lead to a complete system compromise, data theft, and disruption of critical AI/ML services.

Vulnerability

This vulnerability is a Deserialization of Untrusted Data flaw. The Transformer-XL model loading mechanism within the Hugging Face Transformers library improperly handles the deserialization of model files, likely those using formats like Python's pickle. An attacker can craft a malicious model file containing embedded code. When an application loads this untrusted file, the deserialization process executes the malicious code, granting the attacker Remote Code Execution (RCE) capabilities with the same permissions as the application running the model.

Business impact

This vulnerability is rated as High severity with a CVSS score of 7.8. A successful exploit could have significant business consequences, including the complete compromise of servers running AI/ML workloads. This could lead to the theft of sensitive intellectual property such as proprietary models and training data, unauthorized access to internal networks, and disruption of revenue-generating services. The potential for reputational damage is also high if customer data or critical business systems are impacted.

Remediation

Immediate Action:

  • Identify all systems, both internal and internet-facing, that utilize the Hugging Face Transformers library to load Transformer-XL models.
  • Apply the security patches released by the vendor immediately, prioritizing systems exposed to the internet or those processing untrusted data.
  • Review system and application logs for any evidence of suspicious model loading events or unexpected command execution that may indicate a prior compromise.

Proactive Monitoring:

  • Monitor application logs for attempts to load models from untrusted or unusual locations.
  • Implement Endpoint Detection and Response (EDR) rules to alert on anomalous process creation (e.g., bash, powershell.exe, reverse shells) originating from the Python processes running the models.
  • Monitor for unexpected outbound network connections from ML servers, which could be an indicator of data exfiltration or an attacker's command-and-control channel.

Compensating Controls:

  • If immediate patching is not feasible, run model inference workloads within a sandboxed or containerized environment with restricted file system and network access to limit the impact of a potential RCE.
  • Implement a strict policy to only load models from trusted, internally-vetted repositories.
  • Use security scanning tools to analyze any third-party or user-submitted models for malicious payloads before they are loaded in a production environment.

Exploitation status

Public Exploit Available: false

Analyst recommendation

This vulnerability presents a high risk to the organization due to the potential for remote code execution on critical AI infrastructure. Immediate patching is the highest priority. While this CVE is not currently listed on the CISA Known Exploited Vulnerabilities (KEV) catalog, its severity warrants an urgent response. All teams responsible for AI/ML systems should begin the identification and remediation process immediately to prevent potential system compromise and data loss.