NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Transformers

CVE-2023-6730: transformers has a Deserialization of Untrusted Data vulnerability

criticalCVSS 3.0 9.0GHSA-3863-2447-669p

A second deserialization flaw in Hugging Face transformers, fixed in 4.36.0 by the same commit as CVE-2023-7018. Before 4.36.0, unsafe pickle loading of downloaded files could run attacker code. The CVSS 3.0 vector calls it network-reachable with scope changed, which is why it scores 9.0.

Published Dec 19, 2023 · Updated Nov 22, 2024 · Analysis Nov 2, 2026

What an attacker can do

The advisory text is one line: deserialization of untrusted data in transformers before 4.36.0. The linked fix commit (pull request 27776) gates pickle.load in the Transformer-XL tokenizer, in get_lm_corpus, and in the legacy RAG retriever's passage and index metadata loaders. The commit is shared with the sibling entry CVE-2023-7018, and the sources do not say which loader belongs to which CVE.

A pickle file can run code the moment it is loaded. An attacker needs a way to make a victim load their file. The usual route is a model or dataset repository on a hub, or a cached file that an attacker can replace. The vector needs low privileges and user interaction, and marks scope as changed, so code runs well beyond the loader itself. In a shared training or serving environment that means the code runs next to other users' data, tokens and cloud credentials.

For teams that pull community models by name in CI or notebooks, the attack surface is every repository you do not control.

Who is affected

transformers on PyPI below 4.36.0. The commit points to the Transformer-XL tokenizer and the legacy RAG retriever as the affected loaders.

Check the installed version, in each virtualenv and image:

pip show transformers

transformers

Ecosystem
PyPI
Affected
< 4.36.0
Fixed in
4.36.0
Check
pip show transformers

How to fix it

Upgrade to transformers 4.36.0:

pip install --upgrade "transformers>=4.36.0"

In the fixed release these pickle loads raise a ValueError unless the TRUST_REMOTE_CODE environment variable is True. Leave it unset except when you have reviewed the source of the files. The sources give no other workaround.

How to tell if you were hit

Inventory the models, tokenizers and retriever indexes your jobs load, and flag any Transformer-XL or legacy RAG files from third-party repositories. On a machine that loaded such a file with an older version, check for unexpected processes, files and outbound connections from the Python process, and rotate any tokens it could read. On 4.36.0 or later, a ValueError that mentions TRUST_REMOTE_CODE shows a blocked load.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Deserialization of Untrusted Data in GitHub repository huggingface/transformers prior to 4.36.0.

Questions

How does CVE-2023-6730 differ from CVE-2023-7018?

Both describe deserialization of untrusted data in transformers before 4.36.0 and link the same fix commit. The advisories do not explain what separates them, so treat them as one upgrade.

What version fixes it?

transformers 4.36.0. Versions below it are in the vulnerable range.

Is it exploitable remotely?

The CVSS 3.0 vector says network, with low privileges and user interaction required. In practice the victim must load a malicious file, for example from a hub repository.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Transformers vulnerabilities

All Transformers entries