In May 2026, researchers disclosed Bleeding Llama (CVE-2026-7482), a heap out-of-bounds read in the GGUF model loader of Ollama. An unauthenticated attacker could pull memory from the server process, and roughly 300,000 internet-facing deployments were exposed.
Teams self-host open-weights models such as DeepSeek, Kimi or Llama to keep prompts and data under their own control. That control only holds if the inference stack is hardened. Most inference servers ship with defaults built for a developer laptop, not for a production network.
This guide covers six layers to lock down, in rough order of impact.
Why are self-hosted LLM servers such an easy target?
Inference servers were built for convenience first. Many accept API calls without any authentication. When Wiz disclosed Probllama (CVE-2024-37032) in 2024, the flaw was especially severe in Docker installs, where Ollama ran as root and listened on 0.0.0.0 by default.
Exposure is not a rare mistake. In January 2026, SentinelOne and Censys researchers counted about 175,000 publicly reachable Ollama servers across 130 countries.
Attackers have noticed. Citing GreyNoise data, the Cloud Security Alliance reports more than 91,000 honeypot attack sessions against exposed LLM endpoints between October 2025 and January 2026. High-profile flaws in inference frameworks are now exploited in under 24 hours.
Hardening starts with an inventory. Find every Ollama, vLLM, Triton or similar process in your environment, including the one a developer started on a spare GPU box. Record the version, the bind address and the owner of each one.
How do you check that a downloaded model is not malware?
A model file is code you did not write. PyTorch checkpoints use the Python pickle format, which can run arbitrary code the moment the file loads. In early 2025, ReversingLabs found two malicious models on Hugging Face that used broken pickle files to slip past Picklescan, the scanner the platform relies on.
Prefer safetensors, which stores only tensor data. If you must load a pickle checkpoint, call torch.load with weights_only=True.
Safer formats still depend on a safe parser. Crafted GGUF files triggered Bleeding Llama and an out-of-bounds write found by Sonar in Ollama versions before 0.7.0. Daily CyberSecurity also covered a separate Ollama heap leak through malicious model uploads (CVE-2026-5757), reported in April 2026 without a patch at the time.
Practical controls:
• Pull models only from verified publishers, then pin and check file hashes.
• Mirror approved models in an internal registry, so servers never pull from public hubs at runtime.
• Keep trust_remote_code off, and patch. vLLM flaws CVE-2026-22807 and CVE-2026-27893 let model repositories run code even when operators had disabled it.
• Restrict or disable model upload and creation endpoints.
Who should be allowed to call your inference API?
Never expose the inference server port directly. Put a reverse proxy in front of it that terminates TLS and enforces authentication: per-application API keys, OAuth tokens or mutual TLS for service-to-service traffic.
Separate inference from administration. Bleeding Llama chained two management calls: /api/create to load a crafted file and /api/push to send leaked memory to a registry the attacker controls. Client applications only need the generation endpoints, so block everything else at the proxy.
Add rate limits and quotas per key. They stop GPU theft, slow down probing and make abuse visible in your metrics. Assign each key to a named owner, and revoke it when the application is retired.
Where should the inference server sit on your network?
Bind the server to localhost or a private interface, never to 0.0.0.0 on a host with a public address. In Ollama, set OLLAMA_HOST to 127.0.0.1; in vLLM, start the server with –host 127.0.0.1 and let the proxy carry remote traffic. Place GPU nodes in their own segment, reachable only from the proxy and approved application subnets.
Filter egress as strictly as ingress. Once models are mirrored internally, an inference server rarely needs the open internet. Without outbound access, a /api/push exfiltration fails, and server-side request forgery flaws such as vLLM CVE-2026-25960 lose most of their payoff.
Run the service as a non-root user in a container, mount model directories read-only and drop capabilities the runtime does not need.
What should you log, and what should you never log?
Log what an attacker would touch: authentication failures, model loads and deletions, calls to management endpoints, unusual request volumes and outbound connections. Splunk publishes ready-made detections for suspicious Ollama activity, including possible code execution through model loading and API endpoint scanning. Send these events to your SIEM and alert on any management call that does not come from an approved admin host.
Treat prompts as sensitive data. They often contain customer records, source code and credentials. Keep them out of general-purpose logs, redact where you can and set short retention. According to Splunk, recent Ollama versions no longer write individual prompts to server logs, but check what your proxy, gateway and tracing tools store.
How fast do you need to patch, and when is self-hosting no longer worth it?
Patch windows for inference servers should match those of your most exposed web applications. Ollama shipped the Bleeding Llama fix (version 0.17.1) in late February 2026, but the CVE took nearly three months to appear, according to the researchers’ disclosure timeline, and the update was not flagged as a security fix. Teams that relied on CVE feeds alone would have missed it.
Watch the GitHub security advisories of every component in your stack, and name an owner for each one. Track what is actually running, not what the deployment docs say: container images pinned to old tags keep vulnerable versions alive long after a fix ships.
Then be honest about capacity. Hardening, monitoring and patching an inference stack is ongoing work. If your team cannot ship inference server patches within days of a disclosure, pay-as-you-go inference for open-weights models can be the safer option, as long as you audit that provider against the same six layers.
What should you check before the next disclosure?
Self-hosting open-weights models gives you control over your data only when the stack around them is locked down. Run through this list now:
• Models come from verified sources, in safe formats, with pinned hashes.
• The API sits behind TLS, authentication and rate limits.
• Management endpoints are blocked for client applications.
• Servers live in an isolated segment with filtered egress.
• Logs capture admin actions, while prompts stay out of them.
• Every component has an owner and a patch window.