Back to skill

Security audit

Cobra Claw - Strike First. Strike Hard

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a small themed CLI package, but its kata runner can be steered outside the intended kata folder to run other local shell scripts.

Review this before installing if an agent might run commands based on untrusted prompts. The kata command should be restricted to an allowlist of bundled kata names before use; otherwise it can potentially run unintended local shell scripts. I found no evidence of network exfiltration, credential access, persistence, or destructive behavior in the package itself.

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

Warning
Location
cobraclaw.sh:28
Finding
Path Traversal Permits Execution of Scripts Outside the Kata Directory<![CDATA[ ## Vulnerability Details **File Location**: `cobraclaw.sh:28-31` **Vulnerability Type**: Path traversal leading to unintended local code execution **Risk Level**: Medium ### Vulnerable Code ```bash cmd_kata() { kata="$1" if [ -x "$SCRIPT_DIR/katas/${kata}.sh" ]; then "$SCRIPT_DIR/katas/${kata}.sh" else echo "Kata not found: $kata" fi } ``` ### Technical Analysis The `kata` argument is controlled by the command-line caller and is interpolated directly into an executable file path. Although the path is quoted, which prevents ordinary shell metacharacter injection, the code does not reject directory separators or `..` traversal components. Consequently, a value such as `../../outside/payload` produces a path resembling: ```text $SCRIPT_DIR/katas/../../outside/payload.sh ``` The `[ -x ... ]` check only verifies that the resolved target exists and is executable. It does not verify that the resolved target remains inside the intended `katas` directory. If the target passes this check, line 31 executes it. The forced `.sh` suffix and executable-file requirement limit exploitation, but they do not eliminate the directory-boundary violation. ### Attack Path 1. An attacker places or identifies an executable file named `payload.sh` outside the project's `katas` directory. 2. The attacker gains control of the argument passed to the `kata` command. 3. The attacker supplies a traversal path, for example: ```bash ./cobraclaw.sh kata ../../outside/payload ``` 4. The constructed path resolves outside `katas`. 5. If the resulting file exists and has execute permission, the executable check succeeds. 6. The external script runs with the same operating-system identity and environment as the `cobraclaw.sh` process. ### Impact Assessment Successful exploitation permits execution of an unintended local `.sh` file with the privileges of the user or Agent invoking the Skill. The executed script could access, modify, or d ...[truncated 332 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Use an explicit allowlist of supported kata identifiers rather than converting arbitrary input into an executable path: ```bash cmd_kata() { local kata="${1:-}" case "$kata" in strike-first|hard-shell|cobra-strike|no-mercy|evolve|wax-on-wax-off|sweep-the-leg) "$SCRIPT_DIR/katas/$kata.sh" ;; *) printf 'Invalid kata: %s\n' "$kata" >&2 return 1 ;; esac } ``` Additional hardening measures: 1. Reject empty values, absolute paths, directory separators, and traversal components. 2. If dynamic discovery is required, canonicalize both the `katas` directory and candidate target, then verify that the canonical target is a direct child of the canonical directory. 3. Account for symbolic links when performing containment validation; lexical prefix checks alone are insufficient. 4. Run kata scripts with the minimum required operating-system privileges. 5. Add regression tests covering values such as `../`, `../../outside/payload`, absolute paths, embedded slashes, and symlink-based escapes. ]]>
Vulnerability Patterns
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • 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
Findings (2)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The declared description suggests a multi-function skill with CLI lookup capability, practice katas, and shell utilities. The supplied code chunk is only a minimal shell script that echoes two static lines. Its primary behavior is a simple status/banner printout, which does not accurately represent the broader declared functionality. There are no undeclared sensitive capabilities, but there is a material description-to-behavior mismatch because the implemented behavior is far narrower and different from the stated purpose.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The description presents a broader dojo-themed skill with CLI lookups, katas, and shell tools. The actual code chunk is a minimal shell script that only echoes a trophies banner and usage for add/show operations. This is a materially different and much narrower purpose than the declared description, and the trophies-related functionality is not represented in the description.

Static analysis

No suspicious patterns detected.