Deep dive · XiaoHu explains

An AI agent broke into Hugging Face's network — and when the team went to investigate, commercial models mistook them for the attacker

The intrusion ran across a single weekend and left more than 17,000 logged actions. What finally got through the analysis was GLM 5.2, an open-weight model running on Hugging Face's own hardware.
The one-minute version
  • Hugging Face published a disclosure on July 16 saying that earlier that week it found part of its production infrastructure — the internal systems that actually serve users — had been compromised. The entire operation was run end to end by an automated AI agent system.
  • The way in was a malicious dataset. It exploited two flaws in the dataset-processing path to execute code on the machine handling it, then escalated to full control of that machine, harvested cloud and cluster credentials, and spent a weekend moving laterally into several internal clusters.
  • What got touched: some internal datasets, plus credentials used by several services. No evidence of tampering was found in public models, datasets, or Spaces — the small live apps users host on the platform. Container images and published packages verified clean. Whether partner and customer data was affected is still under review.
  • For forensics, the team first reached for the strongest models available through commercial APIs. The requests were blocked by safety guardrails, because what they needed to submit was exactly the attacker's real commands and the exploit code used to get in. Switching to open-weight GLM 5.2 running on their own machines is what let them work through all 17,000-plus events.
  • Hugging Face's advice to defenders: pick a model you can run in your own environment and validate it in advance. Don't go shopping for one on the day of an incident.
This disclosure comes from Hugging Face itself. The company scoped the impact, and that assessment is not finished. Material sourced from outside the disclosure is flagged at the end of this piece.
The disclosure

What makes this intrusion different

On July 16, Hugging Face published a security incident disclosure: earlier that week it detected and contained a breach of part of its production infrastructure — the internal systems that actually serve users.

What sets this one apart from every previous incident is who did the breaking in. The whole chain was driven start to finish by an AI agent system capable of advancing on its own. And Hugging Face, in turn, relied on AI to dig it out and take it apart.

Over a single weekend, the attacker went from code execution to lateral movement across multiple internal clusters, leaving more than 17,000 logged actions. Those tens of thousands of actions ran across a swarm of short-lived machines, and the command channel relocated itself. On the defense side, AI compressed a log reconstruction that would have taken days into a few hours.

The disclosure splits findings into two columns: what's been established, and what hasn't.

Confirmed
  • Unauthorized access to some internal datasets
  • Access to credentials used by several services
  • No evidence of tampering in public models, datasets, or Spaces
  • Container images and published packages verified clean
Still open
  • Whether partner and customer data was affected — assessment ongoing, and anyone impacted will be contacted directly
  • Which model powered the attacker's agent remains unknown
The way in

The attack arrived as a dataset

It started at a weak point specific to AI platforms: the data-processing pipeline. A malicious dataset exploited two code-execution paths in dataset handling to run its own code on the processing machine. Everything after that was textbook internal network intrusion.

Attack chain
1
Upload a poisoned dataset

The dataset itself is ordinary input the platform handles every day, submitted through the normal channel.

2
Run code on the machine processing it

Two code-execution paths in dataset handling let the attacker's own code execute on that machine.

3
Escalate to the whole machine

From the privileges of a single processing job up to control of the host.

4
Harvest cloud and cluster credentials

Cloud service and cluster credentials stored on the machine. These are the keys to everything else.

5
Move laterally into multiple internal clusters

With the keys in hand, the attacker hopped machine to machine and reached several internal clusters — a cluster being a batch of machines grouped together to run one kind of workload.

Steps 3 through 5 all happened over one weekend

The two entry points work on different principles, and they're clearer side by side.

Entry A · Remote code loader

Loading a dataset also executes the Python script its author shipped with it.

The author writes the script, the platform performs the load — and someone else's code ends up running on your machine.

Entry B · Template injection in config

A field in the dataset config file meant to hold data holds something else instead. The classic template-injection move is to get that content executed as a command when the system reads the config.

Like filling out a form and writing something in the "name" box that the system then runs. The disclosure says only "template injection in config" and gives no further mechanism.

One contrast here is worth pausing on. In the datasets library Hugging Face ships to everyone, version 4.0.0 from July 2025 removed script-based datasets entirely and retired the trust_remote_code flag along with them; the official migration path is converting to plain data formats like Parquet. So ordinary users on a current version lost the "loading a dataset also runs a script" path a year ago — yet in the platform's own backend processing pipeline, this class of code-execution path was still available to be used. Both paths used for initial access have since been closed.

To be precise about what the disclosure does not say: it doesn't state whether the backend pipeline runs that same datasets library, or whether the exploited path is the one 4.0.0 sealed. The comparison above places two publicly known facts next to each other; it isn't a conclusion the disclosure draws.

The attacker

What broke in was an autonomous agent framework

Here's the shape of it. A program that advances step by step on its own, apparently built by modifying an off-the-shelf automated penetration testing tool — the kind meant for red teams and vulnerability research. Its tens of thousands of actions didn't run on one machine; they were spread across a swarm of short-lived machines, each destroyed after a handful of steps. The channel back to whoever was operating it hid inside public services and moved itself around. Which model it used is still unknown.

About that "off-the-shelf tool" layer — the industry calls it a harness, the scaffolding wrapped around a model: it feeds the model material, controls what the model can see, parses what comes back, and drives the loop forward. The model is the engine; the harness is the chassis and steering. Put the same engine in different chassis and the results diverge sharply.

Tens of thousands of actions, spread across throwaway machines Each lives briefly, then destroys itself after its few steps The channel hides in public services — and relocates Public service 1 Public service 2 Public service 3 The next hop can be any other public service, any time

Top: tens of thousands of actions executed across a fleet of short-lived machines. Bottom: the command channel hides inside normal traffic on public services and migrates to the next one. Drawn from the descriptions in the Hugging Face disclosure.

Both design choices serve the same goal: denying you a single clean cut. Throwaway machines are disposable by design, so blocking one buys nothing. A channel blended into normal traffic that also relocates makes blocklisting fixed addresses useless.

There's a second-order effect on forensics. When machines self-destruct, disk images and memory snapshots go with them, and what's left to reconstruct from is mostly the action log. That makes those 17,000-plus events the most complete record of the entire attack. (That connection is this site's inference; the disclosure doesn't state it.)

What the last publicly documented AI-driven attack looked like

This is precisely the "attacker that advances on its own" the industry has been warning about. The previous case documented in detail was GTG-1002, disclosed by Anthropic's threat intelligence team and detected in mid-September 2025. The two differ in how much was automated. The table below draws on outside material.

DimensionGTG-1002 (Sept 2025)This incident (July 2026)
TargetsRoughly 30 entities across tech companies, financial institutions, chemical manufacturers, and government agenciesHugging Face alone, driven deep into multiple internal clusters
AutomationAI handled 80–90% of tactical actions; humans signed off at checkpoints like moving from recon to attack and approving data exfiltrationDescribed in the disclosure as end-to-end, driven by an automated agent system
Model usedA jailbroken Claude CodeStill unknown
The defense

How Hugging Face pieced the intrusion together

AI did two jobs on the defense side: one for detection, one for reconstruction.

On detection, the team runs an AI on watch duty that reads the operational records the systems emit and pulls real signals out of everyday noise. It was several signals correlating that finally surfaced this intrusion.

An analysis agent built a timeline out of 17,000-plus events

To work out what tens of thousands of automated actions actually did, Hugging Face pointed an analysis agent at the full attacker action log — more than 17,000 events. One pass produced four things at once.

17,000+ events
Analysis agent
Timeline
Indicators of compromise
Credentials touched
Decoy actions filtered out

That last item is where the workload really sat. The attacker mixed in decoy actions, and separating real impact from deliberate noise is the single most labor-intensive part of the job for humans. Planting decoys also costs the two sides very differently: every fake action a human attacker adds costs that human time, while an agent running on its own can add however many at a marginal cost near zero. (The cost argument is this site's inference; the disclosure notes only that decoy actions existed.)

With AI doing the pass, work that would have taken days finished in hours — fast enough to keep pace with the adversary.

Asymmetry

Why commercial models refused the forensic work

What actually stalled Hugging Face in this incident was the models it pays for. In the disclosure's own words, the constraint on which models could be used for the analysis was one the team "did not anticipate."

At the start of the log analysis, Hugging Face reached for the strongest models available through commercial APIs. It didn't work. This kind of analysis requires feeding the model large volumes of real attack commands, the exploit code used to get in, and artifacts left by the command channel. Safety guardrails block that material on sight — and they can't distinguish an incident response engineer from the attacker.

The core bind

Forensics and attack feed a model material that looks identical. The guardrail only sees what you submitted; it can't see why you submitted it.

So at the very start of the log analysis, exactly when tens of thousands of events most needed to be sorted out fast, the defenders were locked out by the tools they pay for. Whether the agent on the other side ran a jailbroken hosted model or an unrestricted open-weight one is still unknown; the only certainty is that it was bound by no usage policy at all. The side playing by the rules got stopped by the rules. The side ignoring them sailed through.

Commercial model guardrails Attacker Automated agent framework Model unknown: jailbroken hosted, or open weights Bound by no usage policy Clear Defender Blocked Forensic analysis request Attack commands, exploit code Command channel artifacts The guardrail can't tell incident response from the attacker

The same wall stopped only one side. The attacker was bound by no usage policy; the defender's forensic request was left at the door. Drawn from the descriptions in the Hugging Face disclosure.

Moving the model onto their own infrastructure routed around the wall

Hugging Face ultimately shifted the forensic analysis to GLM 5.2, running inside its own infrastructure. It's an open-weight model from Zhipu AI (Z.ai), released under the MIT license, which means you can download it and deploy it yourself — nobody is in a position to approve or deny what material you submit. The training data and full pipeline aren't public, so it's open weights, not open source.

Running on your own hardware buys a second thing beyond dodging the guardrail, and Hugging Face called it out separately: the attacker data and the credentials referenced in it never left the company's network. During incident forensics, shipping credential-bearing logs to an external API is itself a fresh exposure.

This isn't an argument against safety measures on hosted models, and we're sharing this feedback with the providers involved. Hugging Face security incident disclosure

Does switching to open weights mean settling for weaker security analysis

There's an independent benchmark worth consulting. Semgrep tested a range of configurations against the same IDOR access-control vulnerability dataset with the same prompt. GLM 5.2, given nothing but a prompt and no purpose-built scaffolding, scored 39% F1 — that's precision and recall combined into one number: how much of what it found was real, and how much of what's real it found, out of 100%, higher is better. It beat Claude Code running inside its own agent scaffolding.

GPT 5.5 + Semgrep custom harness
61%
Opus 4.8 + Semgrep custom harness
53%
GLM 5.2, prompt only
39%
Claude Code + its own Agent SDK
32%
GPT 5.5 + Codex
20%

F1 scores on IDOR access-control vulnerability detection, from Semgrep's July 2026 benchmark — not data from this incident. The same GPT 5.5 scores 61% inside Semgrep's custom harness and 20% through Codex, which is exactly the point about the chassis mattering more than the engine. Semgrep cautions that this is a single task, a single dataset, and a single run; a follow-up review concluded the models are genuinely reasoning rather than pattern-matching, but recall runs low across the board.

Which leaves defenders with one piece of advice: before an incident happens, choose and validate a model you can run on your own infrastructure. It keeps guardrails from blocking you, and it keeps attacker data and credentials from leaking out.

Response and actions

What Hugging Face fixed, and what users should do

Five things were done afterward.

  • Patched the root-cause flaws: both dataset code-execution paths used for initial access are now closed.
  • Evicted the attacker's footholds in affected clusters and rebuilt the compromised machines.
  • Revoked and rotated affected credentials and tokens, plus launched a broader precautionary key rotation.
  • Added extra protections and stricter admission controls on the clusters.
  • Improved detection and alerting so high-severity signals wake someone on call within minutes — weekends included.

The company also brought in an external cybersecurity forensics team to investigate and review its security policies and processes, and has reported the incident to law enforcement.

Here's the action list for users and defenders. The first three are for regular users, the last two for enterprise security teams.

✅ Post-incident action list from Hugging Face

A few conclusions to close on. AI attack tools that advance on their own are no longer hypothetical. Mounting a broad, sustained, multi-stage campaign used to be expensive; that cost has now dropped, and the whole thing runs at machine speed. For any online platform, user-uploaded datasets and model files — long treated primarily as content awaiting processing — now have to be defended against as potentially poisoned input. And on the defensive side, humans reading logs can no longer keep pace with machines, which means putting AI to work there too.

Source
Security incident disclosure — July 2026Hugging Face official blog·Original·2026-07-16
Editorial note
All illustrations were drawn by this site from the text of the disclosure; the original carried no graphics. The following did not come from the disclosure and was sourced separately: the timing and version in which datasets 4.0.0 removed script loading, the GTG-1002 comparison table, GLM 5.2's publisher and license, the Semgrep benchmark bar chart, and the definition of a harness (drawn from that Semgrep piece). Semgrep's article text credits Claude Code with 32%, while a table in the same piece splits it by underlying model — 37% for Opus 4.6 and 28% for Opus 4.8/4.7; this site uses the article-text figure. Two points are this site's own inference and are flagged as such in the text: the difference in what decoy actions cost humans versus machines, and the fact that self-destructing machines leave the action log as the primary forensic material. Separately, the comparison drawn in the text between "the public library sealed script loading long ago" and "the backend pipeline was still exploited this time" places two publicly known facts side by side. The disclosure does not say the backend runs the same library, nor that it was the same path.