Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 9 min read

The Allowlist Said Hugging Face Was Fine: How CVE-2026-54316 Turned Pre-Approved Downloads Into a Leak Channel

TL;DR CVE-2026-54316 (GHSA-fg94-h982-f3mm): in Claude Code, the bare hostname huggingface.co was pre-approved for the WebFetch tool. Any path on that domain, including attacker-controlled repositories, ran with no per

TL;DR

  • CVE-2026-54316 (GHSA-fg94-h982-f3mm): in Claude Code, the bare hostname huggingface.co was pre-approved for the WebFetch tool. Any path on that domain, including attacker-controlled repositories, ran with no permission prompt and outside --allowedTools checks.
  • Hugging Face counts file fetches as downloads, so an attacker who could get untrusted text into the context window could use download requests as a covert channel for data the agent could read: files, environment variables, command output.
  • Affected: versions 0.2.54 through 2.1.162. Fixed in 2.1.163. CVSS v4.0 score 6.0 (Medium). The record was published June 23, 2026 and last modified October 28, 2026. The sources I read do not report exploitation in the wild.
  • I wrote a small Python model (illustrative, not a PoC). A bare-host rule auto-approved 20 of 20 leak requests and 50 of 50 legitimate doc fetches. A scoped rule auto-approved 0 of 20 leak requests and still 50 of 50 legitimate fetches.
  • The lesson for agent builders: an allowlist entry is a grant. If the host serves content anyone can publish, a host-level grant is a grant to every stranger on that host.

Leak requests approved with no prompt

What does CVE-2026-54316 actually say?

The record is short, which is part of why it is useful. Claude Code ships a WebFetch tool that retrieves a URL for the model. Fetching arbitrary URLs normally asks the user first. To reduce friction, a small set of hosts was pre-approved so that documentation lookups would not nag. One of those entries was the bare hostname huggingface.co.

A bare hostname matches every path. That is fine for a host where every path is controlled by the host operator, such as a docs site. It is not fine for a platform where any account can create a repository and put arbitrary files in it. On such a platform, huggingface.co/some-stranger/some-repo/resolve/main/file and huggingface.co/docs/... share a hostname and nothing else.

According to the OSV record, the result was that WebFetch requests to any path on that domain proceeded without a prompt and without consulting --allowedTools. The advisory also states the precondition plainly: exploitation required the ability to inject untrusted content into a Claude Code context window. That could be a README, an issue, a web page the agent was asked to summarize, or a tool result. The injected instructions only had to tell the model to fetch a URL.

The fix landed in 2.1.163 (fix commit d1e174252d0af47174bd9fbdec6abb092b49226a). The GitLab advisory database lists the same affected range and credits a HackerOne reporter. NVD, OSV, INCIBE and Red Hat all carry the record. Scores differ by scheme: CVSS v4.0 6.0 (Medium) in OSV and INCIBE, and a CVSS 3.1 draft of 5.3 in the Red Hat record.

Why does a download counter turn into an exfiltration channel?

Exfiltration needs two things: a way to encode data into something the attacker can observe, and a path that the defender does not inspect.

Observation is the easy half. When the agent requests a file from a repository the attacker owns, the attacker sees the request in the platform's download statistics or logs. The advisory describes the platform counting those fetches as downloads. If the attacker varies which file is requested, the choice of file is the message. A request for 41.bin versus 42.bin carries a byte. A request for a long file name carries more.

The uninspected path is the half this CVE supplies. Data leaving an agent normally has to pass through some approval point: a shell command that needs a yes, a network call that needs a yes, a file write that needs a yes. Here the approval point was removed for one very popular domain. The model could read the secret from its own context, build a URL that spelled it out, and fetch it. From the user's side, nothing appeared on screen except a successful fetch.

This is an out-of-band channel in the ordinary security sense. The data does not come back through the response. It leaves through the request. That distinction matters for defenders, because most prompt-injection defenses watch what comes into the model (untrusted text) and what the model says to the user, not what the model asks the network for.

Legitimate fetches stay frictionless

Is this a prompt-injection bug or an allowlist bug?

Both, and separating them is the useful exercise.

The prompt-injection half is not fixable by this patch and is not claimed to be. A model that reads untrusted text can be steered by it. The advisory's own precondition says exploitation needs that foothold.

The allowlist half is what the patch addresses. Even with a steerable model, the damage depends on what the tool will do without asking. Pre-approval converts "the model was persuaded" into "the action happened". Narrowing the grant converts it back into "the user was asked".

This is the same structure as other approval-gate failures: the gate exists, but one input class skips it. Earlier posts in this series covered tool-name approval caches and symlink checks. The common thread is that the gate's decision was made on a coarse key (a tool name, a path string, a hostname) while the harm depended on a finer one (the arguments, the target file, the repository owner).

How do I model the difference in Python?

The script below is an illustrative model, not an exploit. It compares two allowlist rules against 50 legitimate documentation URLs and 20 requests that spell out a fake 20-byte secret, one byte per request, as file names in a repository the attacker controls.

"""Illustrative model (not a PoC): bare-host allowlist vs scoped allowlist for a fetch tool."""
from urllib.parse import urlparse
import random
random.seed(7)
HOST_ONLY = {"huggingface.co": None}                       # approve every path
SCOPED = {"huggingface.co": ("/docs/", "/datasets/trusted-org/")}  # approve known prefixes only
def approved(url, rules):
    u = urlparse(url); pre = rules.get(u.hostname)
    if u.hostname not in rules: return False
    return True if pre is None else u.path.startswith(pre)
legit = [f"https://huggingface.co/docs/transformers/page{i}" for i in range(40)]
legit += [f"https://huggingface.co/datasets/trusted-org/set{i}/resolve/main/README.md" for i in range(10)]
# attacker encodes 1 secret byte per request into a file name in a repo they control
secret = b"AKIA-EXAMPLE-KEY-123"
leak = [f"https://huggingface.co/attacker/repo/resolve/main/{b:02x}.bin" for b in secret]
for name, rules in (("bare host", HOST_ONLY), ("scoped", SCOPED)):
    ok_legit = sum(approved(u, rules) for u in legit)
    ok_leak = sum(approved(u, rules) for u in leak)
    print(f"{name:10s} legit auto-approved {ok_legit}/{len(legit)}  leak requests auto-approved {ok_leak}/{len(leak)}")

Output from running it:

bare host  legit auto-approved 50/50  leak requests auto-approved 20/20
scoped     legit auto-approved 50/50  leak requests auto-approved 0/20

Two observations. First, the scoped rule costs nothing for the legitimate traffic in this model: all 50 documentation fetches still pass without a prompt. Narrowing the grant is not the same as adding friction everywhere. Second, the scoped rule does not need to know about the attacker. It does not blacklist attacker/repo. It simply never granted that path, so the default (ask the user) applies.

Requests to leak a secret

The third chart shows why rate or volume limits are a weak substitute. At one byte per request, a 16-byte key needs 16 requests and a 32-byte key needs 32. Those counts are small enough to hide in a normal session of web lookups. A defense that waits for "unusual volume" would see nothing unusual.

What should I change in my own agent tooling?

  1. Allowlist by host plus path prefix, and by owner where the platform has owners. On any host that serves user-published content (code hosts, model hubs, paste sites, object storage, package registries), a host-level entry is a grant to every publisher. Scope to the documentation prefix or the specific organization you trust.
  2. Treat approval as a function of the request, not the tool. The decision key should include the full URL, because the URL is where data can hide. The same lesson applies to shell commands, where the arguments carry the payload.
  3. Log every network request the agent makes, including pre-approved ones. A pre-approved call is still an action. If your agent stack has an audit log, make sure auto-approved fetches appear in it with the full URL.
  4. Strip secrets from the agent's reach. An exfiltration channel is only dangerous if there is something to carry. Keep long-lived credentials out of environment variables the agent can print.
  5. Update. If you manage Claude Code installs by hand, move to 2.1.163 or later. The advisory notes standard auto-update installs already received the fix.
  6. Audit your own defaults. Search any agent configuration you maintain for bare-host entries and ask of each one: can a stranger publish content at this hostname?

What is the generalizable gate principle?

A pre-approved action is a policy decision made in advance, for every future context, including contexts where the model has been manipulated. That is a strong claim to make about a whole domain.

A useful test: for each auto-approved entry, write down the worst request a hostile prompt could make that still matches it. For huggingface.co as a bare host, the answer is "a fetch of any file in any repository", and the attacker chooses which file. For a docs prefix, the answer is "a fetch of a documentation page", which carries no attacker-chosen bytes beyond what already exists on the page.

If the worst matching request is harmless, the grant is safe. If it is attacker-shaped, narrow it.

FAQ

Does CVE-2026-54316 let an attacker run code on my machine?
No. The record describes data exfiltration through fetch requests, not code execution. The affected data is whatever the agent could read in the session. Confidentiality impact is rated high in the CVSS vector, with no integrity or availability impact.

Do I need an attacker inside my repository to be affected?
The advisory says exploitation required the ability to add untrusted content into the context window. That is a lower bar than repository write access: any text the agent reads can qualify.

Which versions are affected and what is the fix?
Versions from 0.2.54 through 2.1.162 are listed as affected. Version 2.1.163 contains the fix.

Was it exploited in the wild?
The sources I reviewed (OSV, GitLab advisory database, INCIBE, and the Red Hat record) describe a reported and patched issue and do not state in-the-wild exploitation.

Is a scoped allowlist enough on its own?
No. It removes one uninspected channel. You still want secret hygiene, request logging, and defenses against injected instructions, because each covers a different step of the chain.

Why not just block all pre-approved domains?
You can, at the cost of prompting for documentation lookups. The model above suggests a middle path: keep frictionless access to prefixes you trust and ask for everything else.

Links

Further reading

  • The Parent Session Said No, So the Agent Opened a Child: How Session Inception Skipped a Trust Prompt (earlier post, same series)
  • One Yes, Every Shell Command: How a Tool-Name Approval Cache (CVE-2026-56074) Turns a Click Into a Standing Grant (earlier post, same series)
πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.