(0Day) Hugging Face Transformers Perceiver Model Deserialization of Untrusted Data Remote Code Execution Vulnerability
The Perceiver model file parser in Hugging Face Transformers does not properly validate user-supplied data, leading to deserialisation of untrusted data. An attacker could exploit this to execute arbitrary code in the context of the current user if the victim opens a malicious model file or visits a malicious page.
Originally disclosed on Zero Day Initiative
This vulnerability allows remote attackers to execute arbitrary code on affected installations of Hugging Face Transformers. User interaction is required to exploit this vulnerability in that the target must visit a malicious page or open a malicious file.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Hugging Face Transformers is a widely used library for loading and running machine learning models. Models are distributed as files, and the library parses those files when a user loads a model. The advisory concerns the Perceiver model implementation and, more specifically, the parsing of model files.
According to the advisory, the flaw is a deserialisation of untrusted data issue: the parsing of model files lacks proper validation of user-supplied data, and that leads to deserialisation of untrusted data. The advisory does not name the specific file format, function or parameter involved.
Setup
The advisory does not describe the researcher's environment, the version of Transformers tested, the operating system, or any tooling. What it does state is the precondition for exploitation: user interaction is required, because the target must visit a malicious page or open a malicious file. The attack is therefore not something an attacker can trigger against an arbitrary remote service on its own; it depends on the victim loading attacker-controlled model content.
Finding it
The advisory frames the issue as a flaw in the parsing of model files, resulting from the lack of proper validation of user-supplied data. That is the level of detail given about the discovery: the parsing path accepts data that should not be trusted and ends up deserializing it. The advisory does not describe the specific observation, test or code path that led the researcher to the conclusion.
Exploitation
The advisory describes the exploitation outcome rather than a step-by-step chain, and it does not publish a payload, request or command. The sequence it sets out is:
- The attacker prepares malicious content, either a page the target visits or a file the target opens.
- The target interacts with that content, satisfying the user interaction requirement.
- The malicious model file is parsed by the affected Hugging Face Transformers installation.
- Because user-supplied data is not properly validated, untrusted data is deserialised.
- The attacker gains code execution in the context of the current user.
The advisory gives no request, response, file content or command for any of these steps, so there is nothing further to reproduce from the published text.
Root cause
The stated cause is the lack of proper validation of user-supplied data within the parsing of model files, which results in deserialisation of untrusted data. In other words, the parser treats model file content as trusted input and deserializes it, and an attacker who controls that content controls what gets deserialised. The advisory does not identify the exact function, the serialisation format, or the validation that was missing, and it does not explain which existing defences, if any, were in place and why they failed. Any statement about the precise code-level mistake would be speculation beyond the published text.
Impact
The impact stated in the advisory is arbitrary code execution on affected installations of Hugging Face Transformers, in the context of the current user. The conditions are explicit: user interaction is required, and the target must either visit a malicious page or open a malicious file. The advisory does not state which users or deployments are affected beyond that, nor does it describe any privilege boundary that the code execution crosses.
The case is rated high severity with a CVSS score of 7.8.
Fix
The advisory does not describe a fix. The vendor response section records that the case was closed as a duplicate of another report, and a later request from ZDI for fix details is recorded without a stated answer. ZDI notified the vendor of its intention to publish the case as a 0-day advisory on 2025-12-18.
The only mitigation the advisory offers is that, given the nature of the vulnerability, the only salient mitigation strategy is to restrict interaction with the product.
Disclosure timeline
The advisory records the following sequence:
| Date | Event |
|---|---|
| 2024-10-16 | Vulnerability reported to vendor; ZDI submitted the report to a third-party bug bounty program |
| 2024-10-17 | The vendor closed the case as a duplicate of another report |
| 2025-03-13 | ZDI asked for the fix details |
| 2025-12-12 | ZDI notified the vendor of the intention to publish the case as a 0-day advisory on 2025-12-18 |
| 2025-12-18 | Coordinated public release of advisory; advisory updated |
The credit for the report is given to The_Kernel_Panic.
Variants to test
The advisory does not enumerate variants. The following follow from its description and are worth trying on similar targets:
- Other model classes in the same library that parse model files. A positive result is a model file that, when loaded, causes deserialisation of content the loader did not validate.
- Other file formats accepted by the same loading path. A positive result is a format that reaches a deserializer without validation.
- Loading paths reached through user-facing features, such as opening a file or visiting a page that triggers a model load. A positive result is code execution in the context of the user who performed the interaction.
Hunting notes
This kind of bug tends to sit where a library accepts files from outside its trust boundary and hands their contents to a deserializer. During recon, the signals are model loading APIs, file parsers for model artefacts, and any feature that loads a model on behalf of a user, particularly where the source of the file is not controlled by the application. The user interaction requirement in this advisory is the key constraint: the bug is reachable when a victim opens attacker-supplied content, not by an unauthenticated request alone.
On impact, the advisory's own framing is what carries the case: code execution in the context of the current user, rated high at CVSS 7.8. The report does not describe how the researcher demonstrated that impact to the program, and the vendor closed the case as a duplicate of another report.
What happened, in plain words
A security researcher found a problem in Hugging Face Transformers, a popular piece of software for running machine learning models. When the software loads a model file, it does not check that file carefully enough. If an attacker can get you to open a file or visit a page that makes the software load a model the attacker prepared, the attacker can run their own code on your computer, with the same permissions you have.
The case was reported through the Zero Day Initiative (ZDI), a programme that collects vulnerability reports and passes them to the companies that make the affected software. The vendor closed it as a duplicate of another report, and no fix details were published. The advisory was published on 18 December 2025, after ZDI notified the vendor of its intention to publish it as a 0-day advisory. It is rated high severity with a CVSS score of 7.8.
The product and the feature involved
Hugging Face Transformers is a library, meaning a collection of ready-made code that other programs use. It is widely used for loading and running machine learning models. A model is the set of numbers that a machine learning system has learned; it is stored in files, and the library reads (parses) those files when a user loads a model.
Parsing means reading a file and turning its contents into something the program can work with. Think of it as a clerk reading a form and copying each field into a database: the clerk has to interpret what is written, and if the form contains instructions the clerk should not follow, things can go wrong.
This advisory concerns the Perceiver model implementation, one particular kind of model the library supports, and more specifically the parsing of model files. The advisory does not name the specific file format, function or parameter involved.
The kind of bug: deserialisation of untrusted data
Deserialisation is the reverse of serialisation. Serialisation means turning a program's data into a stream of bytes so it can be saved to a file or sent over a network. Deserialisation means turning those bytes back into live data in the program.
The danger is that some serialisation formats can describe not just plain data but also objects and actions. If a program deserializes bytes from someone you do not trust, that someone may be able to describe actions the program will then carry out. A common everyday comparison: serialisation is like writing down a recipe, and deserialisation is like a cook following it. If a stranger can slip their own recipe into your kitchen, the cook may follow instructions you never intended.
The advisory calls this "deserialisation of untrusted data": the parsing of model files lacks proper validation of user-supplied data, and that leads to deserialisation of untrusted data. Validation here means checking that the content is what it claims to be and refusing anything unexpected. The advisory does not say which validation was missing.
Setup: what an attacker needs
The advisory does not describe the researcher's environment, the version of Transformers tested, the operating system, or any tooling. What it does state is the precondition for exploitation: user interaction is required, because the target must visit a malicious page or open a malicious file.
That matters because it tells you who has to do something. The attacker cannot simply point at a random server on the internet and take it over. Someone, the victim, has to load model content the attacker controls. The attack therefore depends on the victim opening the door, by visiting a page or opening a file.
Finding it
The advisory frames the issue as a flaw in the parsing of model files, resulting from the lack of proper validation of user-supplied data. That is the level of detail given about the discovery: the parsing path accepts data that should not be trusted and ends up deserializing it. The advisory does not describe the specific observation, test or code path that led the researcher to the conclusion.
Exploitation: the sequence described
The advisory describes the exploitation outcome rather than a step-by-step chain, and it does not publish a payload, request or command. The sequence it sets out is:
- The attacker prepares malicious content, either a page the target visits or a file the target opens.
- The target interacts with that content, satisfying the user interaction requirement.
- The malicious model file is parsed by the affected Hugging Face Transformers installation.
- Because user-supplied data is not properly validated, untrusted data is deserialised.
- The attacker gains code execution in the context of the current user.
Step by step in plain words:
- The attacker builds the trap. It is either a web page or a file, and it contains model content designed to do something harmful when read.
- The victim takes the bait: they open the file or visit the page. This is the user interaction the advisory requires.
- The library reads the model file as part of loading the model.
- Because the file's contents are not properly checked, the library deserializes data the attacker chose.
- The attacker's instructions run as code on the victim's machine, with the victim's own permissions. "In the context of the current user" means the attacker does not get extra powers; they get whatever the logged-in user can do, such as reading that user's files.
The advisory gives no request, response, file content or command for any of these steps, so there is nothing further to reproduce from the published text.
Root cause
The stated cause is the lack of proper validation of user-supplied data within the parsing of model files, which results in deserialisation of untrusted data. In other words, the parser treats model file content as trusted input and deserializes it, and an attacker who controls that content controls what gets deserialised.
The advisory does not identify the exact function, the serialisation format, or the validation that was missing, and it does not explain which existing defences, if any, were in place and why they failed. Any statement about the precise code-level mistake would be speculation beyond the published text.
Impact
The impact stated in the advisory is arbitrary code execution on affected installations of Hugging Face Transformers, in the context of the current user. Arbitrary code execution means the attacker can run whatever program or command they like, not just misuse an existing feature.
The conditions are explicit: user interaction is required, and the target must either visit a malicious page or open a malicious file. The advisory does not state which users or deployments are affected beyond that, nor does it describe any privilege boundary that the code execution crosses.
The case is rated high severity with a CVSS score of 7.8. CVSS is a standard scoring system for vulnerabilities; the score runs from 0 to 10, and higher means more serious. A score of 7.8 falls in the high range.
Fix
The advisory does not describe a fix. The vendor response section records that the case was closed as a duplicate of another report, and a later request from ZDI for fix details is recorded without a stated answer. ZDI notified the vendor of its intention to publish the case as a 0-day advisory on 2025-12-18.
The only mitigation the advisory offers is that, given the nature of the vulnerability, the only salient mitigation strategy is to restrict interaction with the product. In plain words: limit who and what can feed model files to the library, because the file itself cannot be trusted.
Disclosure timeline
The advisory records the following sequence:
| Date | Event |
|---|---|
| 2024-10-16 | Vulnerability reported to vendor; ZDI submitted the report to a third-party bug bounty program |
| 2024-10-17 | The vendor closed the case as a duplicate of another report |
| 2025-03-13 | ZDI asked for the fix details |
| 2025-12-12 | ZDI notified the vendor of the intention to publish the case as a 0-day advisory on 2025-12-18 |
| 2025-12-18 | Coordinated public release of advisory; advisory updated |
A bug bounty programme is a scheme where companies pay researchers for reporting security problems. A duplicate means the same problem had already been reported by someone else, so the vendor treated this report as a repeat rather than a new case. A 0-day advisory is one published before a fix is available.
The credit for the report is given to The_Kernel_Panic.
Variants to test
The advisory does not enumerate variants. The following follow from its description and are worth trying on similar targets:
- Other model classes in the same library that parse model files. A positive result is a model file that, when loaded, causes deserialisation of content the loader did not validate.
- Other file formats accepted by the same loading path. A positive result is a format that reaches a deserializer without validation.
- Loading paths reached through user-facing features, such as opening a file or visiting a page that triggers a model load. A positive result is code execution in the context of the user who performed the interaction.
In plain words, these are places to look for the same mistake elsewhere: other kinds of model, other file formats, and other ways a user can trigger a model load.
Hunting notes
This kind of bug tends to sit where a library accepts files from outside its trust boundary and hands their contents to a deserializer. A trust boundary is the line between data you control and data that comes from elsewhere; anything crossing it should be checked.
During recon, the signals are model loading APIs, file parsers for model artefacts, and any feature that loads a model on behalf of a user, particularly where the source of the file is not controlled by the application. An API, short for application programming interface, is the set of functions a program offers to other programs; here it means the functions that load models.
The user interaction requirement in this advisory is the key constraint: the bug is reachable when a victim opens attacker-supplied content, not by an unauthenticated request alone. An unauthenticated request is one made without logging in; the point is that simply sending traffic to a service is not enough here.
On impact, the advisory's own framing is what carries the case: code execution in the context of the current user, rated high at CVSS 7.8. The report does not describe how the researcher demonstrated that impact to the program, and the vendor closed the case as a duplicate of another report.
Glossary
- 0-day: a vulnerability published or exploited before a fix is available.
- API (application programming interface): the set of functions one program offers to other programs.
- Arbitrary code execution: the ability for an attacker to run any code they choose on the affected machine.
- Bug bounty programme: a scheme in which companies reward researchers for reporting security problems.
- Code execution in the context of the current user: the attacker's code runs with the same permissions as the logged-in user, no more and no less.
- CVSS: a standard scoring system for vulnerabilities, from 0 to 10, where higher is more serious.
- Deserialisation: turning stored or transmitted bytes back into live data inside a program.
- Deserialisation of untrusted data: deserializing content that came from someone who may be hostile, without adequate checks.
- Duplicate: a report of a problem that has already been reported, so the vendor closes it as a repeat.
- High severity: a severity band in vulnerability scoring, below critical and above medium.
- Hugging Face Transformers: a widely used library for loading and running machine learning models.
- Library: a collection of ready-made code that other programs use.
- Mitigation: a measure that reduces risk when a full fix is not available.
- Model: the stored set of numbers a machine learning system has learned, kept in files.
- Model file: a file containing a model, which the library reads when loading it.
- Parsing: reading a file or message and turning its contents into something the program can work with.
- Perceiver: a particular kind of machine learning model supported by the library.
- Serialisation: turning a program's data into bytes so it can be saved or sent.
- Third-party bug bounty program: a bounty programme run by an organisation other than the vendor, to which reports are submitted on the vendor's behalf.
- Trust boundary: the line between data you control and data from elsewhere; data crossing it should be checked.
- Unauthenticated request: a request made without logging in.
- User interaction: an action by the victim, such as opening a file or visiting a page, that is needed for the attack to work.
- Validation: checking that input is what it claims to be and rejecting anything unexpected.
- Vendor: the organisation that makes the affected software.
- Zero Day Initiative (ZDI): a programme that collects vulnerability reports and passes them to vendors.