OpenClaw Gateway Exposed to Public Internet — Critical Security Fix (2026)
Your OpenClaw gateway may be exposed to the public internet. Learn how to secure it with firewall rules, bind to localhost, and use a reverse proxy.
Why This Is Critical
By default, OpenClaw binds to 0.0.0.0, which means it listens on all network interfaces — including your public IP. If your server has no firewall, anyone on the internet can access your OpenClaw instance, use your AI agent, and potentially rack up hundreds of dollars in API costs.
Immediate Fix: Bind to Localhost
1. Update openclaw.json
{
"host": "127.0.0.1",
"port": 3000
}2. Or Use Environment Variable
OPENCLAW_HOST=127.0.0.1 openclaw start3. Docker: Don't Expose the Port Publicly
services:
openclaw:
image: ghcr.io/openclaw/openclaw:latest
ports:
# WRONG: exposes to all interfaces
# - "3000:3000"
# RIGHT: only accessible from localhost
- "127.0.0.1:3000:3000"Add Firewall Rules
UFW (Ubuntu/Debian)
# Block external access to OpenClaw port
sudo ufw deny 3000
# Allow only from specific IP
sudo ufw allow from 10.0.0.0/8 to any port 3000Cloud Security Groups (AWS/GCP/Azure)
Remove any inbound rules that allow traffic on port 3000 from 0.0.0.0/0. Only allow access from your application server's private IP or security group.
Use a Reverse Proxy with Authentication
For external access, place Nginx or Caddy in front of OpenClaw with basic auth or SSO. See our reverse proxy setup guide.
Frequently Asked Questions
How do I know if my OpenClaw instance is publicly exposed?
Try accessing your server IP on the OpenClaw port from an external network (e.g., your phone on mobile data). If you can reach the OpenClaw interface without a VPN, it is publicly exposed. You can also use tools like shodan.io to check.
What are the risks of an exposed OpenClaw gateway?
An exposed gateway allows anyone to interact with your AI agent, potentially running up API costs, accessing sensitive data, or using your agent for malicious purposes. It can also expose your API keys and internal configuration.
Should I use a firewall or bind to localhost?
Both. Bind OpenClaw to 127.0.0.1 so it only accepts local connections, then use a reverse proxy (Nginx/Caddy) with authentication for external access. Add firewall rules as a secondary defense layer.
Can I restrict access to specific IP addresses?
Yes. Configure your firewall (ufw, iptables, or cloud security groups) to only allow connections from specific IP ranges. This is called IP whitelisting and adds an extra layer of security.
Is OpenClaw safe to run on a home network?
Only if your router does not have port forwarding enabled for the OpenClaw port. Most home routers block incoming connections by default, but if you set up port forwarding for remote access, you must add authentication and HTTPS.