---
title: "The Security Nightmare of Local LLMs: Why Fences Must Replace Sandboxes"
url: "https://goremy.ai/blog/articles/local-llm-security-risks-why-fences-beat-sandboxes"
author: Luis Chavez-Mattos
editor: Luis Chavez-Mattos
editor_title: Director, Product
published: "2026-08-30T13:32:32.275Z"
updated: "2026-08-30T13:32:32.275Z"
topic: AI Safety & Security
description: "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."
---

# 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.

Edited by Luis Chavez-Mattos, Director, Product · Published 2026-08-30

## 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. [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.

## 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. [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 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. [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.

## 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. [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](https://goremy.ai/blog/articles/how-to-make-a-local-llm-smarter-a-practical-tuning-guide) 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](https://goremy.ai/blog/articles/how-to-self-host-ai-models-for-business-2026-guide) 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](https://goremy.ai), 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](https://goremy.ai/blog/articles/free-claude-problem-managing-shadow-ai-at-work) 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.

**Exposed local inference servers found by security researchers**

|  | Servers found exposed |
| --- | --- |
| Wiz (2024): exposed Ollama instances found in scan | 1,000 servers |
| SentinelOne/Censys (Jan 2026): exposed Ollama hosts | 175,000 servers |
| Cyera (2026): internet-facing Ollama servers | 300,000 servers |

_Figures from separate scans at different dates; methodology and internet conditions differ, but the trend of large-scale unauthenticated exposure is consistent across all three._

## 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. [3] [4] [5]

**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. [2] [3]

## Sources

1. [Bleeding Llama: A Critical Memory Leak in the World's Most Popular Local AI Platform](https://www.cyera.com/blog/bleeding-llama-a-critical-memory-leak-in-the-worlds-most-popular-local-ai-platform) (Cyera)
2. [Researchers Find 175,000 Publicly Exposed Ollama AI Servers Across 130 Countries](https://thehackernews.com/2026/01/researchers-find-175000-publicly.html) (The Hacker News)
3. [Bleeding Llama: Critical Unauthenticated Memory Leak in Ollama](https://www.cyera.com/research/bleeding-llama-critical-unauthenticated-memory-leak-in-ollama) (Cyera Research)
4. [Probllama: Ollama Remote Code Execution Vulnerability (CVE-2024-37032) – Overview and Mitigations](https://www.wiz.io/blog/probllama-ollama-vulnerability-cve-2024-37032) (Wiz)
5. [Breaking Local AI Runtimes: 10 vulnerabilities in the Engine Behind Your Open-Source Models](https://www.cyera.com/research/breaking-local-ai-runtimes-10-vulnerabilities-in-the-engine-behind-your-open-source-models) (Cyera Research)
