← 返回 Skills 市场
thebrierfox

Free Bash Safety Primer

作者 ~K¹yle Million · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
150
总下载
0
收藏
1
当前安装
2
版本数
在 OpenClaw 中安装
/install free-bash-safety-primer
功能描述
Understand the attack surface created when an OpenClaw agent executes shell commands autonomously. Covers obfuscation, injection, encoding attacks, and why C...
使用说明 (SKILL.md)

OpenClaw Bash Safety — Why Your Agent Is a Security Risk

What Autonomous Bash Execution Actually Means

When you give an OpenClaw agent access to the exec tool, you are giving an AI model the ability to run arbitrary shell commands on your machine — your files, your network, your credentials, your hardware.

Most operators understand this abstractly. Fewer understand what it means when the agent is running autonomously, 24/7, executing commands generated from tool outputs, web content, files it reads, and messages it receives.

Every one of those inputs is a potential injection vector.

Default OpenClaw has no validation layer between the model's decision to run a command and the shell that executes it. The model is the only check. And models can be manipulated.

The Categories of Attack That Exist

When an agent executes bash autonomously, the attack surface spans several distinct categories. Understanding the categories is more important than knowing specific exploits — exploits evolve, categories don't.

Command Obfuscation

Shell commands can be written in ways that hide their intent from a model evaluating them as text. Variable substitution, brace expansion, heredocs, and character encoding tricks can make a destructive command unrecognizable as dangerous without AST-level parsing.

A model reading ${dangerous_var} as a string sees a variable reference. The shell sees whatever is in that variable.

Substitution Injection

Backtick substitution, $() process substitution, and \x3C() process redirection allow commands to be constructed from the output of other commands. An agent building a shell command from external data — a filename, a URL response, a file it read — can have malicious commands injected into the construction.

This is the bash equivalent of SQL injection, and it's trivially achievable against agents that don't strip or validate command construction inputs.

Encoding and Unicode Attacks

Unicode homoglyphs, zero-width characters, right-to-left overrides, and multi-byte sequences can make a command look like one thing to a model's text processing while the shell interprets it differently.

A filename containing a right-to-left override can display as readme.txt while actually ending in .exe. A command containing Unicode homoglyphs for /etc/passwd looks like a benign path until it executes.

Shell-Specific Escape Vectors

Bash and Zsh have different dangerous builtins, different history mechanisms, and different expansion behaviors. A validation layer written for Bash doesn't necessarily catch Zsh-specific attacks. Production security covers both shells, separately, because the dangerous commands are not the same list.

Persistence and Escalation Vectors

These are the attacks that matter most for autonomous agents: commands that modify cron, init, or systemd entries; commands that install backdoors into shell profiles; commands that create persistent network listeners; commands that modify sudo configuration. An agent that runs one of these once, even accidentally, has a problem that survives reboots.

Why ClawHavoc Happened

In early 2026, 341 skills on ClawHub were found to contain malicious bash payloads — roughly 20% of the active skill library at the time.

The mechanism was straightforward: skills execute code in the agent's context. Skills that included setup scripts, configuration helpers, or initialization routines had those routines execute with full agent permissions when the skill was installed. No validation layer checked those scripts before execution.

ClawHavoc wasn't a sophisticated supply chain attack. It was an absence of validation. Any operator who installed affected skills and had exec access enabled was exposed.

The affected skills looked legitimate. They had reasonable descriptions, normal-looking metadata, and plausible functionality. The malicious payload was in the setup script — the part most operators never read.

Why Regex Validation Isn't Enough

The obvious fix is regex pattern matching: block commands that contain rm -rf, curl | bash, known exfiltration patterns. Most simple bash validators work this way.

The problem is that regex operates on text. Shell execution operates on parsed syntax trees. You can write a command that passes every reasonable regex check and still executes destructively once the shell expands variables, resolves aliases, and processes substitutions.

Production bash security requires validation at multiple levels:

  • Text level (catches obvious patterns)
  • Structural level (catches substitution and expansion tricks)
  • Semantic level (catches context-dependent risks like relative paths in privileged operations)
  • Shell-specific level (catches builtins and behaviors that differ between Bash and Zsh)

Each level catches a different class of attack. Skipping any one of them leaves a category of attack unblocked.

The Bottom Line

If your OpenClaw agent has exec access — and most useful configurations do — and it operates on any external input (messages, files, web content, tool outputs), you have an unvalidated shell execution surface.

This was acceptable when agents were supervised demos. It is not acceptable when they run autonomously.

ClawHavoc demonstrated that the threat is real and active. The question is whether you address it before or after something goes wrong on your machine.


The full 23-validator production security chain — validated through production Claude Code deployments — is available as the Bash Security Validator skill on Claw Mart:

https://www.shopclawmart.com/listings/bash-security-validator-production-openclaw-shell-safety-ded33491

安全使用建议
This skill is informational and low-risk as shipped: it contains guidance about shell-related attack surfaces and does not include code, installers, or credential requests. Before installing or invoking any security-related skill, review the full SKILL.md (the provided content was truncated) and verify the author's reputation or source. Be cautious about any skill that (unlike this one) includes setup scripts or install steps—those are the common supply-chain vectors. Follow least-privilege: don't grant exec/tool access or install unreviewed skills on critical machines, and cross-check recommendations here against trusted security resources before adopting any validators or enforcement mechanisms mentioned by the author.
能力评估
Purpose & Capability
Name and description match the SKILL.md content: a security primer about autonomous shell execution. The skill declares no binaries, env vars, or installs, which is appropriate for an informational guide.
Instruction Scope
SKILL.md is advisory text describing attack categories and mitigations; it does not instruct the agent to run shell commands, read files, or exfiltrate data. Note: the file is truncated at the end — users should inspect the full content before trusting any implied tooling or validators referenced.
Install Mechanism
No install spec and no code files are present, so nothing is written to disk or executed at install time. This is the lowest-risk install profile for a skill.
Credentials
The skill requests no environment variables, credentials, or config paths. There are no disproportionate or unexplained secret requests.
Persistence & Privilege
always:false and no install scripts mean the skill does not request permanent system presence. Model invocation is allowed (platform default) but the SKILL.md does not ask the agent to take persistent actions.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install free-bash-safety-primer
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /free-bash-safety-primer 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
Remove Anthropic attribution language
v1.0.0
- Initial release of the OpenClaw Bash Safety Primer, version 1.0.0. - Explains the security risks of autonomous Bash execution by OpenClaw agents. - Details key attack categories: command obfuscation, substitution injection, encoding attacks, shell-specific escapes, and persistence/escalation vectors. - Analyzes the causes and impact of the ClawHavoc incident that compromised 341 skills. - Clarifies why regex validation alone is inadequate and outlines requirements for robust shell security.
元数据
Slug free-bash-safety-primer
版本 1.0.1
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 2
常见问题

Free Bash Safety Primer 是什么?

Understand the attack surface created when an OpenClaw agent executes shell commands autonomously. Covers obfuscation, injection, encoding attacks, and why C... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 150 次。

如何安装 Free Bash Safety Primer?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install free-bash-safety-primer」即可一键安装,无需额外配置。

Free Bash Safety Primer 是免费的吗?

是的,Free Bash Safety Primer 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Free Bash Safety Primer 支持哪些平台?

Free Bash Safety Primer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Free Bash Safety Primer?

由 ~K¹yle Million(@thebrierfox)开发并维护,当前版本 v1.0.1。

💬 留言讨论