Back to skill

Security audit

Write

Security checks for vulnerabilities and agentic risk

Overview

This writing skill is mostly purpose-aligned, but its file-management scripts can write, restore, and delete local files without strong path containment.

Install only if you are comfortable with a writing assistant that creates and changes files in a local workspace. Use a dedicated workspace such as ~/writing, avoid untrusted piece IDs, types, titles, or version values, review before running restore or cleanup, and do not use it for sensitive/proprietary research unless you control whether web searches are performed.

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

T09 · Insecure Skill Coding Practices

Error
Location
new-piece.sh:5
Finding

Path Traversal Through Unvalidated Workspace Identifiers

Content
View full analysis
}" TYPE="${2:?Types: article, email, tweet, doc, book, other}" TITLE="${3:?Provide a title}" # Generate ID: type-YYYYMMDD-HHMMSS ID="${TYPE}-$(date +%Y%m%d-%H%M%S)" PIECE_DIR="$WORKSPACE/pieces/$ID" mkdir -p "$PIECE_DIR" ``` `edit.sh:5-14`: ```bash WORKSPACE="${1:?Usage: edit.sh <workspace> <piece-id> <new-content-file>}" PIECE_ID="${2:?Provide piece ID}" NEW_CONTENT="${3:?Provide path to new content file}" PIECE_DIR="$WORKSPACE/pieces/$PIECE_ID" CONTENT_FILE="$PIECE_DIR/content.md" VERSION_DIR="$WORKSPACE/versions/$PIECE_ID" [[ -d "$PIECE_DIR" ]] || { echo "❌ Piece not found: $PIECE_ID"; exit 1; } [[ -f "$NEW_CONTENT" ]] || { echo "❌ New content file not found: $NEW_CONTENT"; exit 1; } ``` `restore.sh:15-27`: ```bash # Find version file VERSION_FILE=$(ls -1 "$VERSION_DIR" 2>/dev/null | grep "^${VERSION}_" | head -1) [[ -n "$VERSION_FILE" ]] || { echo "❌ Version not found: $VERSION"; exit 1; } FULL_PATH="$VERSION_DIR/$VERSION_FILE" # Backup current before restore (meta-version) TIMESTAMP=$(date +%Y%m%d-%H%M%S) BACKUP_FILE="$VERSION_DIR/pre-restore_${TIMESTAMP}.md" cp "$CONTENT_FILE" "$BACKUP_FILE" # Restore cp "$FULL_PATH" "$CONTENT_FILE" ``` `cleanup.sh:36-40`: ```bash # Delete oldest versions ls -1t "$VERSION_DIR" | tail -n "$DELETE" | while read f; do rm "$VERSION_DIR/$f" echo "🗑️ Deleted: $f" done ``` ### Technical Analysis The scripts concatenate caller-controlled values such as `TYPE`, `PIECE_ID`, and `VERSION` into filesystem paths without validating them as single, safe path components. Shell quoting prevents word splitting and wildcard expans ...[truncated 2425 chars]
Remediation
View remediation
&2 exit 1 } [[ "$value" != "." && "$value" != ".." ]] || exit 1 } ``` 2. Restrict `TYPE` to the documented values: ```bash case "$TYPE" in article|email|tweet|doc|book|other) ;; *) echo "Unsupported piece type: $TYPE" >&2 exit 1 ;; esac ``` 3. Canonicalize the workspace and destination with `realpath` or an equivalent platform-safe mechanism. Verify that each resolved destination remains under the required base directory before reading, writing, or deleting: ```bash BASE_DIR="$(realpath "$WORKSPACE/pieces")" TARGET_DIR="$(realpath -m "$BASE_DIR/$PIECE_ID")" case "$TARGET_DIR/" in "$BASE_DIR"/*) ;; *) echo "Target escapes the pieces directory" >&2 exit 1 ;; esac ``` 4. Apply equivalent containment checks independently to `pieces`, `versions`, `audits`, and `research`. 5. Avoid using `ls` output as a file-processing interface. Enumerate files with `find` using constrained paths and null-delimited output. 6. Match requested versions literally rather than interpolating untrusted input into a regular expression. Validate versions with a strict pattern such as `^v[0-9]+$`, then select the expected filename safely. 7. Before cleanup, display the canonical directory and every canonical deletion target. Reject symlinks and targets that do not remain within the expected version directory. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
new-piece.sh:16
Finding

JSON Injection and Metadata Corruption Through Unescaped Input

Content
View full analysis
"$PIECE_DIR/meta.json" << EOF { "id": "$ID", "type": "$TYPE", "title": "$TITLE", "created": "$(date -Iseconds)", "status": "draft", "versions": [], "audits": [] } EOF ``` ### Technical Analysis The script inserts `ID`, `TYPE`, and `TITLE` directly into a JSON document through an expanding heredoc. These values are not JSON-encoded. A title containing a double quote, backslash, newline, or crafted JSON fragment can terminate the intended string and alter the surrounding JSON structure. At minimum, ordinary titles containing quotation marks can make `meta.json` invalid. A deliberately crafted title can inject additional properties or replace the meaning of following properties. This is JSON/data injection rather than shell command injection. Shell syntax contained in the expanded variables is not re-evaluated as a command by the shell. The confirmed consequence is malformed or attacker-influenced metadata consumed by later `jq` operations. ### Attack Path 1. An attacker or untrusted caller invokes `new-piece.sh` with a title containing JSON control characters or a JSON fragment. 2. The heredoc inserts the title verbatim between JSON quotation marks. 3. The supplied quotation marks or line breaks escape the intended `title` value. 4. The generated `meta.json` becomes invalid or contains attacker-selected fields. 5. Subsequent operations such as `list.sh`, `edit.sh`, and `audit.sh` parse the manipulated file using `jq`. 6. These operations may fail, report misleading state, or append version and audit data to an altered metadata structure. An example malicious title is: ```text x", "status": "published", "attacker_field": "controlled ``` The exact resulting structure depends on the supplied fragment, but no JSON encoding barrier prevents ...[truncated 598 chars]
Remediation
View remediation
"$PIECE_DIR/meta.json.tmp" jq -e . "$PIECE_DIR/meta.json.tmp" >/dev/null mv "$PIECE_DIR/meta.json.tmp" "$PIECE_DIR/meta.json" ``` Additional hardening should include: 1. Validate `TYPE` against the documented allowlist. 2. Reject control characters that have no legitimate purpose in titles. 3. Write to a securely created temporary file in the same directory. 4. Validate the complete JSON document before atomically replacing the destination. 5. Add tests for titles containing quotes, backslashes, Unicode, tabs, and newlines. 6. Roll back the newly created piece directory if metadata generation or index updating fails. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (9)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description suggests a content authoring and quality-control skill centered on creating and refining written material with versioning support. The actual code only implements a cleanup utility for version retention: it lists stored versions in a workspace directory, asks for confirmation, and removes older ones. While this is tangentially related to versioning, it does not provide planning, drafting, refinement, or quality-audit functionality, and it introduces destructive filesystem deletion behavior that is not clearly represented in the description.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

The script deletes files based on user-controlled parameters (WORKSPACE, PIECE_ID, and indirectly the contents of the target directory) without validating that the resolved path stays within an expected safe base directory. If an attacker can supply crafted inputs or manipulate the versions directory via symlinks/path traversal, the cleanup operation may remove unintended files. In a content-versioning skill, deletion is a core action, so unsafe path handling is especially dangerous because it can destroy data rather than merely read it.

Content

Scanner excerpt · cleanup.sh (reported line 38)May include surrounding context.

sh
# Delete oldest versions
ls -1t "$VERSION_DIR" | tail -n "$DELETE" | while read f; do
  rm "$VERSION_DIR/$f"
  echo "🗑️  Deleted: $f"
done

Self-Modification

High
Category
Rogue Agent
Confidence
90% confidence
Finding

The file explicitly tells the agent to consult this document when deciding whether to update SKILL.md, which is a form of agent self-modification guidance. Even though the content appears operational and not overtly malicious, allowing a skill to influence updates to its own controlling instructions or memory creates a path for persistence, policy drift, and unauthorized behavior changes based on untrusted content.

Content

Scanner excerpt · criteria.md (reported line 3)May include surrounding context.

md
# Criteria for Writing Preferences

Reference only — consult when deciding whether to update SKILL.md.

## When to Add

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The setup and workflow instruct the user to initialize a workspace and later use edit/restore/cleanup scripts that modify files, but they do not clearly warn that these commands will create, overwrite, restore, and potentially delete data under the chosen directory. In an agent setting, insufficient disclosure around filesystem side effects can lead to unintended data loss or unsafe execution in the wrong path.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Listing cleanup.sh as removing old versions without a prominent deletion/retention warning creates a real risk that users or agents invoke it without understanding retention consequences. Because the skill is centered on versioned content, silent cleanup behavior can irreversibly remove historical drafts that may be needed for recovery, auditability, or compliance.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · execution.md (reported line 6)May include surrounding context.

md
## Core Rules
- Main agent stays free — delegate all writing to sub-agents
- ALWAYS use scripts for editing (never direct file writes)
- Complete drafts without asking "should I continue?"

## Draft Workflow

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This shell script restores content by copying a version file over the current content file, which overwrites existing data. Although the script prints a success message afterward, there is no pre-action confirmation, warning comment, or other user-facing disclosure before performing the destructive write.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This markdown file describes behavior that writes content to a temporary path in /tmp, which can affect user data handling and local system privacy. The instructions provide no warning that drafts will be stored on disk, even temporarily, or that temp-file handling may have visibility or cleanup implications.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill explicitly directs a 'Quick web search' and 'Deep research' with multiple sources but provides no notice, consent checkpoint, or data-handling guardrails for external network access. If a user topic contains sensitive or proprietary information, the agent could transmit that context to third-party sites or services during research, creating an avoidable privacy and data-exposure risk.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.