Bank-grade security for AI agents. Five layers of defense prevent prompt injection, filesystem escapes, and credential theft.
AI agents have full shell access and LLM decision-making. Here are the attack vectors we protect against.
Attack: Malicious instructions in tool output control the agent's next action
Example: README.md contains @@DELETE_ALL_FILES
Defense: Command allowlist + approval required + read-only FS
Attack: Agent writes to /etc, /usr, or accesses host system
Example: @@WRITE_FILE /etc/passwd or mount Docker socket
Defense: Read-only root FS + tmpfs for /tmp + no host mounts
Attack: Agent reads AWS IAM credentials via 169.254.169.254
Example:
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/
Defense: iptables blocks cloud metadata endpoints
Attack: Agent runs npm install evil-pkg with postinstall script
Example: npm package with hidden malware
Defense: Command allowlist + AppArmor network restrictions
Attack: Agent spawns infinite processes or fills disk
Example: :(){ :|:& };: (fork bomb)
Defense: Docker resource limits (CPU, memory, PIDs)
Attack: Agent tries to gain root via sudo or SUID binaries
Example: sudo su -
Defense: Non-root user (UID 1000) + no new privileges
No single layer is perfect. Defense-in-depth means an attacker must break through all five.
What it does: Container isolation with read-only root filesystem
read_only: true
tmpfs:
- /tmp:mode=1777,size=1G,noexec,nosuid,nodev
- /app/.npm:mode=755,size=512M
✓ Agents can't modify system files
✓ Temporary writes go to in-memory tmpfs (cleared on restart)
✓ No persistence = no malware installation
What it does: Kernel-enforced mandatory access control
deny /etc/** w,
deny /usr/** w,
deny /var/** w,
deny /proc/sys/** w,
deny @{PROC}/kcore r,
✓ Blocks writes to critical system paths
✓ Prevents kernel memory access
✓ Enforced at kernel level (can't be bypassed from userspace)
What it does: iptables rules block malicious endpoints
# Block AWS IAM credential theft
iptables -A OUTPUT -d 169.254.169.254 -j DROP
# Block GCP metadata
iptables -A OUTPUT -d 169.254.169.254/32 -p tcp --dport 80 -j DROP
✓ Blocks cloud metadata endpoints (AWS, GCP, Azure)
✓ Allowlist-only LLM API domains
✓ Prevents credential exfiltration
What it does: Application-level command validation
// ~/.crewswarm/cmd-allowlist.json
{
"allowedCommands": [
"git status", "git add", "git commit",
"npm install", "npm test",
"ls", "pwd", "cat"
]
}
✓ Only pre-approved commands can run
✓ Dashboard approval for new commands
✓ Regex support for dynamic arguments (e.g., npm install .*)
What it does: Run container as unprivileged user
user: "1000:1000"
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
✓ No sudo or root access
✓ Drops all Linux capabilities
✓ Prevents privilege escalation
Security comparison with other AI agent frameworks.
| Security Feature | OpenClaw | Cursor | crewswarm |
|---|---|---|---|
| Docker isolation | ❌ Native Node.js only | ❌ Native process | ✅ Secure by default |
| Read-only filesystem | ❌ No | ❌ No | ✅ Yes |
| AppArmor/SELinux | ❌ No | ❌ No | ✅ AppArmor profile |
| Network firewall | ❌ No | ❌ No | ✅ Blocks metadata endpoints |
| Command allowlist | ❌ No | ⚠️ User approval only | ✅ Allowlist + approval |
| Non-root execution | ⚠️ Optional | ❌ Runs as user | ✅ UID 1000 enforced |
| Known vulnerabilities | ❌ ClawJacked (critical) | ⚠️ Prompt injection possible | ✅ None |
| Defense layers | 1 (user approval) | 2 (sandbox + approval) | 5 layers |
OpenClaw's WebSocket server lacked authentication, allowing attackers to inject malicious tasks. In December 2025, an attacker transferred $450,000 in tokens via prompt injection. Meta banned OpenClaw from all platforms. crewswarm has no WebSocket injection vulnerability.
Use this checklist when deploying to production.
If you suspect a security breach, follow these steps.
npm run stop-alldocker-compose down~/.crewswarm/logs/*.jsonl for suspicious activity~/.crewswarm/logs/gateway-bridge.jsonlgit diff in project directories/var/log/iptables.log)git pull && docker-compose builddocker-compose.secure.ymlscripts/test-docker-p0-p1.sh[email protected]~/.crewswarm/logs/