Skip to content
Threat Feed
medium advisory updated

Unauthenticated External Exposure of Ollama LLM API

Improper configuration of the Ollama LLM server can expose the API to the internet without authentication, enabling remote attackers to conduct model theft, prompt injection, and resource hijacking.

What's new

  • 1. OS windows; OS linux; OS macos Sep 19, 13:14 via elastic

The Ollama Large Language Model (LLM) server is designed to bind to localhost (127.0.0.1) by default, but it can be configured to listen on all interfaces via the OLLAMA_HOST environment variable. Because the Ollama API lacks built-in authentication, instances exposed to the internet are accessible to any remote user. Attackers are actively scanning for these exposed API endpoints on port 11434 to perform malicious operations. These operations include unauthorized model theft, malicious model injection, prompt injection to bypass safety controls, and hijacking compute resources for unauthorized inference tasks. Defenders must ensure that Ollama is either bound strictly to local interfaces or protected by a robust network-level authentication layer or firewall.

Impact

Successful exploitation allows unauthenticated attackers to interact with the LLM instance as if they were local users. This results in the potential exfiltration of proprietary or sensitive models, the integrity compromise of model weights, and the exhaustion of local compute resources due to illicit inference requests.

Recommendation

  • Immediately bind Ollama to the local interface by setting 'OLLAMA_HOST=127.0.0.1:11434' in the system environment configuration.
  • Implement firewall rules or network access control lists (NACLs) to block all inbound traffic on TCP port 11434 from non-trusted networks.
  • Deploy the provided detection rule to identify and alert on any active network connections to port 11434 originating from outside the organization's RFC1918 address space.
  • Audit the '~/.ollama/models/' directory for unexpected or unauthorized model files that may indicate previous compromise.

Immediate actions

Restrict OLLAMA_HOST to localhost and implement firewall blocks on port 11434

IT Operations 24h

Threat Hunt

Search network logs for any inbound connection to port 11434 from external IPs

T1133 high high confidence hunt now

Data: Network flow logs

Mitigations

Bind Ollama to 127.0.0.1

immediate IT Operations

Public-facing Ollama instances

Detection coverage 1

Detect Ollama API Access from External Network

medium

Detects network connections to the Ollama API port (11434) originating from non-local and non-internal IP address ranges, indicating potential unauthenticated external exposure.

sigma tactics: initial_access techniques: T1133, T1190 sources: network_connection

Detection queries are available on the platform. Get full rules →