Back to skill

Security audit

Write

Security checks for vulnerabilities and agentic risk

Overview

This writing skill is mostly coherent, but its file-changing scripts are under-scoped and it encourages persistent edits to the skill instructions themselves.

Review before installing. Use only in a dedicated writing workspace, do not pass untrusted piece IDs, paths, types, versions, or cleanup counts, and patch the scripts to validate paths and numeric inputs. Avoid letting agents write learned preferences into SKILL.md; store preferences in a separate reviewed data file instead.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • 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
  • 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 (4)

T09 · Insecure Skill Coding Practices

Error
Location
cleanup.sh:5
Finding

Arbitrary Command Execution Through Unvalidated Arithmetic Input

Content
View full analysis
[keep-count]}" PIECE_ID="${2:?Provide piece ID}" KEEP="${3:-3}" # Keep last N versions by default VERSION_DIR="$WORKSPACE/versions/$PIECE_ID" [[ -d "$VERSION_DIR" ]] || { echo "❌ No versions found for: $PIECE_ID"; exit 1; } TOTAL=$(ls -1 "$VERSION_DIR" | wc -l | tr -d ' ') DELETE=$((TOTAL - KEEP)) ``` ### Technical Analysis The third command-line argument is accepted as `KEEP` without confirming that it is a decimal integer. Bash arithmetic expressions recursively evaluate variable values as arithmetic syntax. Certain crafted expressions, particularly expressions involving array subscripts and command substitutions, can therefore cause shell commands to run during evaluation. Quoting the original assignment does not make the later arithmetic evaluation safe. The dangerous operation occurs when `KEEP` is interpreted inside: ```bash DELETE=$((TOTAL - KEEP)) ``` This evaluation occurs before the script asks the user to confirm deletion. Consequently, the deletion confirmation does not protect against command execution. ### Attack Path 1. An attacker influences the third argument passed to `cleanup.sh`. 2. The attacker supplies a value containing malicious Bash arithmetic syntax. 3. The script stores the value in `KEEP` without validation. 4. Bash recursively evaluates that value while calculating `DELETE`. 5. Embedded command substitution executes with the privileges of the user or Agent running the Skill. 6. Execution occurs before the confirmation prompt is displayed. ### Impact Assessment Successful exploitation permits arbitrary local command execution under the invoking account. The attacker could read or modify any file accessible to that account, alter writing projects, execute installed programs, or use the ...[truncated 233 chars]
Remediation
View remediation
&2 exit 1 fi KEEP=$((10#$KEEP)) if (( KEEP > 10000 )); then echo "❌ Keep count exceeds the permitted limit." >&2 exit 1 fi DELETE=$((TOTAL - KEEP)) ``` Additional hardening should include: - Reject negative numbers, expressions, whitespace, signs, and non-decimal notation. - Apply a reasonable upper bound. - Keep confirmation logic, but do not treat it as an input-validation control. - Add regression tests using arithmetic operators, array syntax, command substitutions, negative values, and very large values. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
edit.sh:5
Finding

Workspace Escape Through Unvalidated Path Components

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` uses an unrestricted piece ID for multiple read and write paths: ```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; } mkdir -p "$VERSION_DIR" if [[ -s "$CONTENT_FILE" ]]; then cp "$CONTENT_FILE" "$VERSION_FILE" fi cp "$NEW_CONTENT" "$CONTENT_FILE" jq --arg v "v${VERSION_NUM}_${TIMESTAMP}" --arg ts "$(date -Iseconds)" \ '.versions += [{"version": $v, "timestamp": $ts}]' \ "$PIECE_DIR/meta.json" > "$PIECE_DIR/meta.json.tmp" && \ mv "$PIECE_DIR/meta.json.tmp" "$PIECE_DIR/meta.json" ``` The same unrestricted pattern is used elsewhere: ```bash PIECE_DIR="$WORKSPACE/pieces/$PIECE_ID" VERSION_DIR="$WORKSPACE/versions/$PIECE_ID" AUDIT_DIR="$WORKSPACE/audits/$PIECE_ID" ``` ### Technical Analysis Shell quoting prevents word splitting and wildcard expansion, but it does not prevent path traversal. Values containing `/`, `..`, or specially arranged path segments can cause the ...[truncated 2522 chars]
Remediation
View remediation
&2 exit 1 fi ``` For `new-piece.sh`, validate the type independently: ```bash case "$TYPE" in article|email|tweet|doc|book|other) ;; *) echo "❌ Invalid piece type." >&2 exit 1 ;; esac ``` Also implement canonical containment checks: 1. Resolve the workspace with `realpath`. 2. Resolve the intended base directory independently. 3. Resolve existing target paths with `realpath`. 4. For paths that do not yet exist, resolve the parent directory first. 5. Require every target to begin with the canonical base directory followed by `/`. 6. Reject symbolic links for security-sensitive files and directories. 7. Open or replace files using techniques that avoid symlink races where practical. 8. Apply the same validation helper consistently in every script rather than duplicating partial checks. 9. Add tests for `..`, absolute paths, repeated separators, newline characters, symbolic links, and malformed IDs. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
execution.md:15
Finding

Predictable Shared Temporary Files Enable Symlink and Content-Injection Attacks

Content
View full analysis
Remediation
View remediation

T02 · Agent Memory Poisoning

Warning
Location
SKILL.md:48
Finding

Persistent Skill-Instruction Modification Can Poison Future Agent Behavior

Content
View full analysis
### Never --- *Empty sections = observe and fill.* ``` `criteria.md` explicitly frames user statements and observed behavior as reasons to update `SKILL.md`: ```markdown Reference only — consult when deciding whether to update SKILL.md. ``` ```markdown ## When to Add **Immediate:** - User explicitly states preference ("I prefer shorter emails") - User corrects tone ("too formal") - User praises style ("love how direct that was") **After pattern (2+):** - User consistently edits same way - User rejects certain structures repeatedly ``` It also provides persistent instruction examples: ```markdown **Never examples:** - `no corporate buzzwords` - `never start with "Great question"` - `no emoji in professional writing` - `skip "let me know if you need anything"` ``` ### Technical Analysis `SKILL.md` is an instruction source loaded as part of the Skill. Writing user-derived material into that file converts mutable user input into persistent Agent instructions. The workflow does not define: - A distinction between trusted owners and untrusted users. - Per-user or per-workspace preference isolation. - Explicit approval before persistence. - A schema restricting entries to passive style data. - Filtering for tool instructions, safety overrides, URLs, external directives, or role changes. - Expiration, provenance, or review of stored preferences. Although the examples are benign writing preferences, the persistence mechanism can accept broader instruction-like content. Once stored in `SKILL.md`, such text can influence later se ...[truncated 1279 chars]
Remediation
View remediation
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
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (12)

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

The code does implement enforced versioning for written content edits by creating a backup before overwriting the content and appending version metadata. However, the declared description is broader and includes planning, drafting, refining, and quality audits, none of which are present in this code chunk. The actual behavior is narrowly focused on updating existing content with version backup and metadata tracking. That makes the description materially broader than the supplied code's actual capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The code chunk is a project initialization script for a new writing item. It generates an ID, creates a directory, writes metadata with empty versions/audits arrays, creates blank content and brief files, and appends the item to an index. While this supports a larger writing workflow, it does not itself plan, draft, refine, enforce versioning, or run quality audits. The declared description overstates the implemented behavior in this code chunk, making the description materially inaccurate for the supplied code.

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 a user-controlled workspace and piece ID, then feeds filenames from ls through a loop into rm. Although the path is quoted, there is no validation that WORKSPACE and PIECE_ID stay within an expected root, and no hardening against symlinks or special filenames, so an attacker who can influence the workspace contents could cause deletion of unintended files or data outside the intended version set.

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
94% confidence
Finding

The file explicitly instructs the agent to consult this document when deciding whether to update SKILL.md, which is a form of self-modification guidance. Even though the content is framed as preference management, allowing a skill to influence updates to its own instruction file can create persistence and prompt-injection risks by storing user-controlled preferences or adversarial edits into future behavior.

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

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file defines when to use the skill with triggers like 'Before publishing/sending important pieces' and 'When user requests review,' but it does not clearly bound what counts as 'important' or specify exclusion conditions. The criteria combine subjective and broad conditions, increasing the chance of over-invocation in normal writing workflows.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The phrase "Consult when planning any writing task" is extremely broad and lacks constraints or negative examples, making it unclear when this reference should apply versus normal conversation. Because it covers "any writing task," it risks unintended activation for routine chat, emails, or simple answers.

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

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The activation criteria are broad enough that ordinary writing requests such as 'thorough' or long-form content can automatically trigger research behavior. In environments where research means web access or additional processing, this can cause unexpected external data sharing, higher-cost actions, or expanded tool use without clear user intent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The instructions direct creation of research files and imply web research, but they do not disclose that content may be sent to external services or that local artifacts will be created. This lack of transparency can lead to unintended persistence of sensitive user material and unnoticed transmission of prompt context to outside systems.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The manifest frames the skill as a writing assistant with versioning and audits, but these lines prescribe orchestrating separate research sub-agents per section topic. Coordinating autonomous research agents is a distinct operational capability that is not implied by the manifest's writing-centric description.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest describes a skill for planning, drafting, versioning, and refining written content with quality audits. This file instructs the skill to perform quick web searches, deep research, gather multiple sources, and verify facts, which is a broader research capability not expressed in the manifest description.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This shell script restores a prior version by copying a version file over the current content file, which overwrites the existing content. Although the script logs success afterward and creates a backup, there is no user-facing warning or confirmation before performing the destructive write, and the file itself provides only a minimal comment rather than a clear disclosure of the overwrite behavior.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.