Your OpenClaw gateway, which listens on port 18789 by default, should be reachable only from your own machine or a private network you control. If it is reachable from the internet, a stranger may be able to talk to your agent and everything it can touch. This guide shows how to check your own setup with OpenClaw's built-in tools, and what to do if you find a problem.

Only test systems you own or administer. Scanning other people's addresses can break the law and your provider's terms.

Why does this matter?

  1. Censys counts 21,639 OpenClaw instances exposed to the internet
  2. SecurityScorecard STRIKE reports 40,000+ found in its first 24 hours of scanning

Tens of thousands of OpenClaw gateways were found exposed in early 2026, and by some scans more than 135,000 (SecurityScorecard). Figures above 220,000 appear only in later secondary reports. An exposed gateway with a weak or missing token can let someone send your agent instructions, read its output or use its tools. Combined with unpatched flaws such as CVE-2026-25253 (one-click remote code execution, now patched), the risk is significant.

How do gateways end up exposed?

On a regular host, gateway.bind defaults to "loopback", so OpenClaw is private out of the box. The network exposure docs explain the common ways that changes:

  • Containers. In a detected container, the default is "auto", which resolves to 0.0.0.0, meaning all interfaces.
  • Docker-published ports. Publishing 18789 bypasses the host's normal INPUT firewall rules.
  • Convenience binds. Setting "lan", "tailnet" or "custom" to reach the gateway from another device.
  • Router port forwarding or a cloud server with an open security group.
  • Public tunnels, such as Tailscale Funnel, pointed at the gateway.

How do you check your own gateway?

  1. Check the bind settingOpen ~/.openclaw/openclaw.json and confirm gateway.bind is "loopback", or that auth and a firewall are in place for any other bind.
  2. Run the built-in auditRun openclaw security audit --deep and fix anything marked critical or warning.
  3. See what is listeningConfirm port 18789 is bound to 127.0.0.1, not 0.0.0.0 or a public address.
  4. Check Docker and the routerLook for published ports, DOCKER-USER rules, port forwards and tunnels.
  5. Test from outsideFrom a different network, test only your own public IP to confirm nothing answers.

Step 1 and 2: config and audit

The exposure runbook starts with these baseline checks:

openclaw doctor
openclaw security audit
openclaw security audit --deep
openclaw health

The audit flags a blank gateway token as critical and a token under 24 characters as a warning. You can confirm the gateway answers locally with your token:

openclaw gateway probe --url ws://127.0.0.1:18789 --token "$OPENCLAW_GATEWAY_TOKEN"

Step 3: what is listening

On macOS, lsof -nP -iTCP:18789 -sTCP:LISTEN shows the listening address. On Linux, use ss -ltnp | grep 18789. You want to see 127.0.0.1:18789 (or [::1]). 0.0.0.0:18789 or *:18789 means every network interface, which needs a firewall in front of it.

Step 4: Docker, router and tunnels

If you run OpenClaw in Docker, published ports skip the host's INPUT chain. The docs say to place restrictions in the DOCKER-USER chain and verify them with iptables -S DOCKER-USER. Also check your router's port-forwarding page, your cloud provider's firewall or security group, and whether any Tailscale Funnel or similar public tunnel is running.

While you are there, check whether the gateway advertises itself on your local network. OpenClaw broadcasts _openclaw-gw._tcp over mDNS unless you set discovery.mdns.mode to "minimal" or "off", or set OPENCLAW_DISABLE_BONJOUR=1.

Step 5: test from outside

From a different network, such as a phone hotspot, the docs suggest a full TCP scan of your own public IP:

nmap -sT -p 1-65535 <your-public-ip> --open

If 18789 appears as open, the gateway is reachable from the internet. Run this only against an address you own.

What if your gateway is exposed?

Act in this order. The baseline below follows the exposure runbook:

Step What to change
Close the door Set gateway.bind: "loopback"
Stop strangers messaging Set dmPolicy: "disabled" on each channel temporarily
Stop commands Set tools.exec: { security: "deny", ask: "always" } and tools.elevated.enabled: false
Remove the route Remove router port forwards, Docker-published ports and any Funnel or public tunnel
Replace the keys Rotate the gateway token and every API key, bot token and password the agent held
Tighten allowlists Remove "*" from allowlists and gateway.controlUi.allowedOrigins
Investigate Review gateway logs, session history and connected accounts for activity you did not start
Confirm Re-run openclaw security audit --deep and the outside test

As of November 2026.

Our guides to revoking AI agent access and auditing your agent's activity log help with the investigation step.

How do you keep it private for good?

Use Tailscale Serve or an SSH tunnel for remote access instead of LAN binds or port forwarding, as the docs recommend. Set a long random token, turn on the sandbox and keep OpenClaw updated. Our OpenClaw security hardening checklist covers the full set, and OpenClaw sandbox and exec approvals limits the damage if something does get through. Installation basics are on getpersonalaiagents.com.

Bottom line

Checking takes about ten minutes: confirm the bind, run the deep audit, see what is listening, check Docker and the router, and test your own IP from outside. If anything answers on 18789 from the internet, lock it down, rotate every key and review the logs before turning the agent back on. Then decide whether you want to keep maintaining a server; is self-hosting an AI agent safe weighs that choice.