This guide is designed for OpenClaw itself (Agent-facing), not as a traditional human-only hardening checklist.
Shell
2,854
14 commits
updated Apr 6, 2026
Read this in other languages: English, 简体中文.
A definitive security practice guide designed specifically for High-Privilege Autonomous AI Agents (OpenClaw). It shifts the paradigm from traditional "host-based static defense" to "Agentic Zero-Trust Architecture", effectively mitigating risks like destructive operations, prompt injection, supply chain poisoning, and high-risk business logic execution.
⚠️Before you start playing, please read the disclaimer and FAQ at the bottom.
⚠️Before you start playing, please read the disclaimer and FAQ at the bottom.
⚠️Before you start playing, please read the disclaimer and FAQ at the bottom.
This guide is designed for OpenClaw itself (Agent-facing), not as a traditional human-only hardening checklist.
In practice, you can send this guide directly to OpenClaw in chat, let it evaluate reliability, and deploy the defense matrix with minimal manual setup.
Important boundary: This guide does not make OpenClaw “fully secure.”
Security is a complex systems engineering problem, and absolute security does not exist.
This guide is built for a specific threat model, scenario, and operating assumptions.
Final responsibility and last-resort judgment remain with the human operator.
This guide is primarily interpreted and executed by OpenClaw.
For best reliability, use a strong, latest-generation reasoning model (e.g., current top-tier models such as Gemini / Opus / Kimi / MiniMax families).
Higher-quality models generally perform better at:
✅ This is exactly how this guide reduces user configuration cost: OpenClaw can understand, deploy, and validate most of the security workflow for you.
Running an AI Agent like OpenClaw with root/terminal access is powerful but inherently risky. Traditional security measures (chattr +i, firewalls) are either incompatible with Agentic workflows or insufficient against LLM-specific attacks like Prompt Injection.
This guide provides a battle-tested, minimalist 3-Tier Defense Matrix:
In the AI era, humans shouldn't have to manually execute security deployments. Let your OpenClaw Agent do all the heavy lifting.
(Note: The scripts/ directory in this repository is strictly for open-source transparency and human reference. You do NOT need to manually copy or run it. The Agent will automatically extract the logic from the guide and handle the deployment for you.)
⚠️ Version & Effectiveness Disclaimer:
- v2.7: Underwent extensive production validation on OpenClaw version 2026.3 and earlier. It is now archived as a classic legacy version, suitable for users still running older engine versions.
- v2.8 Beta: The culmination of heavy testing and improvements specifically targeting OpenClaw version 2026.4 and later, featuring the latest automated workflows and anti-hijacking strategies.
- ⚠️ Risk Warning: Due to OpenClaw's extremely fast iteration cycles and the inherent instability of its rapidly evolving engine, some practices in this guide may become incompatible or ineffective after official updates. Please note that the testing of this guide only covers OpenClaw versions up to the date of the latest repository update. It is highly recommended that you thoroughly test and validate these procedures with your current OpenClaw version before deploying them in production.
Key enhancements over v2.7:
--light-context Cron Protection — Prevents workspace context from hijacking isolated audit sessionsset -uo pipefail, boundary anchors, explicit healthy-state output, summary line$OC/security-reports/ (not /tmp, survives reboots) with 30-day rotationhead/grep) before LLM processingTo ensure your AI assistant doesn't bypass its own defenses out of "obedience", be sure to run these drills:
scripts/nightly-security-audit.sh - Reference shell script (v2.7) for nightly auditing and Git backupsscripts/nightly-security-audit-v2.8.sh - v2.8 Beta reference script with known-issues exclusion, persistent reports, 30-day rotation, and token-optimized outputContributions, issues, and feature requests are welcome!
Thanks: SlowMist Security Team (@SlowMist_Team), Edmund.X (@leixing0309), zhixianio (@zhixianio), Feng Liu (@fishkiller)
The author of this guide assumes no liability for any direct or indirect losses caused by AI models misunderstanding or misexecuting the contents of this guide, including but not limited to: data loss, service disruption, configuration corruption, security vulnerability exposure, or credential leakage. By using this guide, you acknowledge and agree to bear all risks associated with autonomous AI operations.
This guide assumes the executor (human or AI Agent) is capable of the following:
If the executor (especially an AI model) lacks these capabilities, do not apply this guide directly. An insufficiently capable model may misinterpret instructions, resulting in consequences worse than having no security policy at all.
The core mechanism of this guide — "behavioral self-inspection" — relies on the AI Agent autonomously determining whether a command hits a red line. This introduces the following inherent risks:
rm -rf / but missing find / -delete), or too broadly (treating all curl commands as red-line)chattr +i, incorrect parameters may render the system unusable (e.g., locking the wrong file and disrupting OpenClaw's normal operation)(Note: Core disclaimer statement is located at the top of this section)
This guide provides a basic defense-in-depth framework, not a complete security solution:
This guide was written for the following environment. Deviations require independent risk assessment:
This guide is based on specific OpenClaw versions (see the Version & Effectiveness Disclaimer at the top of this document). Future official versions may introduce native security mechanisms that render some measures obsolete or conflicting. Please periodically verify compatibility with your current version.
This is an experiment in implanting a security "Mental Seal" (思想钢印) into an AI. We tried building dedicated security Skills, but found that directly injecting a Markdown manual containing "pre-action, in-action, post-action" policies into OpenClaw's cognition was far more fascinating. A Skill is merely an external tool, whereas a Mental Seal reshapes the Agent's baseline judgment. If you really want a Skill, you can easily prompt your AI through chat to generate one out of this guide. In short: if your machine isn't mission-critical, just hack around and have fun.
Here is a related security Skill: SlowMist Agent Security Skill. Its relationship with this guide: no conflict, mutually enhancing.
It depends on your alignment with the model; you must seek a balance (highly recommend against making it too strict, it will drive you crazy). For example, OpenAI's models are inherently strict. If you follow their natural tendency, they might refuse to do anything. Security and capability are always trade-offs; too much security is bad, zero security is also bad. This is why we emphasize "Zero-friction operations" in our core principles. Because models differ, you should chat with your 🦞 thoroughly before deployment, voice your concerns and desires, find the sweet spot, and then execute.
It's not natively adapted, but there's a trick.
You can directly feed the OpenClaw-Security-Practice-Guide.md to your OpenClaw, as LLMs excel at extrapolation. The model will analyze the OS differences and suggest compatibility fixes. You can then ask it to generate a customized, adapted guide for your specific OS before deciding whether to deploy it.
Once your Agent fully grasps the security design philosophy behind this guide, fascinating chemical reactions will occur. If you later introduce other excellent security Skills or enterprise solutions to it, your OpenClaw will proactively use its existing "Mental Seal" memory to analyze, score, and compare those new tools.
No, it is optional. Its necessity completely depends on how much you value your brain data vs. privacy concerns. If you only care about runtime security and don't want far-end synchronization, just disable it. You can even instruct the Agent to encrypt the data before executing the Git backup.
Of course, your environment, your rules. If you do not need the nightly audits, simply tell your OpenClaw to remove them and retain the manual trigger mechanism.
Not recommended to use the full guide directly. Behavioral self-inspection requires the model to accurately parse command semantics, understand indirect harm, and maintain security context across multi-step operations. If your model can't reliably do this, consider: use only chattr +i (a pure system-level protection that doesn't depend on model capability), and have humans handle Skill installation inspections manually.
It can't be. There are countless ways to achieve the same destructive effect on Linux (find / -delete, deletion via Python scripts, data exfiltration via DNS tunneling, etc.). The guide's principle of "when in doubt, treat it as a red line" is the fallback strategy, but it ultimately depends on the model's judgment.
No. Re-inspection is needed when: a Skill is updated, the OpenClaw engine is updated, a Skill exhibits abnormal behavior, or the audit report shows a Skill fingerprint mismatch.
chattr +i affect OpenClaw's normal operation?It might. Once openclaw.json is locked, OpenClaw itself cannot update the file either — upgrades or configuration changes will fail with Operation not permitted. To modify, first unlock with sudo chattr -i, make changes, then re-lock. Also, never lock exec-approvals.json (as noted in the guide) — the engine needs to write metadata to it at runtime.
chattr +i to the wrong file?Fix manually:
# Find all files with the immutable attribute set
sudo lsattr -R /home/ 2>/dev/null | grep '\-i\-'
# Unlock the mistakenly locked file
sudo chattr -i <file>
If critical system files (e.g., /etc/passwd) were mistakenly locked, you may need to boot into recovery mode to fix it.
The audit script runs with root privileges. If tampered with, it effectively becomes a backdoor that executes automatically every night. Therefore, the v2.8 workflow strictly mandates protecting the script itself with chattr +i, and storing sensitive information like the Telegram Bot Token in a separate file with chmod 600 permissions.
This guide's protective measures are all built on the assumption that "the engine itself is trustworthy" and cannot defend against engine-level vulnerabilities. Stay informed through OpenClaw's official security advisories and update the engine promptly.
This project is MIT licensed.
432 followers · starred Mar 2026
138 followers · starred Apr 2026
265 followers · starred Mar 2026
85 followers · starred Mar 2026
This guide is designed for OpenClaw itself (Agent-facing), not as a traditional human-only hardening checklist.
Shell
2,854
14 commits
updated Apr 6, 2026
Read this in other languages: English, 简体中文.
A definitive security practice guide designed specifically for High-Privilege Autonomous AI Agents (OpenClaw). It shifts the paradigm from traditional "host-based static defense" to "Agentic Zero-Trust Architecture", effectively mitigating risks like destructive operations, prompt injection, supply chain poisoning, and high-risk business logic execution.
⚠️Before you start playing, please read the disclaimer and FAQ at the bottom.
⚠️Before you start playing, please read the disclaimer and FAQ at the bottom.
⚠️Before you start playing, please read the disclaimer and FAQ at the bottom.
This guide is designed for OpenClaw itself (Agent-facing), not as a traditional human-only hardening checklist.
In practice, you can send this guide directly to OpenClaw in chat, let it evaluate reliability, and deploy the defense matrix with minimal manual setup.
Important boundary: This guide does not make OpenClaw “fully secure.”
Security is a complex systems engineering problem, and absolute security does not exist.
This guide is built for a specific threat model, scenario, and operating assumptions.
Final responsibility and last-resort judgment remain with the human operator.
This guide is primarily interpreted and executed by OpenClaw.
For best reliability, use a strong, latest-generation reasoning model (e.g., current top-tier models such as Gemini / Opus / Kimi / MiniMax families).
Higher-quality models generally perform better at:
✅ This is exactly how this guide reduces user configuration cost: OpenClaw can understand, deploy, and validate most of the security workflow for you.
Running an AI Agent like OpenClaw with root/terminal access is powerful but inherently risky. Traditional security measures (chattr +i, firewalls) are either incompatible with Agentic workflows or insufficient against LLM-specific attacks like Prompt Injection.
This guide provides a battle-tested, minimalist 3-Tier Defense Matrix:
In the AI era, humans shouldn't have to manually execute security deployments. Let your OpenClaw Agent do all the heavy lifting.
(Note: The scripts/ directory in this repository is strictly for open-source transparency and human reference. You do NOT need to manually copy or run it. The Agent will automatically extract the logic from the guide and handle the deployment for you.)
⚠️ Version & Effectiveness Disclaimer:
- v2.7: Underwent extensive production validation on OpenClaw version 2026.3 and earlier. It is now archived as a classic legacy version, suitable for users still running older engine versions.
- v2.8 Beta: The culmination of heavy testing and improvements specifically targeting OpenClaw version 2026.4 and later, featuring the latest automated workflows and anti-hijacking strategies.
- ⚠️ Risk Warning: Due to OpenClaw's extremely fast iteration cycles and the inherent instability of its rapidly evolving engine, some practices in this guide may become incompatible or ineffective after official updates. Please note that the testing of this guide only covers OpenClaw versions up to the date of the latest repository update. It is highly recommended that you thoroughly test and validate these procedures with your current OpenClaw version before deploying them in production.
Key enhancements over v2.7:
--light-context Cron Protection — Prevents workspace context from hijacking isolated audit sessionsset -uo pipefail, boundary anchors, explicit healthy-state output, summary line$OC/security-reports/ (not /tmp, survives reboots) with 30-day rotationhead/grep) before LLM processingTo ensure your AI assistant doesn't bypass its own defenses out of "obedience", be sure to run these drills:
scripts/nightly-security-audit.sh - Reference shell script (v2.7) for nightly auditing and Git backupsscripts/nightly-security-audit-v2.8.sh - v2.8 Beta reference script with known-issues exclusion, persistent reports, 30-day rotation, and token-optimized outputContributions, issues, and feature requests are welcome!
Thanks: SlowMist Security Team (@SlowMist_Team), Edmund.X (@leixing0309), zhixianio (@zhixianio), Feng Liu (@fishkiller)
The author of this guide assumes no liability for any direct or indirect losses caused by AI models misunderstanding or misexecuting the contents of this guide, including but not limited to: data loss, service disruption, configuration corruption, security vulnerability exposure, or credential leakage. By using this guide, you acknowledge and agree to bear all risks associated with autonomous AI operations.
This guide assumes the executor (human or AI Agent) is capable of the following:
If the executor (especially an AI model) lacks these capabilities, do not apply this guide directly. An insufficiently capable model may misinterpret instructions, resulting in consequences worse than having no security policy at all.
The core mechanism of this guide — "behavioral self-inspection" — relies on the AI Agent autonomously determining whether a command hits a red line. This introduces the following inherent risks:
rm -rf / but missing find / -delete), or too broadly (treating all curl commands as red-line)chattr +i, incorrect parameters may render the system unusable (e.g., locking the wrong file and disrupting OpenClaw's normal operation)(Note: Core disclaimer statement is located at the top of this section)
This guide provides a basic defense-in-depth framework, not a complete security solution:
This guide was written for the following environment. Deviations require independent risk assessment:
This guide is based on specific OpenClaw versions (see the Version & Effectiveness Disclaimer at the top of this document). Future official versions may introduce native security mechanisms that render some measures obsolete or conflicting. Please periodically verify compatibility with your current version.
This is an experiment in implanting a security "Mental Seal" (思想钢印) into an AI. We tried building dedicated security Skills, but found that directly injecting a Markdown manual containing "pre-action, in-action, post-action" policies into OpenClaw's cognition was far more fascinating. A Skill is merely an external tool, whereas a Mental Seal reshapes the Agent's baseline judgment. If you really want a Skill, you can easily prompt your AI through chat to generate one out of this guide. In short: if your machine isn't mission-critical, just hack around and have fun.
Here is a related security Skill: SlowMist Agent Security Skill. Its relationship with this guide: no conflict, mutually enhancing.
It depends on your alignment with the model; you must seek a balance (highly recommend against making it too strict, it will drive you crazy). For example, OpenAI's models are inherently strict. If you follow their natural tendency, they might refuse to do anything. Security and capability are always trade-offs; too much security is bad, zero security is also bad. This is why we emphasize "Zero-friction operations" in our core principles. Because models differ, you should chat with your 🦞 thoroughly before deployment, voice your concerns and desires, find the sweet spot, and then execute.
It's not natively adapted, but there's a trick.
You can directly feed the OpenClaw-Security-Practice-Guide.md to your OpenClaw, as LLMs excel at extrapolation. The model will analyze the OS differences and suggest compatibility fixes. You can then ask it to generate a customized, adapted guide for your specific OS before deciding whether to deploy it.
Once your Agent fully grasps the security design philosophy behind this guide, fascinating chemical reactions will occur. If you later introduce other excellent security Skills or enterprise solutions to it, your OpenClaw will proactively use its existing "Mental Seal" memory to analyze, score, and compare those new tools.
No, it is optional. Its necessity completely depends on how much you value your brain data vs. privacy concerns. If you only care about runtime security and don't want far-end synchronization, just disable it. You can even instruct the Agent to encrypt the data before executing the Git backup.
Of course, your environment, your rules. If you do not need the nightly audits, simply tell your OpenClaw to remove them and retain the manual trigger mechanism.
Not recommended to use the full guide directly. Behavioral self-inspection requires the model to accurately parse command semantics, understand indirect harm, and maintain security context across multi-step operations. If your model can't reliably do this, consider: use only chattr +i (a pure system-level protection that doesn't depend on model capability), and have humans handle Skill installation inspections manually.
It can't be. There are countless ways to achieve the same destructive effect on Linux (find / -delete, deletion via Python scripts, data exfiltration via DNS tunneling, etc.). The guide's principle of "when in doubt, treat it as a red line" is the fallback strategy, but it ultimately depends on the model's judgment.
No. Re-inspection is needed when: a Skill is updated, the OpenClaw engine is updated, a Skill exhibits abnormal behavior, or the audit report shows a Skill fingerprint mismatch.
chattr +i affect OpenClaw's normal operation?It might. Once openclaw.json is locked, OpenClaw itself cannot update the file either — upgrades or configuration changes will fail with Operation not permitted. To modify, first unlock with sudo chattr -i, make changes, then re-lock. Also, never lock exec-approvals.json (as noted in the guide) — the engine needs to write metadata to it at runtime.
chattr +i to the wrong file?Fix manually:
# Find all files with the immutable attribute set
sudo lsattr -R /home/ 2>/dev/null | grep '\-i\-'
# Unlock the mistakenly locked file
sudo chattr -i <file>
If critical system files (e.g., /etc/passwd) were mistakenly locked, you may need to boot into recovery mode to fix it.
The audit script runs with root privileges. If tampered with, it effectively becomes a backdoor that executes automatically every night. Therefore, the v2.8 workflow strictly mandates protecting the script itself with chattr +i, and storing sensitive information like the Telegram Bot Token in a separate file with chmod 600 permissions.
This guide's protective measures are all built on the assumption that "the engine itself is trustworthy" and cannot defend against engine-level vulnerabilities. Stay informed through OpenClaw's official security advisories and update the engine promptly.
This project is MIT licensed.
432 followers · starred Mar 2026
138 followers · starred Apr 2026
265 followers · starred Mar 2026
85 followers · starred Mar 2026