🔒 OpenClaw Security Best Practices

Protect your OpenClaw installation with these essential security practices. Given recent vulnerabilities (CVE-2026-25253) and 341 malicious skills found on ClawHub, security is critical.

Critical

1. Keep OpenClaw Updated

Regular updates patch security vulnerabilities like CVE-2026-25253 (CVSS 8.8).

Update Strategy:

bash
# Check current version
openclaw --version

# Update to latest (v2026.2.6)
npm update -g openclaw@latest

# Verify update
openclaw --version

Update Schedule:

  • Security updates: Apply immediately when announced
  • Feature updates: Weekly or bi-weekly check
  • Auto-updates: Consider setting up automated checks

2. Secure API Key Storage

Never commit API keys to Git or store them in plain text config files.

✅ Recommended: Use Environment Variables

bash
# Add to ~/.bashrc or ~/.zshrc
export ANTHROPIC_API_KEY='sk-ant-your-key-here'
export OPENAI_API_KEY='sk-your-key-here'

# Load environment
source ~/.bashrc

# OpenClaw will auto-detect these variables

❌ Avoid: Hardcoded Keys

# DON'T DO THIS
openclaw config set apiKey sk-ant-your-actual-key-here
git add .
git commit -m "Added config"  # ⚠️ API key now in Git history!

Additional Protections:

  • Add .openclaw/ to .gitignore
  • Use secret management tools (1Password, Vault, AWS Secrets Manager)
  • Rotate API keys regularly (every 3-6 months)
  • Use separate keys for development and production

3. Vet Skills Before Installation (VirusTotal)

341 malicious skills were found on ClawHub. 7.1% of skills mishandle secrets. Use VirusTotal integration (v2026.2.6+).

Skill Vetting Checklist:

  1. Check VirusTotal scan - All ClawHub skills scanned with Code Insight
  2. Review source code - Look for suspicious patterns:
    • Network requests to unknown domains
    • File system access beyond workspace
    • Environment variable reading
    • Obfuscated code
  3. Check author reputation - Prefer verified authors with history
  4. Read reviews - Community feedback on skill quality and safety
  5. Use official skills - 53 official bundled skills are safe

VirusTotal Integration (v2026.2.6+):

OpenClaw now integrates VirusTotal threat intelligence for skill scanning.

  • Automatic scanning of all ClawHub skills
  • Code Insight capability for threat analysis
  • Security scores visible in skill browser
  • Real-time threat detection

4. Network Security

OpenClaw's web interface (port 18789) should not be exposed to the internet without proper security.

🚨 Critical: Do NOT Expose Port 18789

  • 21,639 OpenClaw instances are exposed worldwide (as of Jan 31, 2026)
  • Exposed instances are vulnerable to attacks
  • Default configuration has no authentication

✅ Safe Remote Access Options:

  1. SSH Tunneling (Recommended):
    bash
    ssh -L 18789:localhost:18789 [email protected]
  2. VPN: Access through private network
  3. Reverse Proxy with Auth: nginx/Caddy with authentication

5. Messaging Platform Security

Secure your bot tokens and platform integrations.

Best Practices:

  • Discord: Enable 2FA on developer account, use scoped permissions
  • Telegram: Protect bot token, never share publicly
  • WhatsApp: Secure QR session data, re-authenticate if compromised
  • All platforms: Disable platforms not in use

OpenClaw Performance Optimization

1. Multi-Model Strategy

Use different models for different tasks to optimize cost and performance.

Recommended Strategy:

  • Claude Haiku 4.5: Fast, cost-efficient for simple tasks
    • Use for: Quick responses, simple queries, high-volume interactions
  • Claude Sonnet 4.5: Best coding/agent performance
    • Use for: Code generation, complex tasks, agent workflows
  • Claude Opus 4.6: Most capable, highest cost
    • Use for: Critical decisions, complex reasoning, high-stakes tasks
  • Local models (Ollama): Free, private, offline
    • Use for: Development, testing, privacy-sensitive tasks

OpenRouter Auto (Cost Optimization):

Use OpenRouter's automatic model selection to optimize costs:

bash
openclaw config set model openrouter/openrouter/auto

Automatically routes simple tasks to cheaper models, complex tasks to capable models.

2. Resource Management

Optimize system resources for better OpenClaw performance.

Memory Optimization:

  • Close unused skills: Disable skills not actively in use
  • Limit messaging platforms: Connect only platforms you need
  • Clean cache regularly: openclaw cache clear
  • Monitor memory usage: Use system tools to track consumption

For Local Models (Ollama):

  • Use appropriate model size:
    • 8GB RAM → Use smaller models (glm-5, qwen3-coder)
    • 16GB+ RAM → Can run larger models (gpt-oss:120b)
  • GPU acceleration: Significant speedup with NVIDIA/AMD GPU
  • Model caching: Ollama caches models in memory for faster responses

3. Skill Management Optimization

Managing 5,705 available skills efficiently improves performance.

Skill Best Practices:

  • Install only what you need: Don't install all 5,705 skills
    • Start with 53 official bundled skills
  • Regular cleanup: Remove unused skills
    bash
    openclaw skill uninstall <skill-name>
  • Organize by workspace: Different skills for different projects
  • Update skills: Keep installed skills current

4. Network Performance

Optimize API calls and network usage.

Strategies:

  • Reduce redundant calls: Use memory/context efficiently
  • Batch operations: Group similar tasks together
  • Connection pooling: Reuse connections to APIs
  • Local models for development: Use Ollama to avoid API calls during testing

🎭 OpenClaw SOUL.md Customization Tips

SOUL.md is OpenClaw's personality system. Master these tips to create a truly unique AI agent.

1. Start Simple, Iterate

Don't try to define everything at once. Start with core personality traits and refine through usage.

Iterative Approach:

  1. Week 1: Core identity and communication style
  2. Week 2: Add values and behavior rules based on usage
  3. Week 3: Refine areas of focus and expertise
  4. Week 4: Fine-tune edge cases and special situations

2. Be Specific, Not Generic

Generic SOUL.md creates generic AI. Be specific about personality.

❌ Generic (Avoid):

I am helpful and friendly. I assist users with their questions.

✅ Specific (Good):

I'm a direct, no-nonsense developer assistant. I value working code over lengthy explanations. When you ask a coding question, I give you the solution first, explanation second. If your approach has issues, I'll tell you straight - no sugarcoating.

3. Follow Peter Steinberger's Philosophy

The creator of OpenClaw has strong opinions on what makes agents less boring:

Key Principles:

  • "Have opinions. Strong ones." - Don't hedge with "it depends"
  • "Delete corporate speak." - No employee handbook language
  • "Never open with 'Great question' or 'I'd be happy to help.'" - Just answer
  • "Brevity is mandatory." - One sentence answer = one sentence given
  • "Humor is allowed." - Natural wit from being smart
  • "Call things out." - If something's dumb, say so. Charm over cruelty.
  • "Swearing is allowed when it lands." - Well-placed emphasis
  • "Be the assistant you'd want to talk to at 2am." - Not a corporate drone

4. Use Community Templates

Don't start from scratch. Leverage community SOUL.md templates:

Resources:

SoulCraft Tool:

Use SoulCraft to craft agent personalities through guided conversation.

5. Test and Refine

SOUL.md changes require testing to see how they affect behavior.

Testing Process:

  1. Edit SOUL.md file
  2. Restart OpenClaw: openclaw restart
  3. Test with representative queries
  4. Observe personality changes
  5. Refine and iterate

A/B Testing:

Create multiple workspaces with different SOUL.md files to compare personalities:

bash
openclaw workspace create formal-assistant
openclaw workspace create casual-helper
# Each workspace has its own SOUL.md

💾 OpenClaw Backup and Recovery Best Practices

What to Backup

Critical OpenClaw data to include in backups:

Essential Files:

  • ~/.openclaw/config.json - Main configuration
  • ~/.openclaw/workspaces/*/SOUL.md - Personality files
  • ~/.openclaw/workspaces/*/skills/ - Installed skills
  • ~/.openclaw/memory/ - Persistent memory data
  • Environment variables with API keys (document separately)

Backup Command:

bash
# Create timestamped backup
tar -czf openclaw-backup-$(date +%Y%m%d).tar.gz ~/.openclaw/

# Move to backup location
mv openclaw-backup-*.tar.gz ~/Backups/

Backup Schedule

  • Daily: If actively developing/customizing
  • Weekly: For production use
  • Before major changes: Updates, config changes, skill installations
  • After customization: After SOUL.md changes you want to keep

Recovery Process

Restore from backup if something goes wrong:

bash
# Stop OpenClaw
openclaw stop

# Extract backup
tar -xzf openclaw-backup-20260214.tar.gz -C ~/

# Restart OpenClaw
openclaw start

🚀 OpenClaw Production Deployment Tips

1. Use Process Manager

Keep OpenClaw running in production with automatic restarts.

Option 1: systemd (Linux):

Create /etc/systemd/system/openclaw.service:

ini
[Unit]
Description=OpenClaw AI Agent
After=network.target

[Service]
Type=simple
User=yourusername
WorkingDirectory=/home/yourusername
ExecStart=/usr/local/bin/openclaw start
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Enable and start:

bash
sudo systemctl enable openclaw
sudo systemctl start openclaw
sudo systemctl status openclaw

Option 2: PM2 (Cross-platform):

bash
npm install -g pm2
pm2 start openclaw
pm2 save
pm2 startup

2. Monitoring and Logging

Track OpenClaw health and performance in production.

Log Locations:

  • ~/.openclaw/logs/gateway.log - Main gateway logs
  • ~/.openclaw/logs/error.log - Error logs
  • ~/.openclaw/logs/platform-*.log - Platform-specific logs

Monitor Logs:

bash
# Real-time log monitoring
tail -f ~/.openclaw/logs/gateway.log

# Check for errors
grep ERROR ~/.openclaw/logs/*.log

Token Usage Dashboard (v2026.2.6):

Monitor API usage and costs via web interface at http://127.0.0.1:18789/

3. Environment Separation

Use different configurations for development, staging, and production.

Strategy:

  • Development: Local models (Ollama), test skills, experimental SOUL.md
  • Staging: Production-like setup with separate API keys
  • Production: Optimized models, vetted skills, stable SOUL.md

Workspace-Based Separation:

bash
openclaw workspace create production
openclaw workspace create development
openclaw workspace switch production

🔄 OpenClaw Update Strategies

Safe Update Process

  1. Backup first: Create backup before updating
  2. Check release notes: Read changelog for breaking changes
  3. Test in staging: Update non-production instance first
  4. Update: npm update -g openclaw@latest
  5. Verify: Check version and test core functionality
  6. Monitor: Watch logs for issues after update

Version Pinning

For production stability, consider pinning to specific versions:

bash
# Install specific version
npm install -g [email protected]

# Verify version
openclaw --version

Rollback Plan

If update causes issues, rollback to previous version:

bash
# Uninstall current version
npm uninstall -g openclaw

# Install previous stable version
npm install -g [email protected]

# Restore from backup if needed
tar -xzf openclaw-backup-20260213.tar.gz -C ~/

📚 Additional OpenClaw Resources