The Security Nightmare of Local LLMs: Why Fences Must Replace Sandboxes
Local inference engines like Ollama and llama.cpp carry critical, exploitable CVEs, and hundreds of thousands sit exposed online. Here's what to fix first.

Why must fences replace sandboxes for local LLM security?
Fences must replace sandboxes because local LLM security risk comes from three converging problems: the inference engines themselves (Ollama, llama.cpp) ship with critical, unauthenticated remote code execution and memory-leak bugs; hundreds of thousands of these servers sit exposed on the open internet with no login screen; and the agents running on top of them now have tool-calling access to files, shells, and APIs, which turns a text-generation bug into a system compromise. Traditional sandboxing was built for adversarial code, not for a model that can be tricked into acting adversarial from the inside. Organizations need network and identity fences around inference infrastructure, not containers that assume the thing inside them is passive.
TL;DR
- Researchers found 175,000 exposed Ollama hosts across 130 countries, nearly half with tool-calling enabled, and Cyera measured roughly 300,000 internet-facing instances reachable with no authentication.
- Ollama is private by design but exposed by default, because plenty of people change the localhost binding, especially in Docker deployments running as root.
- Probllama and Bleeding Llama show that an API server with no authentication invites repeated bugs, and Bleeding Llama needed only three unauthenticated HTTP calls to leak memory.
- Cyera found ten distinct vulnerabilities in llama.cpp, and five of the ten CVEs remained unpatched at their June 2026 re-check.
- Sandboxes fail because the exploited features were the product working as designed, so an attack that exfiltrates data through the normal API never tries to escape the box.
- The fix is to treat the inference server like a database, with real authentication and restricted egress, and to treat model files as a supply chain risk.
- Self-hosting still wins on cost and data control, but security has to be priced in alongside compute and engineering time.
How large is the real-world exposure of local LLM servers?
Ollama is the most popular way to run models locally, with well over 170,000 GitHub stars and 100 million-plus Docker Hub pulls. A joint investigation by SentinelOne SentinelLABS and Censys found 175,000 unique Ollama hosts exposed to the public internet across 130 countries, nearly half of them with tool-calling enabled, meaning they can execute code and hit external APIs, not just generate text. Separately, Cyera Research measured roughly 300,000 internet-facing Ollama instances, all reachable with zero authentication out of the box.
That gap between "private by design" and "exposed by default" is the whole story. Ollama binds to localhost unless someone changes a config flag, but plenty of people change that flag, especially in Docker deployments where the server runs as root and listens on 0.0.0.0. Once it's reachable, no password stands between an attacker and the model.
Are the bugs edge cases, or are they structural?
Three waves of vulnerability research tell the same story from different angles.
Probllama (CVE-2024-37032). Wiz Research found a path traversal flaw in Ollama's model-pull API that let an attacker overwrite arbitrary files on the host. In Docker installs running as root, that chained into full remote code execution: corrupt /etc/ld.so.preload, plant a malicious shared library, and any subsequent API call loads it. Wiz reported it on May 5, 2024; Ollama shipped a fix in about four hours. Fast patching is good news. It does not change the fact that the underlying design, an API server with no authentication, invites this class of bug repeatedly.
Bleeding Llama (CVE-2026-7482, CVSS 9.1). Cyera Research found an out-of-bounds heap read in Ollama's GGUF model-loading pipeline. A crafted model file makes Ollama read past its buffer and capture whatever else is sitting in memory: system prompts, conversation history, environment variables, API keys. The attacker then uses Ollama's own model-push feature to exfiltrate the stolen memory to a server they control. The entire attack is three unauthenticated HTTP calls. With roughly 300,000 servers exposed, this was not a theoretical CVE. It was a mass-exploitable one the day it was disclosed.
Ten CVEs in llama.cpp. llama.cpp is the C/C++ inference engine underneath Ollama, LM Studio, Jan, GPT4All, and most local-model tooling. It manages memory manually, with no garbage collector and, in several code paths, no locking to stop one thread from freeing memory another thread is still reading. Cyera Research audited the trust boundaries where that native code meets untrusted input and found ten distinct vulnerabilities, including use-after-free bugs in the bundled HTTP server rated CVSS 9.2, and a use-after-free in the Android JNI bindings that Cyera turned into full code execution through a counterfeit object-oriented programming chain. Cyera coordinated with VulnCheck for CVE assignment after the project's own disclosure process broke down; as of their June 2026 re-check, five of the ten CVEs remained unpatched.
Stack those together and the pattern is clear: the software running your local model is not hardened infrastructure. It is fast-moving open source with the memory-safety habits of C, wrapped in an API that assumes a friendly network.
Why does the sandbox metaphor break?
A sandbox contains a known, bounded piece of code and restricts what it can touch. That model works when the thing inside the box is passive: a script, a container, a function. It stops working once the thing inside the box is an agent with tool access, its own judgment about what to do next, and a runtime underneath it that can be tricked into leaking the sandbox's own contents.
The exploited features in Bleeding Llama were not misconfigurations. They were the product working as designed: model upload, model creation, model push. An attacker used Ollama's legitimate feature set to walk data out the front door. A sandbox that only watches for code trying to escape its walls will miss an attack that never tries to escape at all, because it exfiltrates data through the API the application is supposed to use.
Persistent agents make this worse. An agent with a standing connection to a local inference server, file system access, and shell tools is not a request-response transaction you can sandbox once and forget. It is a long-running process with credentials, memory, and the ability to act again tomorrow on data it saw today. If the inference engine underneath it leaks a system prompt or an API key once, that leak persists for as long as the credential does.
Why use fences instead of sandboxes?
The practical shift is from containment around a single process to perimeter control around the whole inference layer, plus identity and egress rules that travel with the agent rather than the box it happens to run in.
That means treating the inference server the way you would treat a database: never on the open internet, always behind a real authentication layer, always on a network segment with restricted egress. Cyera's own remediation guidance after Bleeding Llama is blunt: patch immediately, block port 11434 at the firewall if you can't patch right away, put an authenticating reverse proxy in front of every instance, and assume any secrets that were in memory during exposure are already compromised and need rotating.
It also means treating model files as a supply chain risk, not a data file. GGUF and pickle-based formats can carry executable payloads or malformed metadata that corrupts memory on load; security teams increasingly recommend banning .bin and .pt formats in favor of safetensors, and verifying SHA-256 hashes before any file reaches the loader.
And it means building the fence around the agent's permissions, not the model's container. An agent that can read files, call APIs, and push models to a registry needs the same governance as a human with those same permissions: least privilege, logged access, and network controls that don't assume good faith from the software running underneath it. Teams that have already gone through the exercise of tuning a local model for real production use know this infrastructure gets touched constantly. Every touch is a chance to reintroduce exposure if the fence isn't there by default.
Does the cost math still favor self-hosting if you fence it?
None of this is an argument against running models locally. The economics are still compelling, and self-hosting your AI stack remains the right call for cost and data-control reasons. But security has to be priced into that decision the same way compute and engineering time are. An unpatched, internet-facing Ollama box isn't a cheaper alternative to an API, it's a liability sitting on your network waiting for a scan to find it. Platforms built for owning this infrastructure responsibly, like Remy, bake network isolation and access control into the deployment rather than leaving it as an afterthought for whoever stood up the server.
The same governance gap shows up when employees spin up their own local models outside IT's view, which is really the same shadow AI problem wearing a different hat. A model running on someone's laptop with tool-calling enabled and no firewall rule is exactly the kind of unmanaged compute this research keeps finding by the hundreds of thousands.
How we source, write, and correct our articles. Editorial standards



