CVE-2026-145808 in transformers
Summary
by MITRE • 12/06/2026
Hugging Face Transformers before 5.25.0 fails to enforce the force_model pin in the serve command's /load_model and /v1/audio/transcriptions handlers, allowing unauthenticated clients to load arbitrary models. Attackers can load arbitrary local directories or Hub repositories that are never unloaded, exhausting host or GPU memory and, with trust_remote_code enabled, executing chosen repository code.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 12/06/2026
The vulnerability identified in Hugging Face Transformers versions prior to 5.25.0 represents a critical security flaw within the model serving infrastructure, specifically affecting the /load_model and /v1/audio/transcriptions endpoints. This issue stems from a failure to properly enforce the force_model pin configuration parameter during runtime operations. In secure deployment architectures, such pins are designed to restrict which models can be loaded into memory, ensuring that only pre-approved or whitelisted artifacts are executed by the serving process. However, due to this implementation oversight, the authentication and authorization checks associated with model loading were bypassed for unauthenticated clients. This allows any external actor interacting with these endpoints without valid credentials to initiate the loading of arbitrary machine learning models into the host environment.
The technical mechanism behind this exploitation involves manipulating the input parameters sent to the /load_model endpoint or leveraging the audio transcription handler, which internally triggers model initialization routines. By supplying a target path that points to an arbitrary local directory on the server's file system or a repository hosted on Hugging Face Hub, attackers can force the application to instantiate and load these models into memory. The flaw is particularly severe because it operates without requiring any form of user authentication, effectively turning the model serving interface into an open vector for resource exhaustion and potential remote code execution. This lack of access control violates fundamental security principles regarding input validation and privilege separation within server-side applications.
The operational impact of this vulnerability is twofold, encompassing both denial-of-service conditions and arbitrary code execution risks. First, because the loaded models are never automatically unloaded from memory under normal operation unless explicitly requested by an authenticated administrator, attackers can repeatedly load large or numerous models to exhaust available system resources. This leads to a severe degradation in performance for legitimate users and can ultimately cause the server process to crash due to out-of-memory errors on either the CPU or GPU subsystems. Such resource exhaustion constitutes a significant availability risk, disrupting services that rely on continuous model inference capabilities.
Secondly, if the configuration option trust_remote_code is enabled within the Transformers library environment, the consequences escalate from mere resource consumption to full remote code execution. Many models hosted on Hugging Face Hub contain custom Python scripts or architecture definitions that are executed during the loading process to initialize specific layers or preprocessing steps. When an attacker loads a malicious repository with this setting active, they can inject arbitrary Python code into the serving context. This allows for complete compromise of the underlying host system, potentially leading to data exfiltration, lateral movement within the network, or further exploitation of other services running on the same infrastructure.
This vulnerability aligns closely with CWE-284 Improper Access Control and CWE-770 Allocation of Resources Without Limits or Throttling from the Common Weakness Enumeration standard. From a tactical perspective, it maps to ATT&CK technique T1496 Resource Hijacking for denial-of-service purposes and potentially T1059 Command and Scripting Interpreter if code execution is achieved through trust_remote_code exploitation. The lack of authentication on critical administrative functions like model loading also reflects CWE-306 Missing Authentication for Critical Function, highlighting a fundamental gap in the security design of the serving interface.
To mitigate this vulnerability, organizations must immediately upgrade to Hugging Face Transformers version 5.25.0 or later, where these access control checks have been corrected. In environments where upgrading is not instantly feasible, administrators should ensure that trust_remote_code is disabled globally within the configuration settings to prevent arbitrary code execution even if an attacker manages to load a malicious model. Additionally, deploying network-level controls such as firewalls or API gateways can restrict access to the /load_model and audio transcription endpoints to trusted internal IP addresses only, effectively blocking unauthenticated external requests. Regular auditing of served models and implementing strict resource limits on memory allocation for inference processes further reduces the blast radius in case of partial exploitation.