VPS Security Risks: What Could Go Wrong

February 24, 2026 ยท View on GitHub

In Plain English: Running OpenClaw on a VPS (Virtual Private Server) is like renting an apartment in a shared building. You have your own space, but you share walls with neighbors, the building has a front door that faces the street, and the landlord has master keys.

Time to read: 15 minutes Difficulty: Beginner-friendly with technical context for each risk


Key Difference from Mac Mini

AspectMac MiniVPS
Who can reach itOnly people on your WiFiAnyone on the internet (if firewall misconfigured)
Who else uses the hardwareJust youOther VPS customers on same physical server
Physical securityYou control itDatacenter controls it
Recovery if compromisedWipe and restoreOften: destroy and rebuild entirely
Default exposureBehind router NATPublic IP, directly addressable

A. Network Exposure (The Big Risk)

๐Ÿ”ด The "Front Door on the Street" Problem

The Analogy: Your Mac Mini's front door faces your living room (private). Your VPS's front door faces a busy street (the entire internet). If you forget to lock it, ANYONE in the world can walk in.

This Is The #1 VPS Risk.

What Actually Happens (Step by Step):

  1. You spin up a VPS with a public IP address (e.g., 203.0.113.55)
  2. You install OpenClaw and start the gateway
  3. You configure gateway.bind = "lan" (mistake!) or forget to set it
  4. Gateway binds to 0.0.0.0:18789 (all interfaces, including public)
  5. You forget to set gateway.auth.token (another mistake!)
  6. Result: http://203.0.113.55:18789 is accessible to ANYONE
  7. Attackers scanning the internet find your gateway within hours
  8. They can send messages, run commands, access all your channels

Why This Is Critical: Unlike your home network (which has a router/firewall), a VPS often has a PUBLIC IP address directly accessible from the internet. Every open port is a door that anyone can try to open.

How to Check If You're Exposed:

From your local machine (not the VPS):

# Try to connect to your VPS gateway port
curl http://YOUR_VPS_IP:18789/health

# If this returns anything, you're exposed!
# It should timeout or refuse connection

How to Fix It:

# On your VPS, configure firewall to block external access
sudo ufw deny 18789

# OR configure gateway for loopback only
openclaw config set gateway.bind loopback

# AND always set an auth token
openclaw config set gateway.auth.token "$(openssl rand -hex 32)"

๐Ÿ”ด The 1-Click Image Risk

The Analogy: A pre-furnished apartment is convenient, but did the previous tenant leave a spare key under the mat?

What Actually Happens:

  1. You deploy using a "1-Click Deploy" image (DigitalOcean, etc.)
  2. The image may have default configurations that are too permissive
  3. Default firewall rules may allow more than you expect
  4. Default credentials may exist that you forgot to change

Risk Factors in Pre-Built Images:

FactorRiskWhat to Check
Default SSH keysSomeone else has accesscat ~/.ssh/authorized_keys
Default passwordsBrute-forceableChange immediately
Permissive firewallPorts opensudo ufw status
Pre-installed servicesExtra attack surfacesystemctl list-units

The Fix (Post 1-Click Deploy):

# 1. Change default passwords immediately
passwd

# 2. Remove any pre-configured SSH keys you don't recognize
nano ~/.ssh/authorized_keys

# 3. Review and tighten firewall
sudo ufw status
sudo ufw default deny incoming
sudo ufw allow ssh
sudo ufw enable

# 4. Run security audit
openclaw security audit --deep

Note: The DigitalOcean 1-Click Deploy for OpenClaw automatically applies security hardening, making it safer than generic images.

๐ŸŸ  The Firewall Gap Window

The Analogy: Between unlocking your front door and setting the alarm, there's a window where you're vulnerable.

What Actually Happens:

  1. You start the gateway before configuring the firewall
  2. For those few seconds/minutes, the port is open to the world
  3. Automated scanners may find and probe it
  4. Even if you close the port later, the attacker may already have access

The Fix:

# ALWAYS configure firewall BEFORE starting any services
sudo ufw default deny incoming
sudo ufw allow ssh
sudo ufw enable

# THEN start the gateway
openclaw gateway run

B. Multi-Tenant Risks

๐ŸŸก The "Shared Building" Problem

The Analogy: Your VPS runs on a physical server that hosts many other customers' VPS instances. It's like living in an apartment building - you have your own space, but you share the physical infrastructure.

What This Means:

  • Your VPS is a "virtual machine" running on a physical server
  • Other customers have VPS instances on the same physical hardware
  • In rare cases, vulnerabilities allow "neighbors" to peek into your data
  • This is called a "side-channel attack" (e.g., Spectre, Meltdown)

Practical Risk Level: ๐ŸŸก Low-Medium

Most cloud providers patch these quickly, but nation-state attackers or sophisticated hackers could exploit these vulnerabilities.

What You Can Do:

  • Choose reputable cloud providers (AWS, DigitalOcean, Hetzner)
  • Keep your VPS kernel updated: sudo apt update && sudo apt upgrade
  • Consider dedicated instances for highly sensitive workloads

๐ŸŸก Environment Variable Exposure

The Analogy: If you leave your passwords on a sticky note on your desk, anyone who sits at your desk can see them.

What Actually Happens:

  1. You store API keys in environment variables (standard practice)
  2. Other processes running as the same user can read your environment
  3. If attacker gets ANY code execution as your user, they can read all env vars

Technical Detail:

# Any process as same user can read your environment
cat /proc/$(pgrep -f "openclaw gateway")/environ | tr '\0' '\n'

The Fix:

  • Use a dedicated user for OpenClaw
  • Never run untrusted code on your VPS
  • Consider using a secrets manager for highly sensitive deployments

C. Credential Storage Vulnerabilities

๐ŸŸ  The "Plaintext Secrets" Problem

The Analogy: Imagine writing all your passwords on sticky notes and keeping them in an unlocked drawer. Anyone with access to the drawer can read them. OpenClaw stores credentials the same way - as plain text files.

Where Your Secrets Live:

~/.openclaw/
โ”œโ”€โ”€ openclaw.json          โ† May contain API keys
โ”œโ”€โ”€ credentials/
โ”‚   โ”œโ”€โ”€ telegram-*.json    โ† Bot tokens
โ”‚   โ”œโ”€โ”€ discord-*.json     โ† Bot tokens
โ”‚   โ””โ”€โ”€ whatsapp/          โ† Session credentials
โ””โ”€โ”€ agents/*/agent/
    โ””โ”€โ”€ auth-profiles.json โ† ALL your API keys

There Is NO Encryption:

These files are protected ONLY by Unix file permissions (0o600/0o700). If an attacker gets root access, they can read everything.

Common Permission Mistakes:

# WRONG: This lets everyone read your secrets
chmod -R 755 ~/.openclaw/

# RIGHT: Only you can read/write
chmod 700 ~/.openclaw
chmod 700 ~/.openclaw/credentials
chmod 600 ~/.openclaw/openclaw.json
chmod 600 ~/.openclaw/credentials/*

Verify Permissions:

ls -la ~/.openclaw/
# Should show: drwx------ (700 for directories)

ls -la ~/.openclaw/credentials/
# Should show: -rw------- (600 for files)

๐ŸŸ  SSH Key Compromise

The Analogy: If someone gets your house key, they can come back anytime they want.

What Actually Happens:

  1. You use SSH key authentication (good practice!)
  2. Your private key is stored on your local machine
  3. If your local machine is compromised, attacker gets SSH access to VPS
  4. Once on VPS, they have access to all OpenClaw credentials

The Fix:

  • Use SSH keys with passphrases
  • Use ssh-agent with timeouts
  • Consider hardware security keys (YubiKey) for SSH
  • Enable 2FA for VPS console access

D. Container and Isolation Risks

๐ŸŸ  Docker Escape (If Using Containers)

The Analogy: The "secure room" in your apartment has a hidden door to the hallway.

What Actually Happens:

  1. You run OpenClaw in Docker for isolation (good idea!)
  2. But you run with --privileged or mount sensitive paths
  3. Attacker exploits a vulnerability to escape the container
  4. Now they're on the host system with full access

Dangerous Docker Flags:

FlagWhy It's Dangerous
--privilegedContainer has nearly host-level access
-v /:/hostContainer can read/write entire host filesystem
--pid=hostContainer can see all host processes
--network=hostNo network isolation

Safe Docker Configuration:

# Run with minimal privileges
docker run \
  --security-opt no-new-privileges \
  --cap-drop ALL \
  --read-only \
  -v ~/.openclaw:/data \
  openclaw/gateway

E. Persistence Attacks

๐ŸŸ  The "Hidden Backdoor" Problem

The Analogy: After a break-in, the burglar leaves a copy of your key hidden outside, so they can come back whenever they want.

What Actually Happens (If VPS Is Compromised):

  1. Attacker gets initial access (exposed gateway, SSH compromise, etc.)
  2. They install "persistence" mechanisms to maintain access
  3. Even if you change passwords, they can still get back in
  4. These backdoors are designed to be hidden

Common Persistence Mechanisms:

MechanismWhere to Check
Cron jobscrontab -l and /etc/cron.*
SSH authorized_keys~/.ssh/authorized_keys
Systemd servicessystemctl list-units
Modified binariesdebsums -c (if Debian/Ubuntu)
Login scripts~/.bashrc, ~/.profile, /etc/profile.d/

If You Suspect Compromise:

# Check for suspicious cron jobs
crontab -l
cat /etc/cron.d/*

# Check for unknown SSH keys
cat ~/.ssh/authorized_keys

# Check for suspicious systemd services
systemctl list-units --type=service --state=running

# Check recently modified system files
find /usr/bin -mtime -7 -ls

Important: If a VPS is compromised, the safest approach is usually to destroy it and rebuild from scratch rather than trying to clean it.


F. 1-Click VPS Specific Risks

๐ŸŸก DigitalOcean Metadata API

The Analogy: There's a secret phone number in your apartment that, if called, reveals your building's security codes.

What Actually Happens:

  1. Cloud providers expose a metadata service at 169.254.169.254
  2. This service returns information about your VPS
  3. If attacker can make requests from your VPS, they might access this
  4. Metadata may include API tokens, SSH keys, or other secrets

The Risk:

If prompt injection convinces the agent to make a curl request:

curl http://169.254.169.254/metadata/v1/

This could expose cloud provider credentials.

The Fix:

  • Block metadata access from inside containers
  • Use iptables to block 169.254.0.0/16 from non-root users
sudo iptables -A OUTPUT -m owner ! --uid-owner root -d 169.254.0.0/16 -j DROP

See also: Prompt Injection Attacks -- 30 examples of how attackers craft the messages that could trigger metadata exfiltration.


G. Worst-Case Damage Assessment

๐Ÿ’€ How Bad Could It Get?

ScenarioWhat HappensHow to Recover
๐Ÿ”ด Gateway internet-exposed + no authAnyone finds it, runs commands, joins your bot to botnetsDESTROY the VPS, rotate everything
๐Ÿ”ด Root compromiseAttacker has full control, may install persistent backdoorsForensics (if needed), then destroy VPS and rebuild
๐ŸŸ  API key theftAttacker uses your keys for their own AI usage (you pay the bill)Rotate all keys, set up billing alerts
๐ŸŸ  SSH key compromiseAttacker can return anytimeRegenerate SSH keys, check all machines that used them
๐Ÿ”ด TOS violation โ†’ account suspensionALL your VPS instances on that provider are terminated, including unrelated production servicesUse a separate provider/account for OpenClaw; rebuild on different provider

VPS Recovery Is Different:

Unlike a Mac Mini where you might try to "clean" the infection, a compromised VPS should usually be destroyed and rebuilt from scratch. Attackers often install hidden backdoors that are very hard to find.

Recovery Checklist

If you suspect VPS compromise:

  • Take a snapshot for forensics (optional, if you need evidence)
  • Destroy/delete the compromised VPS instance
  • Rotate ALL API keys and tokens
    • Anthropic API key
    • OpenAI API key
    • Telegram bot token
    • Discord bot token
    • Any other connected services
  • Create a NEW VPS instance
  • Apply security configuration BEFORE starting services:
    # Firewall first
    sudo ufw default deny incoming
    sudo ufw allow ssh
    sudo ufw enable
    
    # Then configure OpenClaw
    openclaw config set gateway.bind loopback
    openclaw config set gateway.auth.token "$(openssl rand -hex 32)"
    
    # Then start gateway
    openclaw gateway run
    
  • Run security audit:
    openclaw security audit --deep
    

H. Prevention Checklist

Before You Deploy

  • Choose a reputable cloud provider
  • Use SSH key authentication (not passwords)
  • Set up firewall rules BEFORE starting any services
  • Use a dedicated user for OpenClaw (not root)
  • Consider DigitalOcean 1-Click Deploy for automatic hardening

Firewall Configuration

# Default deny all incoming
sudo ufw default deny incoming
sudo ufw default allow outgoing

# Allow only SSH
sudo ufw allow ssh

# Enable firewall
sudo ufw enable

# DO NOT allow 18789 from public internet
# Access via SSH tunnel instead

SSH Access Pattern

# From your local machine, create SSH tunnel
ssh -N -L 18789:127.0.0.1:18789 user@your-vps

# Then access dashboard at
# http://127.0.0.1:18789

After You Deploy

  • Verify gateway binds to localhost only
  • Verify auth token is set
  • Verify firewall blocks port 18789 externally
  • Set up automatic security updates
  • Configure log rotation
  • Set up billing alerts for cloud resources

Ongoing

  • Keep system updated: sudo apt update && sudo apt upgrade
  • Review SSH access logs: sudo journalctl -u sshd
  • Run security audit monthly: openclaw security audit
  • Monitor for unusual network activity
  • Review cloud provider security advisories

I. Account-Level Blast Radius

The "Shared Account" Problem

The Analogy: Running OpenClaw on the same provider account as your production services is like running a fireworks factory in the same building as your office. If the fireworks go off, you don't just lose the factory โ€” you lose the office too.

Most VPS providers manage trust at the account level, not the instance level. If one VPS on your account triggers a TOS violation, the provider may suspend or terminate your entire account โ€” every instance, snapshot, backup, DNS record, and object storage bucket attached to it.

What Triggers TOS Violations

OpenClaw can generate outbound activity that violates provider acceptable-use policies, even without being "hacked":

TriggerHow It Happens
Outbound spamPrompt injection causes the agent to send bulk messages via connected channels or SMTP
Port scanning / abuse reportsMisconfigured gateway or agent sandbox makes outbound connections that look like scanning
Content policy violationsAI-generated messages sent through messaging platforms trigger abuse reports back to your VPS IP
Excessive outbound trafficRunaway API calls or agent loops generate traffic spikes that trip automated abuse detection

None of these require a sophisticated attacker. A single prompt injection, a misconfigured channel relay, or an agent stuck in a loop can be enough.

What Providers Actually Do

Provider response typically escalates through these stages:

  1. Warning email โ€” "We detected activity that may violate our TOS" (you may not see this in time)
  2. Instance suspension โ€” The offending VPS is stopped; you can usually still access data
  3. Account termination โ€” All resources on the account are deleted, often with limited appeal window

The speed varies by provider โ€” some give 72 hours to respond, others suspend first and ask questions later. Automated abuse detection systems are especially aggressive with outbound email/messaging activity.

Blast Radius

If your OpenClaw VPS shares an account with production services, account-level suspension takes down:

  • All VPS instances (production, staging, monitoring)
  • Snapshots and backups stored with that provider
  • DNS records (if using the provider's DNS)
  • Object storage (S3-compatible buckets, etc.)
  • Load balancers, managed databases, and any other attached resources

Mitigation

StrategyProtection LevelTrade-off
Separate provider entirelyBest โ€” no shared blast radius at allManaging two providers
Separate account on same providerGood โ€” account-level isolationSeparate billing, may need separate payment method
Same account + billing alertsMinimal โ€” you'll know when it's too lateNo actual isolation

Recommended approach: Use a completely separate provider for OpenClaw. A cheap $5-6/month VPS from a different provider than your production infrastructure gives you full blast-radius isolation.

Additionally, set up billing alerts on whatever account runs OpenClaw. Unusual spikes in bandwidth or compute are often the first sign of rogue behavior โ€” and can alert you before the provider's abuse team does.

Cross-reference: The deployment guide callout covers this at the decision point where you pick a provider.


Code References

Security ControlSource FileLines
Network binding modessrc/gateway/net.ts270-318
File permissions (0o700)src/config/io.ts890
File permissions (0o600)src/config/io.ts998
Gateway authsrc/gateway/auth.tsAuthentication logic
Docker sandboxsrc/agents/sandbox/docker.tsContainer isolation
Security auditsrc/security/audit.ts338-357