In short
- Ollama's docs state it: the local API at
http://localhost:11434does not require authentication. There is no built-in password or key for a self-hosted server. - The default bind address is
127.0.0.1. The official Docker image setsOLLAMA_HOST=0.0.0.0:11434, and the documenteddocker runcommand publishes the port on every interface of the host. - The API is not read-only. It includes
POST /api/pull,DELETE /api/delete,POST /api/createandPOST /api/push, next to the chat and generate endpoints. - One request tells you whether yours is exposed: from another network, ask
/api/tagson your server's public address. A list of models means anyone can use it. - The fix is to bind to loopback or a private network, close the port in the firewall, and add a reverse proxy with a key if other machines need access.
On this page
- Does Ollama have authentication?
- Where Ollama listens by default, and how it ends up on the internet
- What an open Ollama gives a stranger
- Known vulnerabilities: why the version matters too
- How to check where yours listens
- How to put Ollama behind authentication
- What Keybrum tests on Ollama, and what it does not
- Questions
- Sources
Does Ollama have authentication?
No, not for a server you run yourself. Ollama is a tool for running language models on your own machine or server, with an HTTP API that apps call. Its documentation says that the local API at http://localhost:11434 does not require authentication. API keys exist only for Ollama's hosted cloud service at ollama.com. A self-hosted Ollama trusts every request that reaches its port.
That design is reasonable for a tool meant to run on a laptop. It becomes a problem the moment the port is reachable from somewhere else. Ollama security is therefore almost entirely a network question: where does port 11434 listen, and who can get to it?
Where Ollama listens by default, and how it ends up on the internet
Ollama's FAQ is clear about the default: "Ollama binds 127.0.0.1 port 11434 by default." On a regular install, only programs on the same machine can connect. Three common setups change that.
| Setup | Where it listens | Reachable from the internet? |
|---|---|---|
| Regular install on macOS, Windows or Linux | 127.0.0.1:11434 | No |
OLLAMA_HOST=0.0.0.0 set to reach it from another machine | Every interface | Yes, if the machine has a public address and the firewall allows the port |
Official Docker image, run with -p 11434:11434 | Every interface of the host | Yes, on a cloud server whose firewall allows the port |
Docker with -p 127.0.0.1:11434:11434 | Loopback of the host | No |
| Behind a tunnel or a reverse proxy with no access rule | A public domain | Yes, through the proxy |
The Docker case catches the most people. The image's Dockerfile contains ENV OLLAMA_HOST=0.0.0.0:11434, which a container needs in order to be reachable at all. The run command in Ollama's Docker documentation is docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama. With -p 11434:11434, Docker publishes the port on all of the host's addresses. On a laptop behind a home router, that stays private. On a rented GPU server with a public address, it is public.
Security firms have published several scans counting Ollama servers reachable from the public internet. Their counts differ with the date and the method, so we do not quote one. Wiz, whose researchers reported a vulnerability in Ollama in 2024, summed up the cause in two points: Ollama does not support authentication out of the box, and in Docker the server listens on 0.0.0.0 by default.
What an open Ollama gives a stranger
Ollama's API reference lists the endpoints. All of them are open to whoever reaches the port.
| Endpoint | What a stranger can do | What it costs you |
|---|---|---|
GET /api/tags, GET /api/ps, POST /api/show | List your models, see which are loaded, read their system prompts and parameters | Your setup and any custom instructions baked into a model |
POST /api/generate, POST /api/chat, POST /api/embed | Run their own prompts on your models | Your GPU, your electricity or your cloud bill, and slow answers for your app |
POST /api/pull | Download any model onto your disk | Disk space and bandwidth, until the disk is full |
DELETE /api/delete | Remove the models your app depends on | An outage |
POST /api/create, POST /api/copy | Create a model under a name your app calls | Answers shaped by someone else's system prompt |
The row about create deserves a second look. If your app asks for a model by name and a stranger can delete that model and create another under the same name, they control what your users are told. That is a quiet form of the poisoning risk in the OWASP LLM Top 10.
The chat interfaces people put in front of Ollama store conversations. An Open WebUI next to your Ollama, left without its first administrator account, hands them to the first visitor who signs up.
Known vulnerabilities: why the version matters too
An open port is the main risk, and it makes every software bug reachable. These advisories are in the GitHub Advisory Database for Ollama.
| Advisory | What it is | Fixed in |
|---|---|---|
| CVE-2024-28224 | DNS rebinding: a web page could reach the API of an Ollama bound to localhost, and chat with or delete models | 0.1.29 |
| CVE-2024-37032 | The digest of a model was not validated when building a file path. Wiz, which reported it, named it Probllama and described remote code execution | 0.1.34 |
| CVE-2024-45436 | A ZIP archive could be extracted outside its parent directory | 0.1.47 |
| CVE-2026-7482 | Heap out-of-bounds read in the GGUF model loader, CVSS 9.1 | 0.17.1 |
| CVE-2025-63389 | A record describing the API's missing authentication for model management | No fixed version listed: the fix is to restrict access to the port |
The first line matters even if you never expose anything. It shows that a service on localhost is not automatically out of reach of a browser. Keep Ollama updated on laptops as well as on servers.
How to check where yours listens
- 1
Look at the listening socket
On the machine that runs Ollama, list what listens on port 11434.
127.0.0.1or::1is local only.0.0.0.0,*or::means every interface. - 2
Look at how Docker published it
If Ollama runs in a container, list the published ports.
0.0.0.0:11434in front of the arrow means all addresses of the host. - 3
Look at the environment
Check whether
OLLAMA_HOSTis set in the service. On Linux with systemd, the override file shows it. - 4
Test from outside
From another network, such as your phone's connection, ask your server's public address for
/api/tags. No answer is what you want. A JSON list of models means it is open. - 5
Check the proxy or tunnel
If a domain or a tunnel points at Ollama, run the same request against that address with no credentials.
# On the machine that runs Ollama (Linux)
ss -ltnp | grep 11434
systemctl show ollama --property=Environment
# In Docker
docker ps --format '{{.Names}} {{.Ports}}' | grep 11434
# From ANOTHER network, against YOUR OWN server's public address
curl -s --max-time 5 http://YOUR_PUBLIC_IP:11434/api/tagslsof -iTCP:11434 -sTCP:LISTEN for the first check.How to put Ollama behind authentication
Start by taking it off the network. Then add back only the access you need.
1. Bind to loopback
# Linux with systemd: sudo systemctl edit ollama.service, then add
[Service]
Environment="OLLAMA_HOST=127.0.0.1:11434"
# then
sudo systemctl daemon-reload
sudo systemctl restart ollama
# Docker: publish on the host's loopback only
docker run -d -v ollama:/root/.ollama -p 127.0.0.1:11434:11434 --name ollama ollama/ollama2. Close the port
In your cloud provider's firewall or security group, remove any rule that allows port 11434 from the internet. Do it even after binding to loopback: the next reinstall may undo the bind.
3. If other machines need it, add a key in front
Ollama's FAQ shows how to place it behind Nginx. Add a check that Ollama does not have: a key in the Authorization header, over HTTPS. Clients that speak the OpenAI-compatible API already send an Authorization: Bearer header, so they work with this unchanged.
server {
listen 443 ssl;
server_name ollama.your-domain.example;
# ssl_certificate and ssl_certificate_key go here
location / {
if ($http_authorization != "Bearer REPLACE_WITH_A_LONG_RANDOM_KEY") {
return 401;
}
proxy_pass http://127.0.0.1:11434;
proxy_set_header Host localhost:11434;
}
}proxy_pass and Host lines come from Ollama's FAQ. The key check is ours. Keep the key in server-side secrets, never in JavaScript sent to a browser.A private network does the same job with less to maintain: Tailscale or WireGuard between your app server and the model server, with Ollama listening only on the private address. Whichever you choose, your app talks to Ollama from its server. A browser should never call Ollama directly, for the same reason a provider key does not belong in the frontend: see API keys exposed in the frontend.
ssorlsofshows port 11434 on127.0.0.1or a private address only- The request to
/api/tagsfrom another network gets no answer - The cloud firewall has no rule for port 11434
- Any proxy or tunnel in front asks for a key and uses HTTPS
OLLAMA_ORIGINSis not set to*- Ollama is on a recent release
- The app's own AI route checks a session before it calls the model
The last line is the other way an Ollama gets used by strangers. A locked-down model server behind an app route that answers anyone is still free compute for the internet. That case is covered in unprotected AI endpoints.
What Keybrum tests on Ollama, and what it does not
Keybrum is the automated pentest we build for apps made with AI tools. For an owner who proved ownership, it looks at the server behind the app. There it asks port 11434 one question with no credentials: GET /api/tags. It asks the same on the app's own address, in case the address you verified is the model server. If Ollama answers with its list of models, that is a finding rated high, with the number of models and the request to replay. No prompt is sent. Nothing is pulled, created or deleted.
The same pass asks three neighbours the same kind of question: model servers that speak the OpenAI API (LiteLLM, vLLM, LocalAI, LM Studio, llama.cpp) on their usual ports, Open WebUI for a missing administrator account or sign-in turned off, and n8n for a missing owner account.
What it does not do: it does not look for Ollama on a port other than 11434 on the server, it does not match your Ollama version against the advisories above, and it does not test a proxy's key for strength. Hosted Keybrum never attacks private networks, so an Ollama that is reachable only from your own network is not seen, which is the goal. A one-time report costs €49 for one app. Plans start at €29 a month excluding VAT and attack again on every deploy. The wider view of what a stranger sees is in external penetration testing.
Questions
Is Ollama safe to use?
On a regular install, yes for most uses: it listens only on your own machine. The risk appears when the port is opened to a network, because the API has no authentication. Keep it on loopback or a private network, and keep it updated.
What port does Ollama use?
Port 11434. Ollama's FAQ says it binds 127.0.0.1 port 11434 by default. The bind address is changed with the OLLAMA_HOST environment variable.
How do I know if my Ollama is exposed to the internet?
From a different network, request http://your-public-address:11434/api/tags. If you get a JSON list of models, anyone can reach it. On the server, ss -ltnp | grep 11434 shows whether it listens on 127.0.0.1 or on every interface.
Can I add an API key to Ollama?
Not in Ollama itself for a self-hosted server. Put a reverse proxy such as Nginx or Caddy in front, have it require a key or basic authentication over HTTPS, and bind Ollama to loopback so the proxy is the only way in.
Is it safe to set OLLAMA_HOST to 0.0.0.0?
Only on a machine whose network you control, such as inside a private network or a container that does not publish the port publicly. On a server with a public address it puts an unauthenticated API on the internet unless a firewall blocks the port.
Does Ollama send my prompts to the cloud?
Ollama's FAQ says that it runs locally and that the company does not see your prompts or data when you run locally. That changes only if you use its cloud-hosted models, which is a separate, signed-in feature.
Sources
- 1.FAQ: How can I expose Ollama on my network? How can I use Ollama with a proxy server?, Ollama Docs
- 2.Authentication, Ollama Docs
- 3.API reference (docs/api.md), GitHub, ollama/ollama
- 4.Dockerfile of the official image, GitHub, ollama/ollama
- 5.Probllama: Ollama Remote Code Execution Vulnerability (CVE-2024-37032), Wiz Research
- 6.GHSA-5jx5-hqx5-2vrj: Ollama DNS rebinding vulnerability (CVE-2024-28224), GitHub Advisory Database
- 7.GHSA-x8qc-fggm-mpqg: heap out-of-bounds read in the GGUF model loader (CVE-2026-7482), GitHub Advisory Database