Back to skill

Security audit

OpenClaw Skill Debugger

Security checks for vulnerabilities and agentic risk

Overview

This skill is mostly a coherent OpenClaw debugging aid, but one bundled audit script can mishandle an untrusted target path in a way that could let that target influence local command execution.

Review before installing or running this skill against untrusted directories. If used, run it in an isolated workspace and fix scripts/check-hardcoded-paths.sh to canonicalize the target path and pass rg options before a -- terminator. Portuguese-only documentation may also be a practical fit issue for non-Portuguese users.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/check-hardcoded-paths.sh:30
Finding
Ripgrep Option Injection Through an Untrusted Target Path## Vulnerability Details **File Location**: `scripts/check-hardcoded-paths.sh`, lines 30–44 **Vulnerability Type**: Command-line option injection **Risk Level**: High ### Vulnerable Code ```bash echo "\n--- Caminhos absolutos suspeitos: ---" rg -n "^/([a-zA-Z0-9_-]+/)+" "$SKILL_PATH" $EXCLUDE_DIRS | grep -v "/bin/" | grep -v "/usr/" | grep -v "/dev/" | grep -v "/proc/" | grep -v "/sys/" || echo "Nenhum encontrado." # Ajuste conforme necessário echo "\n--- Caminhos de usuário hardcoded (/home/, /root/): ---" rg -n "/home/[a-zA-Z0-9_-]+/|/root/" "$SKILL_PATH" $EXCLUDE_DIRS || echo "Nenhum encontrado." echo "\n--- Caminhos de sistema (/etc/, /var/, /opt/): ---" rg -n "/etc/|/var/|/opt/" "$SKILL_PATH" $EXCLUDE_DIRS || echo "Nenhum encontrado." ``` ### Technical Analysis The script accepts a target directory from its first positional argument and passes it directly to `rg`. Although `"$SKILL_PATH"` is shell-quoted, quoting only prevents shell word splitting and metacharacter expansion. It does not prevent the invoked program from interpreting a value beginning with `-` or `--` as a command-line option. No `--` option terminator is placed before the target path. Consequently, a directory name crafted to resemble a ripgrep option can be interpreted as an option rather than as the directory to scan. Execution-related ripgrep options, such as `--pre=COMMAND`, may cause a command to be invoked as a file preprocessor when the search runs. The initial directory check does not eliminate this issue: ```bash if [ ! -d "$SKILL_PATH" ]; then ``` A relative directory can legitimately have a name beginning with `--`, so an attacker can create such a directory and satisfy this validation. ### Attack Path 1. An attacker creates or causes the operator to use a relative target directory whose name is also a valid execution-related ripgrep option, such as a crafted `--pre=...` argument. 2. The operator invoke ...[truncated 1363 chars]
Remediation
## Remediation Suggestions 1. Place an explicit `--` option terminator immediately before every user-controlled path: ```bash rg -n "$PATTERN" $EXCLUDE_OPTIONS -- "$SKILL_PATH" ``` 2. Canonicalize the supplied directory using an option-safe invocation before passing it to other tools: ```bash SKILL_PATH=$(realpath -- "$1") || { echo "Error: Unable to resolve the supplied skill path." >&2 exit 1 } ``` Converting the input to an absolute path also ensures that the resulting argument begins with `/` rather than `-`. 3. Replace the exclusion argument string with a Bash array so each option remains a deliberate argument. Use ripgrep-native glob exclusions: ```bash EXCLUDE_OPTIONS=( --glob '!node_modules/**' --glob '!.git/**' --glob '!build/**' ) rg -n '/home/[a-zA-Z0-9_-]+/|/root/' \ "${EXCLUDE_OPTIONS[@]}" -- "$SKILL_PATH" ``` 4. Apply the same protection consistently to all three `rg` invocations. 5. Add regression tests using directories named like command-line options, including `--help`, `--version`, and execution-related options. Tests should confirm that these values are treated exclusively as filesystem paths and cannot change ripgrep behavior. 6. Run this auditing script with least privilege and inside an isolated environment when scanning attacker-controlled projects.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (7)

Ae1

High
Category
analysis-evasion
Content
* **Scripts Auxiliares Ausentes**: Verifique se todos os scripts referenciados no `SKILL.md` da skill alvo existem no seu diretório `scripts/`.
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
* **Scripts Auxiliares Ausentes**: Verifique se todos os scripts referenciados no `SKILL.md` da skill alvo existem no seu diretório `scripts/`.
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The manifest description is written entirely in Portuguese and the rest of the skill instructions are also Portuguese, with no indication that the skill is region-specific or that another language can be used. This creates a natural-language locale constraint that may violate language-choice policy for general-purpose skills.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This markdown file contains all user-facing instructions in Portuguese, which can amount to a language/locale policy violation when no opt-in or alternative language is provided. The content does not indicate that the skill is region-specific or that Portuguese is a justified requirement.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
This markdown file uses Portuguese throughout, beginning with the title and continuing for all instructions and examples. Under the policy rule for natural-language violations, forcing a specific language without user opt-in or documented justification can be a locale-policy issue.

Natural-Language Policy Violations

Low
Confidence
96% confidence
Finding
The script's user-visible output strings are written in Portuguese throughout, including usage, errors, and status messages. Because this code file provides no language selection, opt-in, or documented justification for a Portuguese-only interface, it appears to violate the language/locale policy criterion.

Natural-Language Policy Violations

Low
Confidence
96% confidence
Finding
This shell script presents all user-facing output in Portuguese, including usage, errors, warnings, and status messages. Because the file does not indicate that the skill is region-specific or provide any opt-in or language selection, it constitutes a natural-language locale policy concern.

Static analysis

No suspicious patterns detected.