moltbot-security
Security hardening for AI agents - Moltbot, OpenClaw, Cursor, Claude. Lock down gateway, fix permissions, auth, firewalls. Essential for vibe-coding setups.
Best use case
moltbot-security is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Security hardening for AI agents - Moltbot, OpenClaw, Cursor, Claude. Lock down gateway, fix permissions, auth, firewalls. Essential for vibe-coding setups.
Teams using moltbot-security should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/moltbot-security/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How moltbot-security Compares
| Feature / Agent | moltbot-security | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Security hardening for AI agents - Moltbot, OpenClaw, Cursor, Claude. Lock down gateway, fix permissions, auth, firewalls. Essential for vibe-coding setups.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Moltbot Security Guide
Your Moltbot gateway was designed for local use. When exposed to the internet without proper security, attackers can access your API keys, private messages, and full system access.
**Based on:** Real vulnerability research that found 1,673+ exposed OpenClaw/Moltbot gateways on Shodan.
---
## TL;DR - The 5 Essentials
1. **Bind to loopback** — Never expose gateway to public internet
2. **Set auth token** — Require authentication for all requests
3. **Fix file permissions** — Only you should read config files
4. **Update Node.js** — Use v22.12.0+ to avoid known vulnerabilities
5. **Use Tailscale** — Secure remote access without public exposure
---
## What Gets Exposed (The Real Risk)
When your gateway is publicly accessible:
- Complete conversation histories (Telegram, WhatsApp, Signal, iMessage)
- API keys for Claude, OpenAI, and other providers
- OAuth tokens and bot credentials
- Full shell access to host machine
**Prompt injection attack example:** An attacker sends you an email with hidden instructions. Your AI reads it, extracts your recent emails, and forwards summaries to the attacker. No hacking required.
---
## Quick Security Audit
Run this to check your current security posture:
```bash
openclaw security audit --deep
```
Auto-fix issues:
```bash
openclaw security audit --deep --fix
```
---
## Step 1: Bind Gateway to Loopback Only
**What this does:** Prevents the gateway from accepting connections from other machines.
Check your `~/.openclaw/openclaw.json`:
```json
{
"gateway": {
"bind": "loopback"
}
}
```
**Options:**
- `loopback` — Only accessible from localhost (most secure)
- `lan` — Accessible from local network only
- `auto` — Binds to all interfaces (dangerous if exposed)
---
## Step 2: Set Up Authentication
**Option A: Token Authentication (Recommended)**
Generate a secure token:
```bash
openssl rand -hex 32
```
Add to your config:
```json
{
"gateway": {
"auth": {
"mode": "token",
"token": "your-64-char-hex-token-here"
}
}
}
```
Or set via environment:
```bash
export CLAWDBOT_GATEWAY_TOKEN="your-secure-random-token-here"
```
**Option B: Password Authentication**
```json
{
"gateway": {
"auth": {
"mode": "password"
}
}
}
```
Then:
```bash
export CLAWDBOT_GATEWAY_PASSWORD="your-secure-password-here"
```
---
## Step 3: Lock Down File Permissions
**What this does:** Ensures only you can read sensitive config files.
```bash
chmod 700 ~/.openclaw
chmod 600 ~/.openclaw/openclaw.json
chmod 700 ~/.openclaw/credentials
```
**Permission meanings:**
- `700` = Only owner can access folder
- `600` = Only owner can read/write file
Or let OpenClaw fix it:
```bash
openclaw security audit --fix
```
---
## Step 4: Disable Network Broadcasting
**What this does:** Stops OpenClaw from announcing itself via mDNS/Bonjour.
Add to your shell config (`~/.zshrc` or `~/.bashrc`):
```bash
export CLAWDBOT_DISABLE_BONJOUR=1
```
Reload:
```bash
source ~/.zshrc
```
---
## Step 5: Update Node.js
Older Node.js versions have security vulnerabilities. You need **v22.12.0+**.
Check version:
```bash
node --version
```
**Mac (Homebrew):**
```bash
brew update && brew upgrade node
```
**Ubuntu/Debian:**
```bash
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
```
**Windows:** Download from [nodejs.org](https://nodejs.org/)
---
## Step 6: Set Up Tailscale (Remote Access)
**What this does:** Creates encrypted tunnel between your devices. Access OpenClaw from anywhere without public exposure.
**Install Tailscale:**
```bash
# Linux
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up
# Mac
brew install tailscale
```
**Configure OpenClaw for Tailscale:**
```json
{
"gateway": {
"bind": "loopback",
"tailscale": {
"mode": "serve"
}
}
}
```
Now access via your Tailscale network only.
---
## Step 7: Firewall Setup (UFW)
**For cloud servers (AWS, DigitalOcean, Hetzner, etc.)**
**Install UFW:**
```bash
sudo apt update && sudo apt install ufw -y
```
**Set defaults:**
```bash
sudo ufw default deny incoming
sudo ufw default allow outgoing
```
**Allow SSH (don't skip!):**
```bash
sudo ufw allow ssh
```
**Allow Tailscale (if using):**
```bash
sudo ufw allow in on tailscale0
```
**Enable:**
```bash
sudo ufw enable
```
**Verify:**
```bash
sudo ufw status verbose
```
⚠️ **Never do this:**
```bash
# DON'T - exposes your gateway publicly
sudo ufw allow 18789
```
---
## Step 8: SSH Hardening
**Disable password auth (use SSH keys):**
```bash
sudo nano /etc/ssh/sshd_config
```
Change:
```
PasswordAuthentication no
PermitRootLogin no
```
Restart:
```bash
sudo systemctl restart sshd
```
---
## Security Checklist
Before deploying:
- [ ] Gateway bound to `loopback` or `lan`
- [ ] Auth token or password set
- [ ] File permissions locked (600/700)
- [ ] mDNS/Bonjour disabled
- [ ] Node.js v22.12.0+
- [ ] Tailscale configured (if remote)
- [ ] Firewall blocking port 18789
- [ ] SSH password auth disabled
---
## Config Template (Secure Defaults)
```json
{
"gateway": {
"port": 18789,
"bind": "loopback",
"auth": {
"mode": "token",
"token": "YOUR_64_CHAR_HEX_TOKEN"
},
"tailscale": {
"mode": "serve"
}
}
}
```
---
## Credits
Based on security research by [@NickSpisak_](https://x.com/NickSpisak_) who found 1,673+ exposed gateways on Shodan.
Original article: https://x.com/nickspisak_/status/2016195582180700592
---
## Installation
```bash
clawdhub install NextFrontierBuilds/moltbot, openclaw-security
```
Built by [@NextXFrontier](https://x.com/NextXFrontier)Related Skills
PowerShell Scripting for Security
This skill should be used when the user asks to "write PowerShell scripts", "automate security tasks with PowerShell", "create PowerShell functions", "work with PowerShell modules", "parse data with PowerShell", or "build security automation scripts". It provides comprehensive PowerShell scripting fundamentals for security professionals.
power-bi-security-rls-best-practices
Comprehensive Power BI Row-Level Security (RLS) and advanced security patterns implementation guide with dynamic security, best practices, and governance strategies. Triggers on: **/*.{pbix,dax,md,txt,json,csharp,powershell}
symfony:api-platform-security
Use when symfony api platform security
Model Bom Security
AI Supply Chain Security extends beyond IoT device security (Skill 76-80) and LLM Security (Skill 123) to secure the entire software and AI model supply chain, from training data to deployed models.
Iot Security
IoT security protects devices, data, and networks from cyber threats. This guide covers authentication, encryption, secure boot, and compliance for securing IoT deployments at scale with proper device
cc-skill-security-review
Use this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment/sensitive features. Provides comprehensive security checklist a...
backend-security-coder
Expert in secure backend coding practices specializing in input validation, authentication, and API security. Use PROACTIVELY for backend security implementations or security code reviews.
api-security-testing
API security testing workflow for REST and GraphQL APIs covering authentication, authorization, rate limiting, input validation, and security best practices.
api-security-enforcer
Apply rate limiting, input validation, and injection defenses.
api-security-best-practices
Implement secure API design patterns including authentication, authorization, input validation, rate limiting, and protection against common API vulnerabilities
security-specialist
安全专家。专注于应用安全、威胁建模、安全合规和数据保护。提供安全审查、漏洞扫描、安全配置和合规检查。用于构建安全可靠的应用系统。
moltbot, openclaw-best-practices
Best practices for AI agents to avoid common mistakes. Learn from real failures - confirms before executing, shows drafts before publishing. Works with Claude, Cursor, GPT, Copilot.