Guide · AI security
Security risks of running LLMs locally
Running a large language model locally can be a security threat, though a different one from using a hosted service. Prompts stop going to a provider. In exchange, you load a model file from someone else, run a local server that often has no authentication, and take on whatever behaviour the model's uploader built in. Prompt injection is unchanged, and hallucinated output does not go away.
Last reviewed
What running locally takes off the table
One exposure goes away. When the model runs on your own hardware, the prompt and the answer do not travel to a provider. Ollama’s FAQ puts it plainly: “We don’t see your prompts or data when you run locally.” That is the vendor’s statement about its own software, and it covers local models only; for its cloud-hosted models, the same FAQ says Ollama processes prompts to provide the service but does not store, log or train on them.
If the worry that brought you here is a provider seeing your data at all, running locally answers it. It does not answer the rest.
What running locally puts on your machine
A file from someone else that your software parses. A local model is a file you downloaded. Hugging Face warns that pickle, “the default format for PyTorch model weights”, can run arbitrary code when loaded. Attackers have tried it: in February 2025 ReversingLabs reported two models on Hugging Face whose pickle files carried a reverse shell, a payload that hands the attacker a command line on the machine that loads it. ReversingLabs judged them closer to a proof of concept than a campaign. GGUF, the binary format that llama.cpp and similar runners load, is not pickle, but the loader still has to parse it. In January 2024 a Databricks researcher found memory corruption bugs in GGML’s GGUF parser that a crafted file could use to run code on the victim’s machine; they were patched within a week. Separately, researchers from Pillar Security and Fujitsu Research of Europe showed that a GGUF file’s chat template, the logic that builds the prompt the model sees, can be poisoned to change what the model does without touching the weights. The broader pattern is unsafe AI artifacts.
A server. Local runners serve an HTTP API so other programs can use the model. Ollama binds it to 127.0.0.1:11434 by default, reachable only from the same machine. One environment variable changes that. Wiz wrote in June 2024 that Ollama “does not support authentication out-of-the-box”. In June 2024 Wiz disclosed CVE-2024-37032: a malicious model registry could make Ollama’s model-pull endpoint overwrite files anywhere on the server, which Wiz turned into remote code execution. It was fixed in version 0.1.34. Wiz noted that the Docker image ran as root and listened on all interfaces by default. Its scan found over 1,000 Ollama servers exposed to the internet. In September 2025 Cisco researchers, searching the Shodan index of internet-connected devices, reported over 1,100, about 20% of them actively hosting models open to unauthorized access.
The model’s behaviour. Locally, you run whatever the uploader shipped. Hubinger and colleagues trained models to write secure code when told the year was 2023 and exploitable code when told it was 2024. They found such a backdoor attack can be made to survive standard safety training, including supervised fine-tuning, reinforcement learning and adversarial training, most of all in the largest models. Refusals are a weak safeguard once someone holds an open weight model’s weights: Arditi and colleagues report that their method “can yield a jailbroken version of a 70B parameter model using less than $5 of compute”. How completely it worked varied by model, and for Llama-2 models by whether the default system prompt was used. Abliterated and uncensored models are ones where the uploader already did that on purpose.
What running locally does not fix
Prompt injection. Greshake and colleagues argue that applications built on language models “blur the line between data and instructions”, and indirect prompt injection exploits that by planting instructions in data the application retrieves. Nothing about it depends on where the model runs. A local model that reads email, web pages or files, or that can call tools, can be steered by text planted in them.
Hallucinated output. Running locally does not make a model more accurate, and it may make it less so. Spracklen and colleagues generated 576,000 code samples in two programming languages from 16 models. Commercial models hallucinated at least 5.2% of package names on average, open-source models 21.7%. The paper compares open-source and commercial models, not local and hosted deployment, so read it as a caution rather than a measurement of local use. A hallucinated package name is what slopsquatting exploits.
What to do about it
- Treat a model file as software you are installing. Hugging Face’s advice is to load models from users and organizations you trust and rely on signed commits. Prefer a format built not to run code, such as safetensors, which its maintainers describe as storing tensors “safely (as opposed to pickle)”.
- Keep the runner patched. Both the Ollama and GGUF bugs above were fixed in updates; an old runner still has them.
- Keep the API on localhost. If other machines need it, put it behind a reverse proxy that authenticates, which is Wiz’s advice. Check what a container publishes, not only what the runner binds.
- Treat what the model reads and writes as untrusted, as you would with a hosted model. Limit the tools it can call.
What does not work
Relying on the hub’s scanner. Hugging Face checks pickle files with Picklescan, which works from a blocklist of dangerous functions. Picklescan did not flag the two models ReversingLabs reported. ReversingLabs says their 7z compression is “likely the reason”, and that their broken pickle files exposed a second gap, which Hugging Face then patched. A blocklist only catches what is already on the list.
Trusting a model because it passed safety training. The Sleeper Agents authors found that adversarial training could teach a backdoored model to recognise its trigger better, “effectively hiding the unsafe behavior”.
Assuming local means private to the machine. A runner bound to all interfaces, or a container with its port published, is a network service, and Wiz’s scan and Cisco’s Shodan search each found over a thousand Ollama servers open to the internet.
Questions and answers
Is running an LLM locally safer than using ChatGPT or another hosted service?
Safer for one thing, riskier for others. Running locally keeps prompts off a provider's servers. It also means loading a model file you downloaded, running an inference server on your own machine, and taking on whatever behaviour the model's uploader built in. The first two have had real, exploitable vulnerabilities, and researchers have shown the third can hide a backdoor. Prompt injection works the same either way, and local models are not less prone to hallucination.
Can a downloaded model file contain malware?
Yes. Hugging Face warns that loading a pickle file, the default format for PyTorch weights, can execute arbitrary code, and in February 2025 ReversingLabs reported two models on Hugging Face carrying a reverse shell payload, which it judged closer to a proof of concept. GGUF files are not pickle, but in January 2024 a Databricks researcher found memory corruption bugs in the library that parses them, which a crafted file could exploit to run code.
Sources
- Ollama FAQOllama
- Pickle ScanningHugging Face
- Malicious ML models discovered on Hugging Face platformReversingLabs, 6 Feb 2025
- GGML GGUF File Format VulnerabilitiesNeil Archibald, Databricks, 22 Mar 2024
- MITRE ATLAS, AML.CS0064 Poisoned GGUF Templates: Inference-Time Supply Chain Attack (collection 2026.09)MITRE
- Probllama: Ollama Remote Code Execution Vulnerability (CVE-2024-37032)Sagi Tzadik, Wiz, 24 Jun 2024
- Detecting Exposed LLM Servers: A Shodan Case Study on OllamaGiannis Tziakouris and Elio Biasiotto, Cisco, 1 Sep 2025
- Sleeper Agents: Training Deceptive LLMs that Persist Through Safety TrainingHubinger et al., Jan 2024
- Refusal in Language Models Is Mediated by a Single DirectionArditi et al., NeurIPS 2024, Jun 2024
- safetensorsHugging Face
- Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt InjectionGreshake et al., Feb 2023
- We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMsSpracklen et al., USENIX Security 2025, Jun 2024
Related topics
Terms in this guide
In the news
- AI agents put confidential data on a company blog in 87 of 100 tests
- Z.ai releases GLM-5.4, a model that uses 28 layers again
- OpenAI and Anthropic hold 72% of UK firms' AI model mentions
- Cleave edit removes safety from open AI models with no new training
- LlamaIndex releases OCRia-nano-1, a small document parser for CPUs
- Sarvam releases an open 105B model at $0.15 for each million tokens
- LookAtMyQuant cuts Inkling 2 Mini from 18.89 GB to 5.38 GB
- Thinking Machines releases Inkling 2 Mini, an open model for laptops
- A short plan carries most of the difference between 2 top agents
- New turn in US House inquiry as China army wants DeepSeek and Qwen
- US House report tells of Chinese open weight AI at US firms
- New turn in Chinese AI inquiry as Cursor plans to explore an exit
- Disclosed software flaws more than doubled in 2026, a study finds
- NariQ cuts a model to 2.5 bits and keeps its agent results
- Fireworks AI tells that open models are at most 6 months behind
- Palo Alto Networks buys Applied Compute for $4.5 billion
- Cloudflare releases 2 open models that read data from documents
- Qwen3.8 coding adapter lifts a test score from 39.2% to 64.7%
- Reson8 releases a free model that makes 17.6% errors in 10 languages
- The sampler controls if long AI output holds at high temperature
- Hugging Face used an open Chinese model to examine an agent attack
- Open model Beveridge beats five large AI models at set decisions
- Hugging Face sends AI model requests to OpenRouter
- Alibaba says Qwen4-Max has a score above that of Claude Fable 5.1
- Meituan releases LongCat 2.5, an AI model made on Chinese chips
- Protegrity releases an open model that finds 69 types of personal data
- Teams of 30 small AI models cut a single model's error by only 1.7%
- Nous Research cuts propaganda in a Qwen model from 22 to 1 percent
- Edge0 releases an open 145B model that operates on a laptop
- Salesforce releases a voice to text model with a 2.3% word error rate
- Nebius revenue grows 571% to $981m, but US sites have power delays
- Amazon adds 3 open DeepSeek V4 models to SageMaker JumpStart
- Free site gives AI-made exploits for 200 vulnerabilities on patch day
- Runway releases the Praxis-1 robot model with open weights
- Plurai gets $13 million to test AI agents in simulations
- Deleting AI reasoning history shifts task scores by up to 51 points
- Test of 17 AI moderators finds no model strong on all five trust axes
- Tether AI Research presents BotPsy, a 0.8B model for on device agents
- A monitor external to the model cut AI agent attack success to 1.3%
- New turn in Fireworks AI breach after cloud provider hack
- Fused-Softmax gives attention 2.1 to 3.2 times the speed on AMD GPUs
- Amazon SageMaker adds NVIDIA Nemotron 3.5 Super VL model
- NVIDIA invests in Point2 and will back three more Korean AI stakes
- A thought that copies a model style gets control of AI agents
- Prompt injection guards give incorrect alarms on 92% of some contracts
- AWS gives Claude Opus 5 and Sonnet 5 in South Korea
- Meta strategy chief Dave Wehner becomes CFO of AI firm Fireworks
- Nous Research cuts Chinese bias in a Qwen model to 0.9 percent
- Bedrock adds Moonshot AI model Kimi K3.1 Pro and a fast variant
- Chinese models get 89% of US open-source model spending
- 107 of 135 AI agents made incorrect claims in a staffing test
- Thinking Machines launches Inkling 2 Small with closed weights
- NVIDIA releases 4 open Cosmos 3 models for driving and robots
- Ripple-65B tops US open models on agentic coding at a $32M cost
- VeriSpoof finds voice deepfakes at 2.14% error with one model
- Same model got 30% to 81% on tasks with three different harnesses
- Axion 1.0 is an open AI agent model with a 3 step recipe
- Sarvam releases Prism, an open decision model that answers in 44 ms
- The method of 4-bit compression changed a hidden trait in an AI model
- A study shows where models hold signs of their training data
- A model that finds agent faults well can monitor agents badly
- A test finds Chinese AI models agree with Beijing less than persons think
- GLM-5.3 used code from memory when told not to
- Microsoft adds Mistral Large 4 and OCR 4 to its Foundry platform
- Mistral releases Large 4 open weights under a modified MIT license
- Replay tests connect the Qwen upload to model errors, not a backdoor
- Mistral says Le Chonk is the top open-weight model for coding
- New turn in California AI oversight with two plans to stop AI
- Test of 2,000 agent runs finds context compression gains are small
- Nvidia releases a free model that transcribes audio in 40 languages
- RLWRLD puts its robot dexterity model on the AWS Marketplace
- Ant Group publishes Ling-3.1-flash-1019, a 574 GB open model
- AI reviewers did not stop 1 in 6 bug attacks from AI attackers
- A broken part in an AI gateway left its system score almost the same
- Moonshot AI removes attack data from Kimi K3.1 Pro
- A joint plan lifts Qwen3.8-27B from 66.8% to 92.4% on code tests
- Hugging Face chief says most companies will make AI models in 24 months
- Trend AI operates Nvidia Nemotron in customer data centers
- Kimi K3.1 Pro is 4th on the Artificial Analysis index with 55 points
- Reflection releases Beam, an open model with 501 billion parameters
- Microsoft adds 4 open models and shared hosting to Foundry
- MiniMax puts M3.1 Flash weights online with a $20 million limit
- Mistral Large 4 scores 82% on a cyber test and gets open weights
- Nvidia shows open models for document search at GTC Berlin
- IBM voice model is number 2 on an open English test
- Authors say Yuvion VL beats closed models on safety, with no scores
- Tuning a 4 bit search model can cut its quality by 71.53 points
- Meta releases Muse Wonder Full, which has a score of 56 on an index
- GoTo makes a free AI model for 5 Indonesian languages
- MiniMax M3.1 Flash is free on AI Gateway until 20 October
- A cache attack on AI reasoning reaches 79% success in tests
- Small AI agents ignore most attacks and do not refuse them
- GPT-5.5 left out a bad result in 198 of 200 abstracts
- Meta makes Muse Spark Open, an open-weight AI model
- Open-weight models process 7 in 10 tokens on the Vercel AI Gateway
- A new attack tool uses stolen AI keys, and the owner pays
- Healthcare agents miss 32 to 97% of escalations that they must make
- Meta releases Muse Spark Open, a model with 816B parameters
- Researchers test a guard that stops a reply only if it turns dangerous
- One warning sentence helps AI agent groups with incorrect context
- Small AI models suit short agent tasks, and large models long tasks
- Mistral releases Large 4 with 1.05 trillion parameters
- AI agents that do tasks correctly leak more private data, a study finds
- A test of 86 open-weight models shows large differences in energy use
- An incorrect preference makes AI models give incorrect medical advice
- An open-weight model gets the same score as closed models at a low cost
- Fish Audio Drama 3 Preview is the top open-weights voice model
- Researchers put encrypted networks in the weights of AI models
- Artificial Analysis made AA-3D, a test for AI 3D scenes
- Researchers made prompt injection attacks work, with a maximum rate of 96%
- A new refinement step helps 6 methods of low-bit quantization