The Security Nightmare of Local LLMs: Why Fences Must Replace Sandboxes
Sandboxes assume you can contain an application. A local LLM with tool access is not an application. It is a semi-autonomous actor with root-adjacent reach, and the runtime underneath it is riddled with holes.

The short answer
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.
The scale of exposure is not hypothetical
Ollama is the most popular way to run models locally, with well over 170,000 GitHub stars and 100 million-plus Docker Hub pulls.1 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.2 Separately, Cyera Research measured roughly 300,000 internet-facing Ollama instances, all reachable with zero authentication out of the box.3
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.4 Once it's reachable, no password stands between an attacker and the model.
The bugs are not edge cases, they are 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.4 Wiz reported it on May 5, 2024; Ollama shipped a fix in about four hours.4 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.3 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.5
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 the sandbox metaphor breaks
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.3 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.
Fences, not 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.3
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.
The cost math still favors 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.
FAQ
Is Ollama safe to run on a laptop? Yes, if it stays bound to localhost and you keep it updated. The risk appears when OLLAMA_HOST gets set to 0.0.0.0 or the server runs in a Docker container exposed to a network, which removes the one protection Ollama has by default.4
What's the single most important local LLM security fix? Authentication in front of the inference API. Ollama, vLLM, and llama-server all ship without built-in auth, and the exploits above (Probllama, Bleeding Llama, the llama.cpp server UAFs) all assume an attacker can reach the API directly.345
Can a malicious model file actually compromise my machine? Yes. Crafted GGUF files have been demonstrated to trigger heap overflows and out-of-bounds reads during loading in both Ollama and llama.cpp, and pickle-based formats like .bin and .pt can execute arbitrary code on load. Stick to safetensors and verify file hashes before loading anything from outside your own pipeline.
Do sandboxes still matter at all? Yes, for code execution tools an agent calls. But they don't cover data exfiltration through an inference engine's own legitimate API, which is how Bleeding Llama worked. Network fencing and authentication cover that gap; sandboxes alone do not.3
How many local inference servers are actually exposed right now? Estimates vary by methodology and month, but independent research has put the number of internet-facing Ollama servers at 175,000 in one count and roughly 300,000 in another, both within the same year.23
Yes, if it stays bound to localhost and stays updated. Risk appears when it's configured to listen on all network interfaces or run exposed in a container.
Put real authentication in front of the inference API. Ollama, vLLM, and llama-server ship without it by default, and every major exploit found so far assumes direct, unauthenticated access.
Yes. Crafted GGUF files have triggered heap overflows and out-of-bounds reads on load in both Ollama and llama.cpp. Use safetensors format and verify file hashes before loading unfamiliar models.
They matter for code-execution tools an agent calls, but they don't stop data exfiltration through the inference engine's own legitimate API. That requires network fencing and authentication, not containment.
Independent counts have found 175,000 internet-facing Ollama servers in one scan and roughly 300,000 in another within the same year, both reachable without any login.
- 1Bleeding Llama: A Critical Memory Leak in the World's Most Popular Local AI PlatformCyera
- 2Researchers Find 175,000 Publicly Exposed Ollama AI Servers Across 130 CountriesThe Hacker News
- 3Bleeding Llama: Critical Unauthenticated Memory Leak in OllamaCyera Research
- 4Probllama: Ollama Remote Code Execution Vulnerability (CVE-2024-37032) – Overview and MitigationsWiz
- 5Breaking Local AI Runtimes: 10 vulnerabilities in the Engine Behind Your Open-Source ModelsCyera Research



