The Agent That Robbed Itself: an AI-Driven Hugging Face Malware Campaign Leaks Its Own Operator

David Cohen, JFrog Security Researcher | 24 Nov, 2026

On the morning of November 24, a brand-new Hugging Face account published a model called llama-3.2-1b-tuned. The model card promised a fine-tuned 1B instruct model. The files told a different story: every .bin was about 2.5 KB, while a real 1B model weighs more than two gigabytes.

What we found inside was a credential stealer with three different ways to run, which sends its loot out through Hugging Face itself. But the most interesting part was not the malware. It was the first set of stolen secrets, which turned out to belong to the attacker: an autonomous AI agent called ARTEX that built the model, tested it on itself, and published its own keys in the process. Over the next five hours the same agent kept adapting its packaging to slip past detection, while the payload underneath stayed the same. Following our report, Hugging Face has disabled every repo in the campaign.

This post follows the investigation one question at a time.


The account behind the model, hfusr5488184 (display name "Li Wei"), was created at 02:43:52 UTC, 22 minutes before the repo. It belongs to a one-member organization called probeorg9x7y2 ("Probe Org"), and its model card is a single line:

# llama-3.2-1b-tuned
Fine-tuned 1B instruct model (merge of sft + dpo).

The repository's file listing on Hugging Face, after the account rename

The repo as Hugging Face showed it before it was disabled: under akashdutta1030, with commits still signed "Li Wei" and both loot files in plain sight. Hugging Face's scanner flags only the two pickle files as unsafe. The Python modules and the chat template show no warning at all.

Without real weights, the files are clearly not there to run inference. They are there to run code. The first hint is in config.json, where auto_map sends AutoConfig, AutoModel and AutoModelForCausalLM to attacker-supplied Python files:

config.json auto_map

Anyone who calls from_pretrained(..., trust_remote_code=True) on this repo imports configuration_evil.py before a single tensor is read. And that is only the first of three doors into the same room. The same payload also sits inside both .bin files as a malicious pickle, and the chat template tries a third way in through Jinja.

So what does the payload actually do once one of those doors opens?

The moment the module is imported, it collects everything a cloud or ML workload tends to keep within reach. It reads the environment of the container's first process (/proc/1/environ, often richer than the current process's own), its own environment, and the Kubernetes service-account token and namespace if they exist. It then runs a short round of reconnaissance: who it is running as, which processes are alive, what is mounted, how traffic is routed, and whether the host has GPUs.

Under the hood: the collector

loot() collector

loot() reads eight files and runs seven commands, including nvidia-smi -L to fingerprint GPU hosts. The result is one JSON object, about 16 KB on a typical container.

The pickle door delivers the exact same code. pytorch_model.bin is a malicious pickle whose only job is GLOBAL __builtin__ exec followed by REDUCE over the payload source. The chat template takes a different approach: it tries four classic Jinja sandbox escapes to run id, env and cat /proc/1/environ and render the output straight into the prompt.

Under the hood: the pickle and template doors

The final pytorch_model.bin uses PyTorch's pre-1.6 legacy serialization: several pickles back to back (the magic number 0x1950a86a20f9469cfc6c, protocol version 1001, a sys_info dict) and then the malicious one. A ZIP-format copy sits next to it as pytorch_model_zip.bin.

legacy torch pickle disassembly

Both formats are blocked by torch.load(weights_only=True), the default since PyTorch 2.6. They still work against older stacks, code that passes weights_only=False, and anything that calls pickle.load directly. pytorch_model_zip.bin is not a name transformers loads by itself, which hints at a target that loads every .bin in a repo.

chat template SSTI

transformers renders chat templates in ImmutableSandboxedEnvironment, which blocks these escapes. Inference servers that render templates with plain Jinja do not.

Collecting secrets is the easy part, though. Getting them out of a locked-down ML environment is harder. So where does the loot go?

Back to Hugging Face. The payload base64-encodes the collected JSON and commits it, as a new file called loot-<hostname>-<pid>.json, into the attacker's own model repo through the Hub's commit API. The write token it uses is hidden in the payload as a base64 literal.

From the attacker's side, this is elegant. There is no command-and-control server to discover or block, because the only destination is huggingface.co, which ML workloads are allowed to reach almost by definition. Storage is free and versioned: every victim becomes a commit. And the channel survives the egress allowlists that were written precisely to let model downloads through.

It is also the operation's biggest weakness. The token can write to the repo, the repo is public, and so the loot is public too.

Under the hood: the exfiltration

exfil() via HF commit API

The request is an NDJSON commit (POST /api/models/<repo>/commit/main, Content-Type: application/x-ndjson) with the summary loot loot-<hostname>-<pid>.json. The payload also keeps a local copy in /tmp/.loot-<pid>-<hostname>.json and drops an execution marker in /tmp/.exec-<hostname>.

That weakness is what let us read the first two loot files. And they raised a question we did not expect.

Fourteen seconds after the model files were uploaded, the payload fired for the first time. A file nobody had uploaded by hand appeared in the repo: loot-28ed718137b2-229339.json, 16 KB of environment variables, process listings and network configuration. Our first instinct was to look for the victim. But who loads a model fourteen seconds after it is published?

The commit history tells the story minute by minute:

UTC (2026-11-24) Commit Event
02:43:52 — HF account hfusr5488184 created
03:05:35 bc6091b repo created (.gitattributes only)
03:07:06 1fb0158 add model files v2: remote code, ZIP pickle, SSTI template
03:07:20 d2cafb0 loot-28ed718137b2-229339.json (16,333 B) committed by the payload, 14 s after upload
03:07:23 129b42d same file overwritten with {"test":"collector-path","who":"ihfprep2"}
03:07:58 b915be1 loot-28ed718137b2-230002.json (16,334 B), second execution, same host
03:08:17 de31500 legacy torch format payload
03:08:31 4dac940 add NOEXFIL self-test marker
03:36–03:41 — toktest1–toktest9 and lootrepo created
08:19:12 — account now akashdutta1030; mistral-7b-utterance and loot created
08:19:58 7678412 mistral: v4 payload RCE43861
08:46:05 16ca113 coldload probe broken config: config.json deliberately made invalid

Look at 03:07:23. Three seconds after the first loot arrived, the same file was overwritten with a one-line test: {"test":"collector-path","who":"ihfprep2"}. The payload had run from a folder called /app/data/tasks/61/ihfprep2. The "victim" was signing its own name.

A minute later, the commit "add NOEXFIL self-test marker" added a kill switch that keeps the payload quiet when NOEXFIL=1 is set. Nobody adds a self-test switch for a victim. The host 28ed718137b2 was the machine that built the model, and the loot was its own.

So who, or what, was running on that machine?

The answer sits in the environment variables. Next to the usual PATH and HOSTNAME, the container carries a set that no ordinary developer machine has:

Variable Value (secrets redacted) What it tells us
ARTEX_LLM_PROVIDER openai the runtime drives an LLM
ARTEX_LLM_MODEL gpt-5.4 which model does the "thinking"
ARTEX_LLM_BASE_URL https://vip.aipro.love/v1 it goes through a third-party API reseller, not the vendor
ARTEX_PG_DSN postgres://artex:<REDACTED>@postgres:5432/artex the agent keeps its state (tasks, memory, results) in Postgres
OPENAI_API_KEY sk-<REDACTED> the key paying for those LLM calls

leaked environment, redacted

These variables live in the environment of process 1, so they belong to the container itself. Process 1 is /app/start.sh, which starts a binary called ./artex, listening on :8787 with a proxy on :8788. Everything else in the container runs underneath it. This is the runtime of an LLM-driven agent called ARTEX, and the malicious model was one of its work items: item ihfprep2 of task 61.

The rest of the loot fits that picture. The shell commands in the process list are single bash -c "cd /app/data/tasks/NN/iXXXXX && cat > file <<'EOF' … EOF && …" one-liners that write a file, run it and read the output, which is exactly how an agent's shell tool works. The fixes arrived at machine speed: two commits within seventy seconds of the first loot. And the commit messages read like a work log rather than a developer's history: "legacy torch format payload", "add NOEXFIL self-test marker", "coldload probe broken config", and a ticket-style payload marker, RCE43861.

We assess with high confidence that the malicious models were created, uploaded and tested from within an ARTEX agent task, with gpt-5.4 as the agent's model. What the data cannot show is how much of the work the LLM chose on its own and how much a human operator asked for. ARTEX is the tool that produced these models; the person directing it remains unidentified. The container's DNS search domain points to cldbase.us-west-1.rumble.cloud, and its clock is set to Asia/Shanghai.

In short, the agent built the malware, ran it on itself to check that the chain worked, and published its own OpenAI key, database credentials and task list to a public repository. Which raises the obvious next question: what else was that agent working on?

The leaked process list is a snapshot of an autonomous agent running several operations at once. Each task is a working directory under /app/data/tasks/<task>/<item>, and model poisoning was only one of them.

leaked process list, abridged and redacted

Task What the processes show
57 phish_server.py behind a cloudflared quick tunnel, with a monitor.sh that "watch[es] creds.log/access.log for click evidence" for 45 minutes
59 probe loops and a monitor.py baselining HTTP responses of *.clawi.ai hosts against a "prod origin" IP, plus tests of new residential-proxy sessions
61 ivisionssrf/anchor_server.py, an SSRF callback anchor, and ihfprep2, the Hugging Face model preparation behind this post
shared callback receivers on :8899 and :8898 (TLS), a local LLM relay behind another tunnel, several headless Xvfb displays
egress more than ten relay.py instances, each pinned to a residential-proxy session in a different country (US, CA, DE, GB, NL)

It runs as root in a Docker container, with no Kubernetes service account and no GPU. It is a general-purpose offensive automation box, and one of its tasks was to turn a Hugging Face model into an initial-access vector. We cannot rule out a red-team or bug-bounty engagement: SSRF anchors and "probe" naming would fit. But a credential-capturing phishing server, rotating residential proxies and a disposable Hugging Face identity are not what authorized engagements usually look like.

An agent that runs this many operations does not stop after one model. So what did it do next?

It started probing. Thirty minutes after the first model, the same account published nine small repos, toktest1 to toktest9, and a new empty repo called lootrepo. This time the target was not the model loader but the tokenizer loader:

Repo Content What it probes
toktest1 tokenizer.json = {bad json not valid !! parser error handling
toktest2 minimal BPE with no vocab schema validation
toktest3 evil_tok.py + auto_map + "trust_remote_code": true + broken tokenizer.json remote code with a forced fallback
toktest4–6 malformed or odd BPE/WordLevel, [1,2,3] error messages and behavior
toktest7 tokenizer.json padded to exactly 1 MiB size limits
toktest8–9 evil_tok.py with and without the trust_remote_code flag does the target honor the flag from config?

Broken JSON, wrong types, size limits, a flag present or absent: this reads like an agent mapping how one specific service that ingests user-supplied Hugging Face repos behaves, such as a model-hosting, fine-tuning, evaluation or scanning platform. It does not look like a spray-and-pray lure aimed at individual developers.

Under the hood: evil_tok.py

toktest tokenizer_config

evil_tok.py

A slimmer copy of the collector that tags its loot (import_time) and commits it to the separate lootrepo, so victim data no longer lands in the decoy model. lootrepo was still empty when the repos were disabled.

Then the account went quiet for almost five hours. When it came back, it had a new name, and a model built to be invisible.

At 08:19 UTC the account, now renamed akashdutta1030 (display name "Akash Dutta", same account ID 6b04f9e8746b081f2c411875), published mistral-7b-utterance and a new drop repo called loot. The new model contains no weights at all:

File Size Role
config.json 0.6 KB (7678412), 73 B at HEAD a faithful Mistral-7B config plus auto_map → attacker modules
configuration_evil.py 3.3 KB payload (marker RCE43861) + EvilConfig
modeling_evil.py 3.5 KB the same payload (marker RCE43861-modeling) + EvilModel shim
tokenizer.json 1.8 MB byte-identical to hf-internal-testing/llama-tokenizer, Hugging Face's own test fixture
special_tokens_map.json 411 B from the same fixture
tokenizer_config.json 952 B Llama tokenizer settings + an SSTI chat_template

It doesn't need any. The payload fires while the config and the code are resolved, and that happens before weights are ever read. A metadata indexer, a model-card generator, a "cold-load" validation worker or an evaluation harness that only calls AutoConfig.from_pretrained(..., trust_remote_code=True) is enough. That service gets back a perfectly valid MistralConfig and sees nothing wrong. Each module even carries its own marker, so the operator can tell from the loot whether a victim only read the config or tried to load the full model.

v4 execution flow

The collector has also been sharpened. Besides the usual secrets, it now looks for a particular environment: /scratch/models, /workspace, the Hugging Face cache, the Kubernetes CA certificate, and environment variables for NATS, Postgres and Redis. That is the profile of a model-serving fleet that pulls Hugging Face repos into a scratch volume and coordinates over NATS. The earlier probing seems to have told the agent what it was aiming at.

Under the hood: the v4 payload

v4 header

Only standard-library imports, so it passes transformers' import pre-flight on any host. The embedded write token is the same one as in the first model, which ties the two account names together.

v4 targeted collector

Commands now run through subprocess.run(timeout=20) instead of os.popen, so a hanging command can't stall the load and give the payload away. Output is capped, and nothing is written to /tmp anymore.

v4 exfil

The loot goes to loot/<host>-<md5>.json in the separate loot repo, as a JSON commit with the summary RCE43861 <hostname> and an unusual User-Agent: rce.

v4 modeling shim

EvilModel is only a shim. Under transformers' auto-class flow it should fail with a TypeError, but only after both payload copies have already reported back.

The last commit, "coldload probe broken config", deliberately makes config.json invalid:

v4 broken config

With stock transformers, that actually disarms the latest revision: the JSON parse fails before auto_map is read. We read it as the agent testing how one target's cold-load path reacts to a broken config. Does it print a revealing stack trace? Does it fall back to importing the repo's Python some other way? Until the repo was disabled, anyone told to load revision 7678412 still got the armed version.

Put next to the first model, this second one looks less like a new attack and more like the same attack in a new wrapper. How much did the agent change, and what did it keep?

Over five hours, almost everything about the packaging changed. Hugging Face's scanner marks the first model's two pickle files as unsafe. Whether the agent saw those badges or simply anticipated them, the second model ships with no pickles at all. Its config advertises remote code, so the latest commit breaks the config, and with it the custom_code tag that lists the repo among remote-code models. Empty weights look suspicious, so the new repo borrows a real Mistral config and Hugging Face's own test tokenizer. The account that published the first model now has a different name.

What could give it away How the agent adapted What stayed the same
its own test runs leaking its environment a NOEXFIL kill switch in v3, then removed in v4 collection and exfiltration code
scanners that only parse ZIP-format checkpoints moved the pickle to the legacy torch format, kept a ZIP copy exec of the same payload
Hugging Face's "unsafe" badges on pickle files v4 ships no weight files at all; the code lives only in .py auto_map → payload at import time
a 2.5 KB "1B model" looking fake a real Mistral-7B config and a byte-identical HF test tokenizer —
the custom_code tag and auto_map in config.json a deliberately broken config.json at HEAD the modules are still served; revision 7678412 is still armed
loot visible in the decoy model separate lootrepo, then loot repos the same Hub commit API as the exfiltration channel
local traces and hanging commands no /tmp files, 20-second command timeouts a broader version of the same collector
an account tied to the first model renamed hfusr5488184 → akashdutta1030 the same account ID and the same write token

NOEXFIL guard added in v3

Every change was about the wrapper. The core never moved: collect the host's secrets at import time and commit them to a Hub repo with the same token. That is what makes this campaign a useful lesson. An agent can iterate on packaging, metadata and identity far faster than detection rules change. Detection that keys on what the file looks like will keep losing to an attacker that can try a new look every few minutes. Detection that keys on what the code does (reading /proc/1/environ, writing to the Hub's commit API) keeps working.

Under the hood: fossils of earlier versions

v2 trigger

EvilModel stub

The v2 payload simply called boom() at import. In v3 that function is gone, but EvilModel.__init__ still calls it inside a try/except, where it now fails silently.

llama-3.2-1b-tuned (v1–v3) mistral-7b-utterance (v4)
Uploaded 03:05–03:08 UTC 08:19–08:46 UTC
Ways to run code remote code, 2× pickle, SSTI template remote code, SSTI template
Weight files 2 fake pickles none
Hugging Face warning 2 files "unsafe" none
Hub tags PyTorch, llama, custom_code region:us only
Loot destination the model repo itself separate akashdutta1030/loot
Collector generic container and K8s recon targeted: NATS, Postgres, Redis, /scratch/models, HF cache
Marker commit summary loot … RCE43861[-modeling], User-Agent: rce

Not far, as far as we can tell. We searched our index of public Hugging Face repos and their file history for other loot-<hex>-<n>.json files and found none outside this repo. None of the payload files, in any version, appears by content hash outside this account. The account's other repos are the ones described above, all created between 03:05 and 08:19 UTC. Both loot drops were still empty when Hugging Face disabled them, which means no real victim had reported back.

This is a single, very new campaign, caught while it was still being developed. The question is how to catch the next version, which may look different again.

Look at behavior, not packaging. Both pickle carriers decompile to GLOBAL __builtin__ exec → REDUCE, which any opcode-level scanner catches, as long as it walks every concatenated pickle in the legacy torch format and not only the first. The Python modules are plain, unobfuscated code, and their strongest signals are writes to huggingface.co/api/models/*/commit/main, reads of /proc/1/environ and the service-account token, and a base64 literal starting with aGZf (hf_). In chat templates, __globals__, __mro__, __subclasses__ and .popen( have no legitimate use.

The second model adds a structural signal: a repo with auto_map modules and no weight files is a red flag on its own, and so is a config.json that fails to parse next to Python files. Our own model-scanning pipeline flagged both pickle files as malicious on ingestion, but the remote-code and template vectors in this campaign are a reminder that pickle scanning alone is not enough.

On the consuming side, the basics still hold. Don't use trust_remote_code=True on repos you have not reviewed, and pin a revision= commit SHA: this repo changed its payload three times in under ninety seconds. Use torch >= 2.6 with the default weights_only=True, prefer safetensors, and render chat templates only in a sandboxed Jinja environment. Egress rules that allow huggingface.co should allow downloads, not uploads: a model-loading workload that commits to the Hub should raise an alert. Platforms that load user-supplied repos should do it in a sandbox with no credentials in the environment, no service-account token and no outbound network.

YARA rules for both the exfiltration payload and the template injection are in hf_commit_exfil.yar.

On 2026-11-24 we reported the campaign to Hugging Face by email at security@huggingface.co, and through the Report option on the malicious repos. The report covered the account (akashdutta1030, formerly hfusr5488184, ID 6b04f9e8746b081f2c411875) and its linked organization probeorg9x7y2, and all 13 repos. We asked Hugging Face to revoke the write token embedded in every payload, which cuts off the exfiltration channel, and to purge the two loot files that expose live third-party credentials, including their commit history. We also suggested flagging weightless auto_map repos, since the second model gets past pickle scanning by design.

Hugging Face acted the same day. All 13 repos were disabled with the notice "This content infringes our Content Policy", and none of their files can be downloaded anymore. Both loot drops were still empty at that point, so no victim data had come back. We thank the Hugging Face security team for their quick response.

Date (UTC) Event
Nov 24, 02:43 Hugging Face account hfusr5488184 created
Nov 24, 03:07 First malicious model, llama-3.2-1b-tuned, published; the payload runs on the operator's own agent 14 seconds later
Nov 24, 03:36 Tokenizer probes toktest1–toktest9 and the lootrepo drop published
Nov 24, 08:19 Account renamed to akashdutta1030; scanner-evading mistral-7b-utterance and the loot drop published
Nov 24 JFrog Security Research reports the account and all 13 repos to Hugging Face
Nov 24, 13:29 All 13 repos confirmed disabled by Hugging Face; no files can be downloaded

What makes this campaign worth a closer look isn't the payload. Stealing environment variables from a model loader is not new. What's new is who was writing it, and how fast.

In under ninety seconds, ARTEX shipped three versions of a malicious model. Within half an hour it had fuzzed the tokenizer loader nine different ways. Five hours later it came back under a new account name, with a variant designed around the exact checks that could flag its first attempt: no weights, plain Python, a borrowed tokenizer and a config broken on purpose, carrying the same payload as before. At the same time, the same agent was running a phishing server, an SSRF probe and a rotating residential-proxy pool. No human operator iterates like that across that many fronts at once.

ARTEX is unlikely to be the only one. Autonomous attack and pentesting agents are now cheap to build and cheap to run: an LLM API key, a container and a task queue are enough. And they go where defenses are thinnest. New ecosystems such as model hubs, MCP servers and agent skills are full of formats where a "model" can be three text files and a Python module, and where most scanners were built for yesterday's threats.

So how do you defend against an attacker that iterates faster than a takedown request? Not by reacting after the fact. By the time a malicious model is reported and removed, an agent has already published the next variant under a new name. The control has to sit in front of your developers and your production systems: a proxy between your teams and public registries that decides before download whether a model or package is allowed in. That decision has to be backed by research that keeps pace with the attackers.

That is the role of JFrog Artifactory Curation. It sits between developers and public sources such as Hugging Face, PyPI and npm, and blocks malicious and risky models and packages before they ever reach a build, a notebook or an inference server. Its decisions are driven by the JFrog Security Research team, the same team behind this post. When the next agent-built model shows up with no weights and a broken config, the question shouldn't be whether a scanner noticed it. It should be whether it was ever allowed in.

The account was renamed during the campaign, so each model appears under both names.

Model Ecosystem XRAY ID
hfusr5488184/llama-3.2-1b-tuned Hugging Face XRAY-1176308
akashdutta1030/llama-3.2-1b-tuned Hugging Face XRAY-1176345
akashdutta1030/mistral-7b-utterance Hugging Face XRAY-1176347
hfusr5488184/toktest3 Hugging Face XRAY-1176365
akashdutta1030/toktest3 Hugging Face XRAY-1176356
hfusr5488184/toktest8 Hugging Face XRAY-1176350
akashdutta1030/toktest8 Hugging Face XRAY-1176344
hfusr5488184/toktest9 Hugging Face XRAY-1176361
akashdutta1030/toktest9 Hugging Face XRAY-1176357

The full list is in iocs.csv. Key items:

Type Value
HF account (ID 6b04f9e8746b081f2c411875) hfusr5488184, renamed to akashdutta1030; org probeorg9x7y2
Repos llama-3.2-1b-tuned, lootrepo, toktest1…toktest9, mistral-7b-utterance, loot
v4 configuration_evil.py sha256 ceb5816fac7cbd886b096c7f0c0402913488ca0f967b617d3a7e25508032e6a8
v4 modeling_evil.py sha256 b068b5a2ec3a6a13deef686173935330fb2f7fd2b3fb1f34aa2b6e359624de19
configuration_evil.py (v3) sha256 ed89685e8c16d0cb6dc218d0972e7a0a9e292f9b98f6b0ef0b2ab340d06d34e3
modeling_evil.py (v3) sha256 79b47fe688932507fa013de36c057846916f586b3893f2fae3fc364cbd5d7c9e
pytorch_model.bin (v3) sha256 2bf25c4c3aa1e2efdff4ae9ee7e1434e279115608eb7a176e4e50e874c07c50d
pytorch_model_zip.bin (v3) sha256 783f54898ba4b828e14a2e5ab3c50968bca0883b0fc0309c24876c9c7f99e841
evil_tok.py sha256 b43e7d812ab6541bfce4f85b2a19ba051f1b560b581aa203754e088fe2367961
Exfil endpoints POST https://huggingface.co/api/models/{hfusr5488184,akashdutta1030}/{llama-3.2-1b-tuned,lootrepo,loot}/commit/main
Payload markers RCE43861, RCE43861-modeling, User-Agent: rce
Host markers /tmp/.exec-<host>, /tmp/.loot-<pid>-<host>.json, /tmp/EXECUTED_NOEXFIL
Operator infra container 28ed718137b2; vip.aipro.love; cldbase.us-west-1.rumble.cloud; *.trycloudflare.com quick tunnels