Ollama has no login of its own. Anyone who can reach port 11434 can use your model and, on old versions, read the process memory. This guide locks down your GPU server in eight steps.
In short
- Update Ollama to 0.17.1 or newer. Older versions are vulnerable to Bleeding Llama (CVE-2026-7482).
- Bind Ollama to
127.0.0.1 and never set OLLAMA_HOST=0.0.0.0. If containers such as Odysseus need access, use the Docker bridge address.
- Block port 11434 with ufw and never publish it through Docker.
- Put Open WebUI behind Caddy with HTTPS and a login, or make it reachable over Tailscale only.
- If you need the API from outside, put an auth proxy with a token in front of it.
- Set up an alert for unusual GPU load and test from outside whether port 11434 is really closed.
Why this matters now#
Bleeding Llama is a memory leak in Ollama that can be exploited without authentication. The flaw is tracked as CVE-2026-7482 and has a CVSS score of 9.1. Three API calls are enough to pull parts of the process memory: prompts, system prompts and environment variables including API keys. It was discovered by Cyera and has been fixed since version 0.17.1.
The flaw meets a lot of open servers:
- One in three APIs answers. In a scan by Intruder, 31% of more than 5,200 directly queried Ollama APIs answered a test prompt without any access control. That is what the Cloud Security Alliance reports.
- Stolen compute goes on the attack. On June 12, 2026, Sysdig observed for the first time how an open Ollama server served as the "brain" of an automated attack chain. The attacker did not need a CVE for that. The open port was enough.
- Access gets sold. For "Operation Bizarre Bazaar", honeypots run by Pillar Security recorded about 35,000 attack sessions in roughly 40 days, some of them against unprotected Ollama instances on port 11434. The access was resold through the silver.inc marketplace.
The term for this is LLMjacking: someone else uses your GPU, and you pay the bill.
Prerequisites
- A GPU server running Ubuntu, for example an RTX 4000 Ada with 20 GB or an L4 with 24 GB
- Ollama installed as a systemd service and Open WebUI installed with Docker
- SSH access with sudo rights
- For Caddy: a domain that points to your server
Step 1: Check your version and update#
First check which version is running:
If it shows a version below 0.17.1, update right away. The install script only replaces the program. Your models stay in place.
If you run Ollama in a container, pull the new image and restart the container:
Update Open WebUI while you are at it. Versions up to 0.6.34 contain the flaw CVE-2025-64496 in the "Direct Connections" feature. It is fixed from 0.6.35 on.
Step 2: Bind Ollama to localhost#
After a normal install, Ollama only listens on 127.0.0.1:11434. That is safe. A server almost always becomes exposed through a change you made yourself.
Why OLLAMA_HOST=0.0.0.0 is the most common mistake#
Open WebUI runs in Docker and cannot reach the server's localhost. Many guides solve that with OLLAMA_HOST=0.0.0.0. Ollama then listens on every network interface, including the public IP. The clean solution is in step 4.
Check what Ollama is listening on right now:
| Output | Meaning |
|---|
127.0.0.1:11434 | Reachable locally only. This is what you want. |
0.0.0.0:11434 or *:11434 | Reachable on all IPv4 addresses. |
[::]:11434 | Reachable over IPv6 as well. |
Set the address explicitly instead of relying on the default:
Enter this in the editor:
Then reload and check:
Always use systemctl edit. Changes made directly in the ollama.service file are overwritten by the next update.
The same goes for Ollama in a container. Never publish the port with -p 11434:11434, only locally:
Special case: containers that reach Ollama through host.docker.internal#
Some interfaces run in a regular Docker network and talk to Ollama through host.docker.internal. Odysseus is one of them, with the endpoint http://host.docker.internal:11434/v1. These containers cannot reach an Ollama bound to 127.0.0.1. The usual shortcut is OLLAMA_HOST=0.0.0.0 again, and that puts the API on the internet.
Bind Ollama to the Docker bridge address instead. It is private and not reachable from outside. Here is how to find it:
It is usually 172.17.0.1. Enter it with sudo systemctl edit ollama:
The two lines under [Unit] make sure Ollama starts after Docker. The bridge does not exist before that.
With the firewall active, you have to allow the path from the container to the host. The rule only covers the private Docker networks:
Two things change as a result:
- The
ollama command on the server needs the address: OLLAMA_HOST=172.17.0.1:11434 ollama list.
- Open WebUI from step 4 gets
OLLAMA_BASE_URL=http://172.17.0.1:11434.
Stop starting Ollama by hand with ollama serve and only run it through the service. Otherwise the setting does not apply.
Step 3: Block port 11434 with ufw#
The firewall is your second layer. It protects you if someone changes the bind address again later. The basics are in our tutorial How to set up a firewall with ufw.
You only need ports 80 and 443 for Caddy. If you use Tailscale exclusively, leave them out.
Then check whether an old allow rule for 11434 exists, and delete it:
The 5 stands for the number of the rule in the list.
Watch out: Docker bypasses ufw#
A container port published with -p 3000:8080 is reachable from outside even if ufw does not allow it. Docker writes its own firewall rules, and they take effect before ufw. Always publish ports with 127.0.0.1: in front. More on that in Hardening Docker Containers.
Here is how to find open container ports:
Every line with 0.0.0.0: or [::]: is public.
Step 4: Open WebUI behind Caddy with a login#
Start Open WebUI in the host network. It then reaches Ollama through 127.0.0.1, and Ollama does not have to be opened up. Your chats and accounts live in the volume and survive recreating the container.
First generate a fixed key for the sessions and keep it somewhere safe:
What the settings do:
HOST=127.0.0.1 binds the interface to localhost. Only Caddy can still reach it.
WEBUI_SECRET_KEY keeps logins valid across container restarts. Without a fixed value, every new container generates a new key and everyone has to log in again.
- Leave
WEBUI_AUTH at its default. With WEBUI_AUTH=false there is no login anymore.
Check two settings in the interface afterwards. Open WebUI stores them in the database after the first start. On an existing installation, environment variables no longer change them.
- Close sign-ups: Create your admin account first. Then turn off new sign-ups in the Admin Panel under Settings, General.
- Keep Direct Connections off: The feature that contained CVE-2025-64496 is disabled by default. Check in the Admin Panel under Settings, Connections that it stays that way.
Check the binding:
Now put Caddy in front. The installation is covered in our tutorial Reverse proxy with Caddy. Add this to /etc/caddy/Caddyfile:
Caddy fetches the certificate on its own. The Open WebUI login is your access control. Use strong passwords and create new users yourself only.
An additional Basic Auth in front of Open WebUI often leads to login loops, because the interface uses the Authorization header itself. If you want a second layer, restrict access to fixed IP addresses:
Step 5: Alternative: access over Tailscale only#
If only your team needs access, Open WebUI does not have to be on the internet at all. With Tailscale, your server sits in a private network that only your devices can reach. The setup is covered in Secure your server with Tailscale.
Once the server is in the tailnet, share Open WebUI there:
The interface is now reachable at your server's ts.net address, with HTTPS and only for devices in your tailnet. Ports 80 and 443 stay closed in ufw.
This requires MagicDNS and HTTPS certificates to be enabled in your tailnet. If one of them is missing, the command prints a link where you can turn it on. You can see the status with tailscale serve status.
Do not confuse serve with funnel. The tailscale funnel command makes the service public.
Step 6: An auth proxy for the Ollama API#
Sometimes another application needs the API directly. Never open port 11434 for that. There are two safe ways.
Option 1: SSH tunnel. For individual developers this is all you need:
As long as the tunnel is up, you reach the API on your own machine at http://127.0.0.1:11434.
Option 2: Caddy as an auth proxy. For server-to-server access, Caddy checks a token before it passes the request on. Generate a token:
Add this to the Caddyfile:
Three things happen here:
- Without the right token, Caddy answers with 401. The request never reaches Ollama.
- The path list only allows inference. The endpoints
/api/create, /api/push and /api/blobs, which Bleeding Llama runs through, stay blocked from outside.
header_up Host is needed because an Ollama bound to localhost rejects foreign hostnames with 403.
Protect the file, because it now contains a secret:
Test both cases:
The first call must return 401, the second the model list.
Step 7: Logging and an alert for unusual GPU load#
A hijacked GPU gives itself away through load at times when nobody is working. You build this alert on the stack from our monitoring series: Part 1: Prometheus, Grafana and alerts and Part 2: Centralized logging with Loki.
Collect GPU metrics#
The stack from part 1 does not know about the GPU yet. Add an exporter to ~/monitoring/docker-compose.yml. It needs the NVIDIA Container Toolkit, which you know from Odysseus with GPU.
Add the exporter to prometheus/prometheus.yml as a new job:
Alert rules#
Add a second group to prometheus/alert-rules.yml:
The hour() function works in UTC. Adjust the hours and thresholds to your routine. If you run a batch job at night, move the time window.
You set up notifications by email or Telegram in part 1. They apply to the new rules as well.
Ollama logs in Loki#
As a systemd service, Ollama writes to the journal. If you enabled the optional journald section in part 2, the logs are already in Loki. Every request sits on one line with [GIN], including the IP address and path. Check the format once directly:
These three queries help you in Grafana:
All requests to the API. As a time series, you see right away when load builds up.
Requests that do not come from localhost. With an Ollama bound to localhost, this list stays empty. Every hit is a warning sign. In the special case from step 2, you will see the private addresses of your containers here. Then any address that does not start with 172. is suspicious.
Calls to the endpoints Bleeding Llama runs through. If you are not creating a model yourself right now, nothing should show up here. You can turn this query into its own alert rule in Grafana under Alerting.
Step 8: Self-test: is my server reachable from outside?#
Test from a different machine, not from the server itself. Use your laptop or your phone on mobile data.
| Result | Meaning |
|---|
| Timeout or "Connection refused" | The port is closed. Good. |
| JSON with a version number | Your Ollama API is open. Back to steps 2 and 3. |
| The Open WebUI login page | Port 8080 is open. Back to step 4. |
Test IPv6 too. Your server has its own IPv6 network, and many people forget about it:
A port scan shows all the typical ports at once:
All four should report filtered or closed. Only scan your own servers.
Finally, the view from inside:
Only SSH and, if you use Caddy, ports 80 and 443 should be listening publicly.
Optional: a VPS as an upstream reverse proxy#
You can take the GPU server off the public internet entirely. A small VPS then handles Caddy and HTTPS. The GPU server only sits in the tailnet and has no open port apart from SSH.
On the GPU server, share Open WebUI with tailscale serve as in step 5. On the VPS, which is in the same tailnet, Caddy forwards to it:
The benefit: scanners find nothing on your GPU server's IP. And you can harden or replace the proxy without touching the GPU machine.
If your server was exposed#
If port 11434 was reachable with a version before 0.17.1, assume data has leaked.
- Update Ollama and close the port (steps 1 to 3).
- Rotate every secret the Ollama process knew: API keys in environment variables, tokens, credentials for connected services.
- Use
ollama list to check whether models show up that you did not load.
- Search the logs for foreign access:
- If the prompts contained personal data, talk to your data protection officer about a possible notification obligation.
Problems?#
Open WebUI does not find any models. Check OLLAMA_BASE_URL. In the host network it must be http://127.0.0.1:11434. If you changed the address in the interface earlier, the value stored there applies. Correct it in the admin settings under Connections.
403 Forbidden behind the proxy. The Caddyfile is missing header_up Host 127.0.0.1:11434.
401 despite the right token. The header must be exactly Authorization: Bearer YOUR_TOKEN. Watch for spaces and line breaks in the token.
Port 8080 is open despite ufw. The container runs with -p instead of the host network. Restart it as in step 4.
The GPU exporter does not start. The NVIDIA Container Toolkit is usually missing. Use docker run --rm --gpus all ubuntu nvidia-smi to check whether Docker sees the GPU.
FAQ#
Am I safe if I only update?
No. The update closes Bleeding Llama. But an open API stays usable by anyone, even without a flaw. The Sysdig case did not involve a CVE at all.
Does Ollama have its own authentication?
No. The API has neither a password nor a token. The network provides the protection: localhost, firewall, proxy or VPN.
Is changing the port enough?
No. Scanners do not only check port 11434. A different port delays discovery by hours, nothing more.
Does this apply to vLLM as well?
Yes, in principle. A vLLM server also belongs on localhost and behind a proxy. vLLM at least comes with a simple token check through --api-key.
Does this affect me with Odysseus?
Yes, if Odysseus uses local models through Ollama. Odysseus talks to Ollama through host.docker.internal. If you started Ollama with OLLAMA_HOST=0.0.0.0 for that, your API is open. Switch to the Docker bridge as described in the special case in step 2, then run the self-test from step 8.
Next steps#
Start your GPU server securely
A dedicated NVIDIA GPU with no time-slicing, from German data centers, cancel monthly. Start with the RTX 4000 Ada (20 GB) or the L4 (24 GB), ready in minutes.
·
View L4 ·
All GPU servers