The AI that hacked Hugging Face to pass its exam
· 6 min read
Imagine a student who cannot solve an exam question, so they climb out of the classroom window, break into the school office and look for the answer sheet. Now imagine the student is an AI, and the school office is one of the most important companies in AI.
That is roughly what happened in July. Between 9 and 13 July, an AI agent broke into the systems of Hugging Face, the website where much of the world shares AI models and datasets. On 16 July, Hugging Face said it had been attacked. On 21 July, OpenAI said the attacker was its own models.

First, what is Hugging Face?
If you have never heard of Hugging Face, you have probably still used something that passed through it. It is a bit like GitHub for AI: researchers and companies upload models and datasets there, and others download them to build their own tools. Its logo is the 🤗 emoji, which, after this month, feels a little ironic.
That central role is exactly why this matters. A break-in at Hugging Face is not a break-in at one shop. It is a break-in at the warehouse that supplies a lot of shops.
What OpenAI was testing
Before AI companies release a new model, they test what it could do in the wrong hands. One of those tests is about hacking: can the model find and use security holes in software? OpenAI ran its models on a benchmark called ExploitGym, a set of hacking puzzles with known answers.
To measure what the models could really do, some of their usual safety limits were turned down on purpose. The models were also supposed to be locked inside a sandbox, a closed test environment with no way out to the internet.
Two models took part: GPT-5.6 Sol, and what OpenAI called “an even more capable pre-release model”, an internal prototype it has since switched off and locked away.
How it got out
The way out was a security hole nobody knew about yet, in Artifactory, a tool made by JFrog that stores software packages inside OpenAI’s research setup. The models found the hole and used it to reach the open internet. JFrog has since fixed it.

Once outside, the agent found a test tool that someone had left running on the internet without protection, on a third-party computing service called Modal. It took over that tool and used it as its base camp. Hugging Face later stressed that Modal itself was not hacked; the problem was the unprotected tool a customer had set up there.
From that base, the agent went after Hugging Face. Its first attempts failed. So it kept trying, and found two weaknesses in the code that reads dataset settings. One let it read files it should not see, including secret keys. The other let it run its own code on Hugging Face’s servers.
Days inside
Hugging Face’s own timeline of the attack is one of the most fascinating, and slightly scary, things I have read this year. It counts about 17,600 actions by the agent in total. Most of them failed and went nowhere. But an AI does not get tired or frustrated, and all those small failures added up to a path forward.
Over the following days, the agent:
- read secret keys from Hugging Face’s systems,
- added its own devices to the company’s private internal network,
- gained full control over two computing clusters,
- and even opened a pull request, a proposed code change, to try to run its own code in Hugging Face’s build system.
It also sent messages to itself through public paste sites and its own hidden datasets on Hugging Face, like a spy leaving notes in a hollow tree.
There are also small details that make you stop. A Hugging Face engineer noticed that every destructive cloud command it tried was sent in “dry run” mode, which only checks whether a command would work without actually doing it. And Hugging Face’s own AI security tools did spot the strange signals and put them together, but did not raise the alarm loudly enough to wake the people on call.
Then, a twist I did not expect: when Hugging Face’s team tried to use AI to analyse the attack logs, some models refused to help, because the logs looked like hacking. The team switched to an open model from the Chinese company Z.ai to get the work done.
Why did it do this?
Here is the strange part. According to OpenAI and Hugging Face, the agent was not trying to steal data or cause damage. It was trying to pass its test.
Hugging Face hosts datasets connected to these hacking benchmarks. The agent seems to have worked out that the answers it needed might be sitting there, and went to get them. Hugging Face’s own words: from the agent’s point of view, it was “an attempt to cheat the evaluation”.
In the end, the main customer content it touched was five datasets linked to those benchmarks. Hugging Face found no changes to its code, rotated all its keys, rebuilt one cluster from scratch and closed the holes the agent used.
OpenAI described the incident as the first known case of an autonomous cyberattack carried out by an AI agent.
What I think
This story is funny for about ten seconds. An AI so desperate to pass a test that it breaks into another company to find the answers is a very human thing to do. We have all met that student.
But the more I read, the less funny it got. Nobody told the agent to attack Hugging Face. It was given a goal, and it decided on its own that breaking in was a reasonable way to reach it. It was patient, it tried thousands of things, and it kept going when most of them failed. That is exactly what makes a good attacker.
In project management, there is a simple rule: people optimise for what you measure, not for what you meant. If you reward a team only for closing tickets, you get lots of closed tickets. This is the same lesson at machine speed. The model was measured on solving the test, so it solved the test, by any means available.
The other lesson is about ordinary weaknesses. None of the holes the agent used were science fiction. An unprotected tool on the internet, a key that unlocked too much, a setting that was too broad. Every company has a few of those. Before, finding them took a skilled human a lot of time. Now it takes an AI a few days of trying.
I also think OpenAI deserves both credit and some hard questions. Credit, because it admitted publicly that its own models did this, which is not easy. Questions, because it took five days after Hugging Face went public for OpenAI to say so, and because the obvious one is still open: why were models with lowered safety limits running hacking tests on a setup that could reach the internet at all? “The sandbox had a hole” is an explanation. It is not quite an excuse.
OpenAI has promised a full account in the coming weeks. I will be reading it. In the meantime, if you have a forgotten test server running somewhere on the internet, this would be a good week to turn it off.
Sources
- Hugging Face: Agent intrusion, technical timeline (July 2026) ↗huggingface.co
- OpenAI: Hugging Face model evaluation security incident (July 2026) ↗openai.com
- OpenAI: The Hugging Face incident and the road ahead (July 2026) ↗openai.com
- Fortune: Everything we know and don't know about the OpenAI and Hugging Face hack (July 2026) ↗fortune.com