SaferComputing.com

Reference · Local AI servers

Open WebUI on ports 3000 and 8080: sign-ups, secret key and Docker binding

Harden Open WebUI on ports 3000 and 8080: publish it on 127.0.0.1 instead of 0.0.0.0, find exposed containers with docker ps, turn off sign-ups, set WEBUI_SECRET_KEY and keep the first administrator account yours.

Published
Updated
Last checked
Applies to
Open WebUI in Docker on Linux, Windows and macOS
Technical specification
Target artifactThe Open WebUI web interface: port 8080 inside the container, published on host port 3000 in its documentation.
Default behaviourThe documented -p 3000:8080 publishes the interface on every host address. Until the first account is created, anyone who reaches the page can sign up, and that first account becomes the administrator; since version 0.8.4, sign-up then closes by itself.
Safe statePublished as 127.0.0.1:3000->8080/tcp; your own administrator account created first; new sign-ups off; new accounts left in the pending role; your own WEBUI_SECRET_KEY set; version 0.9.0 or later.
Check on Linuxdocker ps --format 'table {{.Names}}\t{{.Ports}}'
Check on WindowsGet-NetTCPConnection -State Listen -LocalPort 3000, 8080 | Select-Object LocalAddress, LocalPort, OwningProcess
Check on macOSsudo lsof -nP -iTCP -sTCP:LISTEN | grep -E ':(3000|8080) '
Check from another devicecurl --max-time 5 -I http://SERVER_IP:3000/
Fix in Dockerrecreate the container with -p 127.0.0.1:3000:8080 instead of -p 3000:8080

Read the result

docker ps port columnMeaning
127.0.0.1:3000->8080/tcpOnly this computer can open the interface
0.0.0.0:3000->8080/tcp or [::]:3000->8080/tcpEvery host address: anyone who can reach the computer can open the sign-in page
8080/tcp with no arrowNot published on the host; other containers on the same Docker network can still reach it

A sign-in page is not harmless: while no account exists, whoever registers first becomes the administrator, and if an administrator turns sign-ups back on, anyone can create an account and wait for approval.

Publish it on 127.0.0.1

Docker run command

This is the command from Open WebUI's documentation with 127.0.0.1: added in front of the published port and without its -e WEBUI_SECRET_KEY=your-secret-key option; to set your own key, see Accounts and the secret key. The named volume keeps your accounts and chats:

Linux, as a user in the docker group
docker stop open-webui && docker rm open-webui
docker run -d -p 127.0.0.1:3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main

Docker Desktop on Windows and macOS uses the same flags.

Docker Compose

In the ports list of the Open WebUI service, put the address in front of the host port, then run docker compose up -d:

Lines in docker-compose.yml
    ports:
      - "127.0.0.1:3000:8080"
Reaching it from another computer

Do not publish it on 0.0.0.0 to reach it from a laptop. Forward the port over SSH instead, so nothing new listens on the server's network interfaces:

Your laptop
ssh -N -L 3000:127.0.0.1:3000 USER@AI_SERVER

While the tunnel runs, http://127.0.0.1:3000 on the laptop opens the server's Open WebUI.

Accounts and the secret key

  1. Open http://127.0.0.1:3000 and create your own account straight away; it becomes the administrator.
  2. Check in the Admin Panel that new sign-ups are off: Open WebUI's hardening guide says sign-up closes by itself after the first account, which the project changed in version 0.8.4. The ENABLE_SIGNUP variable is read only at first launch; after that, the value saved in the Admin Panel wins, so changing the variable later does nothing.
  3. Leave DEFAULT_USER_ROLE at its default, pending, so any new account needs your approval.
  4. Set your own WEBUI_SECRET_KEY. It signs the tokens that keep people signed in.
Setting WEBUI_SECRET_KEY

If you set no key, the container generates one and keeps it at /app/backend/.webui_secret_key, outside the /app/backend/data volume, so it may not survive the container being recreated. Generate a key once and pass it in:

Linux or macOS terminal
openssl rand -base64 32

Add -e WEBUI_SECRET_KEY=YOUR_KEY to the docker run command, or put the line WEBUI_SECRET_KEY=YOUR_KEY in a file readable only by you and pass it with --env-file, which keeps the key out of your shell history. Changing the key later signs everyone out.

Troubleshooting

docker ps shows 127.0.0.1, but another device still connects
  • A reverse proxy such as nginx, Caddy or Traefik publishes the interface on its own port. Check its configuration.
  • Another container publishes the same interface; list them all with docker ps -a.
  • On Docker Engine older than 28.0.0, hosts on the same local network segment could reach ports published to 127.0.0.1. Check with docker version and update.
The firewall should have blocked it

Ports published by Docker are routed before UFW or firewalld rules see them. See Docker published ports bypass UFW.

Which version is safe

CVE-2025-64496 let a malicious "Direct Connections" model server run JavaScript in a user's browser and steal their token. It is fixed in Open WebUI 0.6.35, and Direct Connections is off by default. Open WebUI's page on first-run administrator promotion says two sign-ups arriving together could both become administrators, and that version 0.9.0, the fix for advisory GHSA-h3ww-q6xx-w7x3 (CVE-2026-45675), removed that outcome. Pull the current image with docker pull ghcr.io/open-webui/open-webui:main, then recreate the container.

Sources