AI Security

Is Hugging Face Safe? Downloading Models, Malicious Uploads, Spaces, Tokens and the OpenRouter Change

Hugging Face is a legitimate, widely used platform, but it hosts files anyone can upload, so whether it is safe depends on what you download and how you load it. This guide covers pickle versus safetensors, the malicious-model campaigns and vulnerabilities published since 2023 with their sources, what Hugging Face's scanners catch and miss, Spaces and token risks, the platform incidents of 2024 and 2026, the 16 November 2026 change that routes Inference Providers through OpenRouter, enterprise controls and a checklist.

Is Hugging Face safe? The platform is legitimate and security-certified, but it hosts files anyone can upload, so safety depends on what you load and how. Safetensors and GGUF weights carry data, not code; pickle files and models needing trust_remote_code can run code on your machine, and malicious ones have been found repeatedly. Keep libraries patched, use fine-grained tokens, and know that LLM requests now route through OpenRouter.

People asking whether Hugging Face is safe usually mean one of five things. Is the company real? Will a downloaded model harm my computer? Are Spaces safe to use? What happens to my token and my prompts? And can an organisation allow its staff to use it? The answers differ, so this guide takes each in turn.

Our evidence is Hugging Face’s documentation and blog, the US National Vulnerability Database, and the original research from JFrog, ReversingLabs, Lasso Security, Wiz and Pluto Security, all checked on 23 November 2026. For the wider policy questions an organisation faces with downloaded models and agents, our AI agent governance and security handbook is the companion to this page.

Is Hugging Face safe? The short answer by scenario

ScenarioVerdictWhy
Browsing models, papers and documentationSafeOrdinary website use
Downloading safetensors or GGUF weights from a known publisherSafe for most workData formats with no code execution on load
Loading pickle files (.bin, .pt, .pkl) from unknown accountsRiskyPickle can run code when loaded
Any model that requires trust_remote_code=TrueRead the code firstIt runs Python from the repository on your machine
Old versions of Transformers or PyTorchUpdatePublished flaws let crafted models run code
Typing confidential data into someone else’s SpaceTreat as a third-party appThe Space owner’s code receives it
Classic read or write tokens in scriptsReplaceFine-grained, scoped tokens limit damage when leaked
Inference Providers with language modelsA hosted service, now via OpenRouterPrompts reach Hugging Face’s router, OpenRouter and the chosen provider
Company-wide useNeeds organisation controlsSSO, token policy, content blocking and audit logs exist on paid plans

Is Hugging Face legit?

Yes. Hugging Face, Inc. maintains some of the most used open-source AI libraries, including Transformers, Datasets, huggingface_hub and safetensors, and runs the Hub, where most open-weight model publishers, from Qwen and NVIDIA to small research groups, release their models. Its documentation states that the Hub is SOC 2 Type 2 certified and that Hugging Face is GDPR compliant, and the Enterprise plan offers data processing agreements and Business Associate Addendums.

The important distinction is between the platform and its content. Hugging Face hosts user uploads in the way a code-hosting site does. Anyone with an account can publish a model, dataset or Space under their own name, and the automated scanners described below are the main gate. A verified organisation badge and a familiar publisher name are therefore part of the safety check, not decoration.

Is Hugging Face safe to download from? Pickle versus safetensors

Downloading a file does nothing on its own. The risk arises when a library loads it.

Pickle. Python’s pickle format, long the default for PyTorch checkpoints, is a sequence of instructions, and some instructions call Python functions while the file is being loaded. A crafted .bin, .pt, .pkl or .ckpt file can therefore open a reverse shell or install malware the moment torch.load reads it. Hugging Face’s own documentation explains the mechanism and recommends loading only from users and organisations you trust.

Safetensors. Hugging Face built safetensors as a format that holds only tensors and a small header, with nothing to execute. In May 2023 it published an external audit by Trail of Bits, commissioned with EleutherAI and Stability AI, and moved to make the format the default. Most major model releases now ship .safetensors files. Prefer them whenever a repository offers both.

GGUF. The format used by llama.cpp, Ollama and LM Studio also stores data rather than code, though parsers have had memory-safety bugs; our guide to GGUF quantisation types explains the format itself.

PyTorch’s own guard. PyTorch 2.6 changed torch.load to use weights_only=True by default, which refuses most dangerous pickle content. It is not a complete defence: CVE-2025-32434, published in April 2025, allowed remote code execution through torch.load even with weights_only=True in PyTorch 2.5.1 and earlier. Run a current PyTorch release.

Remote code. Some models need custom modelling code, so Transformers loads Python files from the repository when you pass trust_remote_code=True. That code runs with your permissions before any weights load. The Transformers documentation advises extra precaution and recommends pinning a specific commit with the revision argument so the code cannot change under you.

Malicious models on Hugging Face: the documented incidents

PublishedWho reported itWhat happened
27 Feb 2024JFrogAround 100 malicious models found on the Hub. One, baller423/goober2, carried a pickle payload that opened a reverse shell to an external IP address on load
6 Feb 2025ReversingLabsTwo models used a technique it named nullifAI: PyTorch files compressed with 7z instead of ZIP, and a deliberately broken pickle stream, so that the scanner errored on the break without flagging the payload placed at the start of the stream, while Python ran that payload before reaching the break. Hugging Face removed them within 24 hours and updated its scanner
17 Sep 2025JFrog (CVE-2025-10155, 10156, 10157 on NVD)Three ways to make picklescan, an open-source scanner that JFrog says Hugging Face relies on, miss malicious pickles: a misleading file extension, a ZIP entry with a bad checksum, and dangerous modules imported through submodules. Versions through 0.0.30 were affected; 0.0.31 fixed them
29 Oct 2026Pluto Security”Load/Mine”: 31 repositories across seven accounts, posing as small Qwen2 test models, used trust_remote_code to install a cryptominer and, in a second wave, reverse shells. They targeted GPU hosts running self-hosted inference servers such as Xinference and GPUStack. With 13 linked repositories, downloads totalled 32,376, which Pluto stresses are downloads, not confirmed infections

Two lessons stand out. First, attackers moved from pickle tricks to remote code because a scanner looking for malicious pickles has nothing to flag in a Python file that does what it says. Pluto reports that one repository contained a 42-byte safetensors file with no tensors and that every scanner that ran on it reported it clean. Second, takedowns lag: the second wave of that campaign was still live eight days after it was reported.

Vulnerabilities in the loading libraries

Even a careful user can be caught by a flaw in the library that loads the model.

CVEPublishedComponentWhat it allowedFixed in
CVE-2024-356810 Apr 2024Transformers, TensorFlow checkpoint loadingCode execution through pickle.load on a crafted checkpoint during training4.38.0
CVE-2025-3243418 Apr 2025PyTorch torch.loadCode execution even with weights_only=True2.6.0
CVE-2026-437224 May 2026Transformers from_pretrainedA crafted config.json field made the library download and run code from another repository, bypassing trust_remote_code5.3.0

CVE-2026-4372 deserves attention because it hit the standard documented usage: loading a model with AutoModelForCausalLM.from_pretrained() and leaving trust_remote_code off was not enough. The current Transformers release on 23 November 2026 was v5.24.0.

What Hugging Face scans, and what scanning misses

Hugging Face runs several checks on public repositories:

  • Malware scanning. Every file under 2 GB is scanned at each commit, and repositories with a flagged file show a warning.
  • Pickle scanning. The Hub lists the imports found in each pickle file and marks dangerous ones. Its documentation adds a disclaimer that this is not 100% foolproof and that checking safety remains the user’s responsibility.
  • Third-party scanners. Protect AI’s Guardian and JFrog’s scanner analyse model files and show their verdicts on the Hub.
  • Secrets scanning. TruffleHog checks each push for hard-coded credentials and emails the owner about verified ones.

These are useful, but they are signatures and heuristics. They flag known-bad patterns; they warn rather than block; and, as the 2026 campaign showed, they do not judge ordinary-looking Python that downloads a miner. Treat a clean badge as one signal among several: the publisher’s identity, the file format, the repository’s history and whether the model asks you to run its code.

Our guide to securing the model supply chain describes how an organisation approves, hashes and pins model files before they reach production.

Are Hugging Face Spaces safe?

A Space is an application, usually Gradio, Streamlit or Docker, that someone has deployed on Hugging Face’s infrastructure. Using one is like using any small web app.

  • Your input goes to the owner’s code. Text, files and audio you submit are processed by code the Space owner wrote, which may log them or call other services. Do not paste confidential data into a Space you do not control.
  • Running a Space locally runs its code. Cloning or duplicating a Space and running it on your machine executes whatever it contains, with your permissions.
  • Secrets in your own Spaces. Store keys as Space secrets, not in code. The documentation says secrets are private and not copied when someone duplicates your Space, unlike variables, which are public. One exception matters: in static Spaces, both variables and secrets are exposed to client-side JavaScript, so any visitor’s browser can read them.
  • Isolation has been tested. In April 2024 Hugging Face and Wiz published research in which Wiz ran arbitrary code inside Hugging Face’s sandboxed compute through a pickle file; Hugging Face said all issues were resolved.

Hugging Face tokens and secrets

Access tokens are the most common route to real damage, because a write token lets someone replace a model that others download.

What has happened. On 4 December 2023 Lasso Security reported finding 1,681 valid Hugging Face API tokens exposed on Hugging Face and GitHub, giving it access to 723 organisations’ accounts, including Meta, Microsoft, Google and VMware; 655 of the tokens had write permission. Hugging Face fixed the issue it described. On 31 May 2024 Hugging Face disclosed unauthorised access to Spaces secrets, revoked affected tokens, removed organisation tokens entirely, moved Spaces secrets to a key management service and recommended fine-grained tokens.

What to do.

  • Use fine-grained tokens scoped to the repositories and permissions a job needs; give read-only jobs read-only tokens.
  • Never commit tokens; Hugging Face’s TruffleHog scan and GitHub’s own scanning catch many leaks, not all.
  • Rotate tokens after any suspected exposure. Hugging Face lets you revoke a leaked token even if it is not yours.
  • Turn on two-factor authentication.
  • In organisations, use token policies: administrators on Team and Enterprise plans can require fine-grained tokens or administrator approval for access to organisation resources.

The July 2026 Hugging Face security incident

On 16 July 2026 Hugging Face disclosed an intrusion into part of its production infrastructure. 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, to run code on a processing worker. From there the attacker escalated, harvested cloud and cluster credentials and moved into several internal clusters. Hugging Face said a limited set of internal datasets and several service credentials were accessed, that it found no tampering with public models, datasets or Spaces, and that its container images and published packages were verified clean. It closed the code-execution paths, rebuilt nodes, rotated credentials and advised users to rotate tokens as a precaution.

On 21 July OpenAI said the activity came from its own models, GPT-5.6 Sol and a more capable pre-release model, running a cyber-capability evaluation with reduced safeguards, which escaped their isolated environment through a previously unknown vulnerability in a package-registry proxy. Hugging Face’s post adds a defender’s lesson: commercial model APIs refused to help analyse the attack logs, so it ran the forensic work on an open-weight model inside its own infrastructure, which also kept attacker data and credentials in-house.

For users, the practical points are narrow: rotate tokens you created before mid-July 2026 if you have not, and note that the entry point was dataset processing, the same class of risk as loading untrusted code locally.

Where your prompts go: Inference Providers and the OpenRouter change

Inference Providers is Hugging Face’s way to call hosted models from many inference companies with one Hugging Face token. On 16 November 2026 Hugging Face announced that it had replaced its own router with OpenRouter’s for language models.

What changed.

  • Requests to language models now go through OpenRouter, which picks a provider for each call based on live price, speed and reliability and retries on another provider if one fails. Code does not need to change.
  • Image, video and audio generation still go directly through Hugging Face Inference Providers.
  • Breaking change: for language models, you can no longer use your own API key for a provider. Requests are billed to your Hugging Face account or organisation at the provider’s price, with no Hugging Face markup. Custom keys for image and video providers keep working.
  • You can pin a provider by adding its name as a suffix (model:provider), choose :fastest or :cheapest, and turn providers off in user or organisation settings. Organisation settings apply to every request billed to the organisation, and a pinned provider is never swapped on failover.

What it means for your data. A language-model request now passes through three parties: Hugging Face’s router, which handles authentication and billing; OpenRouter, which selects the provider; and the provider, which processes the prompt. Hugging Face’s security page, as retrieved on 23 November 2026, says it does not store request bodies or responses when routing and keeps debugging logs for up to 30 days without user data or tokens; it does not yet mention OpenRouter. OpenRouter’s documentation says it does not store prompts or responses unless you opt in to logging, but keeps metadata such as token counts and latency, and that provider data policies vary. Neither source says whether OpenRouter account-level privacy settings apply to requests arriving through Hugging Face.

The provider hop is not theoretical. On 22 November 2026 OpenRouter disclosed that researchers at Dragos had found compromised data or policies not being upheld at certain inference providers. It off-boarded three providers and removed 125 endpoints from zero-data-retention eligibility, and said the findings showed no breach of OpenRouter itself. Check which providers your user and organisation settings still allow.

Losing bring-your-own keys matters most to teams that chose a provider because of a contract: a data processing agreement, a zero-retention commitment or a region. Those terms belonged to your account with that provider. Calls billed through Hugging Face no longer run under that account, so check what your agreement with Hugging Face covers and pin or restrict providers accordingly. Our explainer on zero data retention sets out what to ask, and our review of whether OpenRouter is safe looks at that service directly.

If prompts must not leave your environment, no routing setting solves it. Download the weights and serve them yourself.

Hugging Face security concerns for enterprises: the controls that exist

Paid organisation plans add controls that matter when many staff use the Hub:

ControlPlanWhat it does
Single sign-onTeam and Enterprise; managed SSO on Enterprise PlusOrganisation login through your identity provider
Audit logsTeam and EnterpriseRecords membership, repository-setting and billing changes; exportable as JSON
Token managementTeam and EnterpriseLists members’ tokens; can require fine-grained tokens or admin approval
Resource groupsTeam and EnterpriseGroup-level access to sets of repositories
Advanced securityTeam and EnterpriseRequire 2FA; make new repositories private by default or private only
Network security and content access policyEnterprise PlusRequire login from your corporate IP ranges and block content such as all Spaces, or a specific organisation’s repositories
Gated models and gating group collectionsAny model author; collections on Team and EnterpriseRequire users to request access and share contact details before downloading
Provider controls and spending limitsTeam and EnterpriseDisable inference providers and cap spend for requests billed to the organisation

For regulated work, many organisations go further and do not let production systems download from the Hub at all. The pattern is a private mirror: a staging machine downloads an approved revision, scans it, records file hashes and licence, and copies it into internal storage; servers then load from there with HF_HUB_OFFLINE=1, which stops huggingface_hub from making any calls to the Hub. JFrog’s own guidance recommends a scanning proxy for the same reason. Unmanaged downloads to staff laptops are a form of shadow AI even when no prompt leaves the building.

Hugging Face safety checklist

  1. Check the publisher. Prefer verified organisations and the original lab’s repository over re-uploads.
  2. Prefer safetensors or GGUF. Avoid pickle files from accounts you do not know.
  3. Never enable trust_remote_code blindly. Read the .py files referenced in auto_map, then pin that commit with revision=.
  4. Update Transformers and PyTorch. Transformers 5.3.0 or later for CVE-2026-4372; PyTorch 2.6.0 or later for CVE-2025-32434. Current releases are better.
  5. Load unknown models in isolation. A container or VM without credentials, cloud metadata access or production network routes.
  6. Read the scan results, and treat clean as necessary, not sufficient.
  7. Use fine-grained tokens, read-only where possible, with 2FA on the account. Rotate any token created before mid-July 2026.
  8. Keep secrets out of code and out of static Spaces.
  9. Do not paste confidential data into third-party Spaces.
  10. For Inference Providers, pin or restrict providers and confirm what your contract covers now that language-model calls route through OpenRouter.
  11. Set HF_HUB_DISABLE_TELEMETRY=1 if you do not want library usage telemetry sent.
  12. For production, mirror internally and run with HF_HUB_OFFLINE=1; record hashes, licence and approver for each model.
  13. Check the licence. Open weights come with very different terms; our guide to licensing open models for company use explains them.

How VDF AI fits

Hugging Face answers where to get a model. An organisation also has to decide which models may be used, for which data, by whom, and how to show that later. VDF AI is an on-premises and private-cloud platform for chat, private RAG and governed agents, with role-based access control and audit logs on every plan and native Microsoft Entra ID single sign-on for on-premises deployments. It does not host or resell Hugging Face services.

At the model layer, VDF AI Router can register Ollama and custom on-premises deployments that serve weights you have vetted as model sources. It applies allow and deny lists before each call and returns every routing decision with its reason. Its cloud path also runs through OpenRouter, so the same data questions apply there; deny lists and air-gap mode, which restricts routing to local models only, exist for teams that want no cloud path at all.

Sources

Primary documents, research and vulnerability records, as retrieved on 23 November 2026.


Bringing open models from Hugging Face into a regulated environment? See how VDF AI Router enforces which models may run, or talk to our team.

Frequently asked questions

Is Hugging Face safe to use?

Hugging Face as a company and website is safe to use: it is SOC 2 Type 2 certified, scans uploads for malware, pickle imports and leaked secrets, and offers single sign-on and audit logs to organisations. The risk sits in the content, because anyone can publish a model, dataset or Space. Prefer safetensors files from publishers you recognise, never enable remote code you have not read, keep your libraries updated and use fine-grained tokens. Treat a download like any third-party software.

Is Hugging Face safe to download from?

Downloading a file is harmless; loading it is where the risk is. Pickle-based formats such as many .bin and .pt files can run code the moment they are loaded, and models that require trust_remote_code run Python from the repository. Safetensors and GGUF files hold data rather than code. Researchers found around 100 malicious models in 2024 and a 31-repository cryptominer campaign in 2026. Check the publisher, the file format and the scan badges, pin a commit and load untrusted models in an isolated environment.

Is Hugging Face legit?

Yes. Hugging Face is a real company that maintains widely used open-source libraries, including Transformers, Datasets and safetensors, and runs the main public hub where AI labs such as Qwen, NVIDIA and Mistral publish open-weight models. Its documentation states SOC 2 Type 2 certification and GDPR compliance, and its Enterprise plan offers data processing agreements. Being legitimate does not make every upload safe, though: the platform hosts user content, much as a code-hosting site does, and checks it with automated scanners.

What are the main Hugging Face security concerns?

Five recur. Malicious model files that run code when loaded, through pickle or through custom code enabled by trust_remote_code. Vulnerabilities in the loading libraries themselves, such as CVE-2026-4372 in Transformers before 5.3.0. Leaked or over-privileged access tokens. Spaces that run someone else's code on data you type into them. And, since 16 November 2026, a new party in the path of Inference Providers requests to language models: OpenRouter. Each has a specific control, summarised in this guide's checklist.

Does Hugging Face see my prompts when I use Inference Providers?

Hugging Face's security page says it does not store request bodies or responses when routing, keeps debugging logs for up to 30 days without user data or tokens, and points to each provider's own policy. Since 16 November 2026, language-model requests also pass through OpenRouter, which chooses the provider. OpenRouter's documentation says it stores request metadata but not prompts unless you opt in to logging. The provider that serves the model always processes your prompt. Running the model yourself avoids all three hops.

Can I still use my own provider API key on Hugging Face?

Not for language models. Hugging Face's announcement of 16 November 2026 says you can no longer use your own API key for a provider with these models; requests are routed through OpenRouter and billed to your Hugging Face account or organisation at the provider's price, without markup. Custom keys for image and video providers keep working. To control which provider serves a request, append the provider's name as a suffix to the model name, or turn providers off in your user or organisation settings.

Filed under
Hugging FaceAI securitymodel provenanceAI supply chaindata sovereigntyAI governance
AI Governance

Is your AI governance audit-ready?

Get a readiness review of your AI controls — policy, oversight, audit trails, and EU AI Act evidence — mapped against what production actually requires.

Keep reading