The appeal of self-hosted large language models is straightforward: control, privacy, and no vendor lock-in. But recent security research has exposed a critical blind spot in how many infrastructure engineers deploy local AI services. An unauthenticated Ollama instance exposed to arbitrary webpages can become a vector for model poisoning, allowing attackers to inject hidden instructions directly into the model weights.

The Attack Surface: Default Ollama Networking

Ollama, the popular framework for running LLMs locally, exposes an HTTP API by default on localhost:11434. The design assumes local-only access—a reasonable assumption for a developer's laptop. But in production infrastructure, the reality is messier. Teams running Ollama on a server, even one behind a corporate network, may expose that API more broadly than intended, or connect it to systems that also consume untrusted content.

The vulnerability discovered by Oasis Security hinges on a fundamental principle: if a user's browser can reach both an untrusted webpage and a local Ollama instance, the webpage can make requests to the model. No authentication is required. An attacker can craft a malicious site that, when visited by anyone on the network, sends carefully constructed prompts to the Ollama API to perform model fine-tuning or weight manipulation. Over time, or with a single well-crafted payload, the model's behaviour shifts—silently and invisibly to the end user.

Why This Matters for Infrastructure Teams

Model poisoning differs from traditional application exploitation. A compromised web server can be wiped and redeployed. A poisoned model is harder to detect and remediate. The attack modifies the weights themselves, not just the runtime environment. If someone is relying on that model for decision-making, classification, or content generation, the corruption persists unless the weights are explicitly restored or the model is retrained.

For organisations deploying Ollama in multi-tenant environments or on shared infrastructure, this is a serious consideration. A developer running a test workload on the same network as a production AI service creates an unexpected attack chain. Similarly, if your Ollama instance is accessible from a system that also runs a web browser or downloads user-supplied content, the risk is real.

Practical Hardening Strategies

The mitigation approach is familiar to anyone who has built secure infrastructure: network segmentation and authentication. First, never expose Ollama's API on 0.0.0.0 or across untrusted network boundaries. Bind it to 127.0.0.1 only, or use a local Unix socket if your infrastructure supports it.

If remote access to Ollama is necessary, route it through an authenticated proxy or API gateway. Require cryptographic authentication—either mutual TLS, API keys signed with strong algorithms, or both. This adds friction compared to a bare HTTP API, but it's the cost of operating the service safely in a networked environment.

Network isolation is the second layer. Ollama instances should run on segmented subnets with explicit firewall rules governing which systems can reach them. Zero-trust architecture applies here: assume every other system is potentially hostile unless proven otherwise.

Lastly, log all API requests to Ollama—both successful and failed. Model fine-tuning requests in particular should trigger alerts. If your model's behaviour unexpectedly changes, those logs become your forensic record.

Broader Lessons in Self-Hosted AI

This vulnerability is a reminder that self-hosting AI infrastructure does not mean a reduction in security responsibility. It shifts the responsibility from a vendor to your team. The infrastructure that runs these models must be treated with the same rigour as a payment processing system or a database server.

As more organisations experiment with local LLM deployments—whether for cost control, data residency, or privacy—the security model needs to mature accordingly. Default configurations optimised for developer convenience will not survive contact with real adversaries or even careless network design.

The attack surface for AI infrastructure is still being mapped. Teams deploying Ollama or similar frameworks should not assume that isolation by obscurity is enough. Explicit authentication, network segmentation, and monitoring are the foundations. Build your self-hosted AI stack with the same defensive posture you would apply to any other critical service.