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
| Scenario | Verdict | Why |
|---|---|---|
| Browsing models, papers and documentation | Safe | Ordinary website use |
| Downloading safetensors or GGUF weights from a known publisher | Safe for most work | Data formats with no code execution on load |
Loading pickle files (.bin, .pt, .pkl) from unknown accounts | Risky | Pickle can run code when loaded |
Any model that requires trust_remote_code=True | Read the code first | It runs Python from the repository on your machine |
| Old versions of Transformers or PyTorch | Update | Published flaws let crafted models run code |
| Typing confidential data into someone else’s Space | Treat as a third-party app | The Space owner’s code receives it |
| Classic read or write tokens in scripts | Replace | Fine-grained, scoped tokens limit damage when leaked |
| Inference Providers with language models | A hosted service, now via OpenRouter | Prompts reach Hugging Face’s router, OpenRouter and the chosen provider |
| Company-wide use | Needs organisation controls | SSO, 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
| Published | Who reported it | What happened |
|---|---|---|
| 27 Feb 2024 | JFrog | Around 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 2025 | ReversingLabs | Two 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 2025 | JFrog (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 2026 | Pluto 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.
| CVE | Published | Component | What it allowed | Fixed in |
|---|---|---|---|---|
| CVE-2024-3568 | 10 Apr 2024 | Transformers, TensorFlow checkpoint loading | Code execution through pickle.load on a crafted checkpoint during training | 4.38.0 |
| CVE-2025-32434 | 18 Apr 2025 | PyTorch torch.load | Code execution even with weights_only=True | 2.6.0 |
| CVE-2026-4372 | 24 May 2026 | Transformers from_pretrained | A crafted config.json field made the library download and run code from another repository, bypassing trust_remote_code | 5.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:fastestor: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:
| Control | Plan | What it does |
|---|---|---|
| Single sign-on | Team and Enterprise; managed SSO on Enterprise Plus | Organisation login through your identity provider |
| Audit logs | Team and Enterprise | Records membership, repository-setting and billing changes; exportable as JSON |
| Token management | Team and Enterprise | Lists members’ tokens; can require fine-grained tokens or admin approval |
| Resource groups | Team and Enterprise | Group-level access to sets of repositories |
| Advanced security | Team and Enterprise | Require 2FA; make new repositories private by default or private only |
| Network security and content access policy | Enterprise Plus | Require login from your corporate IP ranges and block content such as all Spaces, or a specific organisation’s repositories |
| Gated models and gating group collections | Any model author; collections on Team and Enterprise | Require users to request access and share contact details before downloading |
| Provider controls and spending limits | Team and Enterprise | Disable 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
- Check the publisher. Prefer verified organisations and the original lab’s repository over re-uploads.
- Prefer safetensors or GGUF. Avoid pickle files from accounts you do not know.
- Never enable
trust_remote_codeblindly. Read the.pyfiles referenced inauto_map, then pin that commit withrevision=. - 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.
- Load unknown models in isolation. A container or VM without credentials, cloud metadata access or production network routes.
- Read the scan results, and treat clean as necessary, not sufficient.
- Use fine-grained tokens, read-only where possible, with 2FA on the account. Rotate any token created before mid-July 2026.
- Keep secrets out of code and out of static Spaces.
- Do not paste confidential data into third-party Spaces.
- For Inference Providers, pin or restrict providers and confirm what your contract covers now that language-model calls route through OpenRouter.
- Set
HF_HUB_DISABLE_TELEMETRY=1if you do not want library usage telemetry sent. - For production, mirror internally and run with
HF_HUB_OFFLINE=1; record hashes, licence and approver for each model. - 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.
- Hugging Face Hub documentation: security overview, malware scanning, pickle scanning, secrets scanning, Protect AI scanner, JFrog scanner, user access tokens, gated models and Spaces overview
- Hugging Face Team and Enterprise documentation: plans, SSO, audit logs, tokens management, resource groups, advanced security, network security and gating group collections
- Hugging Face Inference Providers documentation: overview, routing, pricing and billing, Hub integration and settings and security
- Hugging Face blog: Inference Providers and OpenRouter, 16 November 2026, security incident disclosure, July 2026, Space secrets leak disclosure, 31 May 2024, partnership with Wiz Research, 4 April 2024 and safetensors security audit, 23 May 2023
- Transformers documentation: loading models, including custom models; huggingface_hub: environment variables
- OpenAI: Hugging Face model evaluation security incident, 21 July 2026
- OpenRouter: data collection, provider logging and data processing incidents on inference providers, 22 November 2026
- PyTorch: v2.6.0 release notes
- National Vulnerability Database: CVE-2024-3568, CVE-2025-32434, CVE-2025-10155, CVE-2025-10156, CVE-2025-10157 and CVE-2026-4372
- JFrog: Data scientists targeted by malicious Hugging Face ML models with silent backdoor and three zero-day PickleScan vulnerabilities
- ReversingLabs: Malware found in ML models hosted on Hugging Face (nullifAI)
- Lasso Security: exposed Hugging Face API tokens
- Pluto Security: Load/Mine, a Hugging Face malware campaign
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.