The Illusion of the Pin: Measuring Cross-Repository Remote Code on the Hugging Face Hub

Hugging Face transformers lets a model repository declare, in its auto_map configuration, that a class needed to load it is defined in a different repository. When such a model is loaded with trust_remote_code=True and pinned with revision, the pin does not cover the other repository: unless a separate code_revision is passed, that code is fetched from the default branch at load time. A library advisory and a threat report on an in-the-wild campaign have described this gap. We measure its prevalence and consequences. Of all 61,676 models tagged custom_code on 2 December 2026, 27.0% (16.5% of their 30-day downloads) declare at least one class whose code is fetched from another repository. Across the commit histories of the 841 retrievable referenced repositories, 24.3% of the analysable dependent models (an upper bound) saw their loaded code change after publication, and a human confirmed 8 changes that newly added risky capabilities, affecting 71 models (a lower bound). Downstream, 95.8% of 1,323 de-duplicated GitHub call sites that load such models set no revision. Of the 30 sites that pin a full commit hash, 23 leave the referenced code unpinned, and in 8 of those the code changed after the calling file was last modified. A static audit of ten wrapper libraries finds that only one appears to forward code_revision on every path. We also re-detect a reported malicious payload repository and report three additional carrier models. Notes: Preprint, not peer reviewed. Coordinated disclosure: maintainers and Hugging Face were notified on 3 December 2026. Library names and code locations for unpatched wrapper findings are withheld in v1 and will be added in a later version. Use of AI: this work was carried out largely by Claude agents (Anthropic), with human decisions, verification and disclosure as described in the paper's "Use of AI" section.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-12-03
DOI
https://doi.org/10.5281/zenodo.24774718
Primary Topic
Adversarial Robustness in Machine Learning
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

The Illusion of the Pin: Measuring Cross-Repository Remote Code on the Hugging Face Hub

Jongwon Lee
Zenodo (CERN European Organization for Nuclear Research)
Adversarial Robustness in Machine Learning
preprint

The Illusion of the Pin: Measuring Cross-Repository Remote Code on the Hugging Face Hub

Jongwon Lee
preprint en

Abstract

Hugging Face transformers lets a model repository declare, in its auto_map configuration, that a class needed to load it is defined in a different repository. When such a model is loaded with trust_remote_code=True and pinned with revision, the pin does not cover the other repository: unless a separate code_revision is passed, that code is fetched from the default branch at load time. A library advisory and a threat report on an in-the-wild campaign have described this gap. We measure its prevalence and consequences. Of all 61,676 models tagged custom_code on 2 December 2026, 27.0% (16.5% of their 30-day downloads) declare at least one class whose code is fetched from another repository. Across the commit histories of the 841 retrievable referenced repositories, 24.3% of the analysable dependent models (an upper bound) saw their loaded code change after publication, and a human confirmed 8 changes that newly added risky capabilities, affecting 71 models (a lower bound). Downstream, 95.8% of 1,323 de-duplicated GitHub call sites that load such models set no revision. Of the 30 sites that pin a full commit hash, 23 leave the referenced code unpinned, and in 8 of those the code changed after the calling file was last modified. A static audit of ten wrapper libraries finds that only one appears to forward code_revision on every path. We also re-detect a reported malicious payload repository and report three additional carrier models. Notes: Preprint, not peer reviewed. Coordinated disclosure: maintainers and Hugging Face were notified on 3 December 2026. Library names and code locations for unpatched wrapper findings are withheld in v1 and will be added in a later version. Use of AI: this work was carried out largely by Claude agents (Anthropic), with human decisions, verification and disclosure as described in the paper's "Use of AI" section.

Zenodo (CERN European Organization for Nuclear Research)
Adversarial Robustness in Machine Learning
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon