Back to skill

Security audit

Agent Directory

Security checks for vulnerabilities and agentic risk

Overview

The skill’s purpose is coherent, but its helper scripts contain unsafe path handling that can let crafted local filenames execute code when validation is run.

Review before installing or running the scripts. Use only with trusted workspace paths and trusted files in docs/agent-profiles, and fix the shell scripts to pass paths as Python arguments and to use mktemp before relying on them in automation or CI.

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 (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/validate.sh:34
Finding

Arbitrary Python Code Execution Through Crafted Profile Filenames

Content
View full analysis
/dev/null; then ``` ```bash ISSUES=$(python3 -c " import json, sys with open('$f') as fh: d = json.load(fh) ``` ```bash sname=$(python3 -c "import json; print(json.load(open('$f')).get('systemName',''))" 2>/dev/null || echo "") ``` ### Technical Analysis The script interpolates the profile pathname stored in `$f` directly into Python source passed to `python3 -c`. Shell quoting does not make the resulting value safe as a Python string literal. A profile filename containing a single quote and valid Python syntax can terminate the `open('...')` expression and inject additional Python statements. The injected code is then executed by `python3` with the privileges of the user running the validation script. The vulnerability occurs in three separate Python invocations. The first invocation is sufficient to reach code execution before the profile's JSON contents are trusted or validated. ### Attack Path 1. An attacker obtains the ability to add or rename a `.json` file under the configured `docs/agent-profiles` directory. 2. The attacker gives the file a crafted name containing Python syntax designed to escape the single-quoted pathname literal. 3. A user, automation process, or Agent runs `bash scripts/validate.sh`. 4. The shell expands `$f` into the `python3 -c` source code. 5. Python parses and executes the attacker-supplied syntax. 6. The payload runs with the invoking user's permissions. ### Impact Assessment Successful exploitation provides arbitrary local code execution under the account that invokes `validate.sh`. The attacker could read or modify files accessible to that account, alter project content, steal locally available credentials, or execute additional operating-system commands. ...[truncated 242 chars]
Remediation
View remediation
/dev/null; then ``` For the larger validation block, pass the path after the Python program: ```bash ISSUES=$(python3 - "$f" <<'PYEOF' import json import os import sys path = sys.argv[1] with open(path) as fh: d = json.load(fh) expected_name = os.path.splitext(os.path.basename(path))[0] # Continue validation here. PYEOF ) ``` Apply the same pattern to the uniqueness lookup: ```bash sname=$(python3 -c \ 'import json, sys; print(json.load(open(sys.argv[1])).get("systemName", ""))' \ "$f" 2>/dev/null || echo "") ``` Use a single-quoted heredoc delimiter where possible so the shell cannot expand data inside Python source. Add regression tests using filenames containing quotes, spaces, command-substitution characters, newlines, and semicolons. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/validate.sh:17
Finding

Predictable Temporary File Permits Symlink-Based File Corruption

Content
View full analysis
"$NAMES_FILE" trap "rm -f $NAMES_FILE" EXIT ``` ### Technical Analysis The temporary pathname is derived only from the process ID and is created through shell redirection. Process IDs are predictable, and the redirection follows symbolic links. A local attacker can attempt to create the expected pathname in `/tmp` as a symbolic link before the redirection executes. If successful, `> "$NAMES_FILE"` opens and truncates the symlink target using the victim process's privileges. Later writes to the names file are also directed to that target. The effectiveness of this attack may be reduced by operating-system symlink protections and filesystem permissions, but the code does not itself establish secure exclusive creation. The cleanup trap also expands an unquoted pathname when the trap executes. The currently generated pathname does not contain whitespace, but robust cleanup should still quote the value and use `--`. ### Attack Path 1. A local attacker predicts or observes the PID likely to be assigned to a validation process. 2. The attacker creates `/tmp/agent-dir-names-` as a symbolic link to a target file. 3. The victim runs `scripts/validate.sh` with the predicted PID. 4. The initial redirection follows the symbolic link and truncates the target. 5. Profile names may subsequently be appended to the target file. 6. On exit, the script removes the temporary symlink pathname. ### Impact Assessment The direct impact is file truncation and unintended data writes under the permissions of the user running the script. An attacker can target only files that the invoking account is permitted to modify. If the script runs under a privileged account and platform-level symlink protections do not block the operation ...[truncated 131 chars]
Remediation
View remediation
> "$NAMES_FILE" ``` For defense in depth, run validation with the minimum necessary privileges and use a private runtime directory with restrictive permissions when available. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/build-index.sh:8
Finding

Workspace Path Injection Into Heredoc-Generated Python Source

Content
View full analysis
Remediation
View remediation
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 (3)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The shell-embedded Python code prints status and warning messages in Chinese at L30 and L51-L53. Because this is a code file and the messages are user-facing, hard-coding a single language without opt-in or justification creates a natural-language locale policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This shell script includes natural-language comments and user-facing output exclusively in Chinese, such as the file description and status messages. Under the policy, forcing a specific language without user opt-in or a documented locale-specific justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

This markdown file contains user-facing instructions exclusively in Chinese, including the core description, field explanations, and usage guidance. Under the policy rule for natural-language violations, forcing a specific language without user opt-in or justification is a reportable issue.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.