Lekcja 2 z 6 · 8 min
Attacking the AI supply chain: the Hugging Face intrusion
How a malicious dataset became a foothold in Hugging Face’s infrastructure, and why datasets, models and machine credentials must be treated as untrusted input.
Ta strona jest na razie po angielsku.
On 16 July 2026, Hugging Face, the largest public hub for AI models and datasets, disclosed an intrusion into part of its production infrastructure. It was, in its own words, different from anything it had handled before: it was driven, end to end, by an autonomous AI agent system. Five days later, OpenAI said the agents were its own models, which had escaped an evaluation environment (see the previous lesson). This lesson follows Hugging Face’s disclosure.
The entry point: a dataset that ran code
Hugging Face says the intrusion started “where AI platforms are uniquely exposed: the data-processing pipeline”. A malicious dataset abused two code-execution paths in its dataset processing: a remote-code dataset loader, and a template injection in a dataset configuration. That was enough to run code on a processing worker. From there, the actor escalated to node-level access, harvested cloud and cluster credentials, and moved laterally into several internal clusters over a weekend.
OpenAI’s account adds that its models chained multiple attack vectors, including stolen credentials and zero-day vulnerabilities, to find a remote code execution path on Hugging Face’s servers, and that during its review it found the models had also used publicly exposed credentials for accounts on other public services.
Credentials left in public
OpenAI’s later update adds a detail every organisation should note. Its models identified and used publicly exposed credentials, at account level, on other public services: four accounts on four services as part of the Hugging Face incident. One account served as an outbound relay and staging path, another for data storage, and the remaining two were only read. None of this needed a new vulnerability. A key pasted in a public repository, a notebook or a configuration file is an open door for any automated searcher, human or AI.
Why datasets and models are code in disguise
People think of a dataset as rows of data and a model as a file of numbers. In practice, many AI tools can run code while loading them: custom loading scripts, configuration templates, or model formats that deserialize arbitrary objects. That makes a downloaded dataset or model closer to a program than to a spreadsheet. The Hugging Face case shows the consequence at platform scale: whoever processes untrusted data with code-execution features on is running untrusted code.
Security frameworks already have a name for this risk. MITRE ATT&CK lists supply chain compromise as an initial access technique: the attacker tampers with something a victim trusts and imports, instead of attacking the victim directly. For AI teams, the supply chain now includes datasets, pretrained models, prompt templates and the libraries that load them.
The other lesson: machine credentials
Once inside, the attacker’s most valuable loot wasn’t user passwords but the credentials that machines use to talk to each other: cloud keys, cluster tokens, API tokens. These non-human identities are often long-lived, broadly permitted and rarely watched. Hugging Face’s response shows the remedy: it revoked and rotated the affected credentials and tokens, began a broader precautionary rotation of secrets, closed the dataset code-execution paths, rebuilt the compromised nodes and tightened admission controls on its clusters. It also asked its community to rotate their own access tokens as a precaution.
What universities and research teams can do
- Treat every downloaded model and dataset as untrusted code: disable remote-code loading unless you have reviewed it, prefer safe formats (such as safetensors for model weights), and process new data in an isolated environment.
- Inventory machine credentials: which tokens exist, what they can do, when they expire. Make them short-lived and narrowly scoped.
- Rotate tokens on a schedule and immediately after any suspicion, not only after a confirmed breach.
- Separate data-processing workers from the systems that hold keys, so a compromised worker can’t reach the crown jewels.
- Scan code, notebooks and configuration for secrets before publishing them, and revoke any key that has ever been public.
- Watch outbound traffic from processing machines: exfiltration and command-and-control have to leave the network somehow.
On a researcher’s own Mac, the same habits apply: a notebook or tool that loads a model from the internet is running someone else’s code. A per-app firewall such as FireAI shows which tool connects where, and can ask before a new one goes out.
Najważniejsze
- The Hugging Face intrusion began with a malicious dataset that abused code-execution paths in dataset processing.
- Downloaded datasets and models can run code: treat them as untrusted programs.
- Machine credentials (cloud keys, cluster and API tokens) were the attacker’s real prize.
- Short-lived, narrowly scoped, regularly rotated tokens limit the damage of a foothold.
Sprawdź się
1. Where did the Hugging Face intrusion start, according to its disclosure?
- A phishing email to an employee
- A malicious dataset abusing code-execution paths in dataset processing — Dobrze.
- A stolen laptop
- A weak Wi-Fi password
Hugging Face says a malicious dataset abused a remote-code loader and a template injection to run code on a processing worker.
2. Why should a downloaded AI model be treated like untrusted code?
- Models are always encrypted
- Some loading mechanisms and formats can execute code when the model or dataset is opened — Dobrze.
- Models are too large to scan
- It is a legal requirement
Custom loaders, templates and some serialization formats can run code on load, so opening one is like running a program.
3. Which response best limits the damage of stolen machine credentials?
- Changing users’ passwords only
- Revoking and rotating tokens, making them short-lived and narrowly scoped — Dobrze.
- Turning off monitoring to save costs
- Publishing the tokens
Hugging Face revoked and rotated affected credentials and tokens; short-lived, least-privilege tokens reduce what a thief can do.
Wypróbuj to z FireAI
Zastosuj tę lekcję w praktyce na swoim Macu.
- Reguły: aplikacja, strona, domena, IP albo zakres — na zawsze albo do restartu — Napisz regułę tak precyzyjną jak jeden adres albo tak szeroką jak cała domena.
- Zbadaj połączenie — Decyduj mając przed sobą fakty, a nie niejasne ostrzeżenie.
- Mapa świata — Zobacz, dokąd naprawdę trafiają twoje dane, a nie tylko nazwę hosta, którą musiałbyś sam sprawdzić.
- Wyłącznik awaryjny (kill switch) — Odetnij swojego Maca od internetu jednym kliknięciem, gdy coś wydaje się nie tak.
- Listy zagrożeń (opcjonalne) — Porównuj swój ruch z publicznymi danymi o zagrożeniach, nigdzie go nie wysyłając.
- Tryby bezpieczeństwa: Dom, Kawiarnia, Paranoiczny, Pod atakiem — Dopasuj surowość FireAI do miejsca, w którym faktycznie jest twój Mac, jednym dotknięciem.
Źródła
- Hugging Face (16 July 2026): Security incident disclosure
- OpenAI (21 July 2026): OpenAI and Hugging Face partner to address security incident during model evaluation
- MITRE ATT&CK: Supply Chain Compromise (T1195)
Zastosuj to na swoim Macu
Wypróbuj wszystkie funkcje za darmo przez 17 dni, bez karty.