Security Reference
For the security policy, vulnerability reporting, and security model overview, see SECURITY.md in the project root.This document contains operational details that supplement the root security policy: deployment hardening procedures, formal verification reproduction instructions, and the upstream audit trail.
Deployment Hardening (Docker)
docker-compose.yml
- Never bind to
0.0.0.0— the gateway enforces loopback-only and refuses to start without auth on non-loopback - Non-root user — the container runs as a dedicated UID, not root
- Read-only mounts where possible (SSH keys use
:ro) - Memory limits prevent a runaway process from killing the host
Dockerfile
The multi-stage build enforces:--frozen-lockfileon dependency install (no drift from lockfile)- Dev dependencies pruned in a separate stage
- Pinned binary versions (Bun, gog CLI) — no
latesttags USER nodein the runtime stage- Build failures are not silenced (
pnpm build, notpnpm build || true)
Network Security
Firewall (UFW + iptables)
Required rules:- SSH (22): Open, but password auth disabled (pubkey only)
- HTTP/HTTPS (80/443): Restrict to your reverse proxy or CDN IP ranges (e.g., Cloudflare)
- All other ports: Deny by default
Docker port protection
Docker bypasses UFW by default via theDOCKER-USER iptables chain. Any service bound to 0.0.0.0 inside Docker is reachable from the internet regardless of UFW rules.
Protect Docker-published ports by adding DOCKER-USER rules:
SSH hardening
In/etc/ssh/sshd_config:
Data at Rest Encryption
Session transcripts are stored as plaintext JSONL instate/sessions/. File permissions (0o600) restrict access, but disk-level access would expose contents.
Recommended: Encrypt the state directory with gocryptfs.
Monitoring
- Health check:
curl -sf http://localhost:<HOST_PORT>/health - Prometheus metrics: Available at
/metrics(loopback only, no auth) - Fail2ban: Monitor SSH brute-force attempts
- Memory audit cron: Periodic AI scan of persistent memory for injection attempts
- Docker logs:
docker compose logs -f
Deployment Checklist
- SSH: Disable password auth, disable root login, enable pubkey only
- Install and enable fail2ban
- Configure UFW: allow 22, restrict 80/443 to CDN IPs, deny all else
- Add
DOCKER-USERiptables rules for any Docker-published ports - Persist iptables rules via systemd service
- Set
.envpermissions to0600 - Set
state/andworkspace/ownership to match container UID/GID - Set
container-ssh/permissions to0700 - Build image:
docker build -t crocbot:vps-prod source/ - Verify
docker-compose.ymlbinds to127.0.0.1, not0.0.0.0 - Start:
docker compose up -d - Verify health:
curl -sf http://localhost:<HOST_PORT>/health - Verify Telegram webhook is receiving messages
- (Optional) Set up gocryptfs for state directory encryption
- (Optional) Set up reverse proxy (Caddy/Traefik) for HTTPS termination
Formal Verification
Machine-checked TLA+/TLC security models provide an executable, attacker-driven regression suite for the highest-risk paths. Important caveats:- These are models, not the full TypeScript implementation. Drift between model and code is possible.
- Results are bounded by the state space explored by TLC; “green” does not imply security beyond the modeled assumptions and bounds.
- Some claims rely on explicit environmental assumptions (e.g., correct deployment, correct configuration inputs).
Reproducing Results
Gateway Exposure and Open Gateway Misconfiguration
Claim: Binding beyond loopback without auth can make remote compromise possible; token/password blocks unauth attackers (per the model assumptions).- Green runs:
make gateway-exposure-v2,make gateway-exposure-v2-protected - Red (expected):
make gateway-exposure-v2-negative
Nodes.run Pipeline (Highest-Risk Capability)
Claim:nodes.run requires (a) node command allowlist plus declared commands and (b) live approval when configured; approvals are tokenized to prevent replay (in the model).
- Green runs:
make nodes-pipeline,make approvals-token - Red (expected):
make nodes-pipeline-negative,make approvals-token-negative
Ingress Gating (Mentions + Control-Command Bypass)
Claim: In group contexts requiring mention, an unauthorized “control command” cannot bypass mention gating.- Green:
make ingress-gating - Red (expected):
make ingress-gating-negative
Routing/Session-Key Isolation
Claim: DMs from distinct peers do not collapse into the same session unless explicitly linked/configured.- Green:
make routing-isolation - Red (expected):
make routing-isolation-negative
Roadmap
Next models to deepen fidelity:- Provider-specific ingress preflight modeling
- Routing identity-links + dmScope variants + binding precedence
- Gateway auth conformance (proxy/tailscale specifics)
Upstream Audit Trail
Scope: Issues inherited from openclaw/openclaw that were tracked and remediated in the crocbot fork. Last updated: 2026-02-08
Resolved Issues
| Issue | Priority | Resolution |
|---|---|---|
| CVE-2026-25253 (1-Click RCE) | Critical | gatewayUrl not accepted from query params; Control UI removed; loopback enforced |
| CVE-2025-59466 / CVE-2026-21636 (Node.js) | Critical | Running v24.13.0, past required v22.12.0 |
| Bot token in Telegram API URLs | High | Added redactBotToken() in src/telegram/download.ts; wrapped all 3 fetch sites |
| Dockerfile: unverified binary downloads | High | Bun pinned to BUN_VERSION=1.2.2; gog CLI pinned to v1.5.0 |
| Dockerfile: build failure silenced | Medium | Changed pnpm build || true to pnpm build |
| WebSocket origin not validated | Medium | Added gateway.allowedWsOrigins config; non-loopback rejects unlisted origins (code 1008) |
| Hook token via query parameter | Medium | Removed query param extraction; only Authorization: Bearer and X-crocbot-Token accepted |
| Plugin npm install: no safety flags | Medium | Added --no-audit --no-fund --ignore-scripts flags |
| Health endpoint info leakage | Low | Returns only {"status":"healthy"}; no memory or uptime info |
tar dependency vulnerability | Low | Pinned to 7.5.7 via pnpm overrides |
node-tar arbitrary file write | Low | Resolved via 7.5.7 override |
Remaining Open Items
| Issue | Priority | Status |
|---|---|---|
| In-process plugin execution (no OS sandbox) | High | Mitigated by API whitelisting + exec gates; no V8 isolates planned |
| Session transcripts unencrypted at rest | Medium | gocryptfs recommended; see Data at Rest Encryption |
| Plugin dependency lockfile pinning | Medium | Deferred; requires plugin authors to ship lockfiles |
AJV schema validation permissive (strict: false) | Low | Allows unknown properties in plugin configs |
Unauthenticated /metrics endpoint | Low | Required for Prometheus scraping; mitigated by loopback binding |
External References
CVE and Advisory
Industry Analysis
Audits and Research
- Codeslick — OpenClaw Security Audit
- OCSAS — OpenClaw Security Profile
- Adversa AI — OpenClaw Security Guide 2026
