Back to skill

Security audit

Writing Style Iterator

Security checks for vulnerabilities and agentic risk

Overview

This writing-style skill is not clearly malicious, but it automatically edits files and stores persistent copies of drafts and inferred style rules with too little user control.

Install only if you are comfortable with a writing assistant that creates ~/.writing-style-iterator, copies drafts into Git history, and updates style rules automatically. Avoid using it on confidential, regulated, credential-bearing, or shared documents unless it is changed to require explicit approval, quote paths safely, limit retention, and provide clear purge controls.

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

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:73
Finding
Command Injection Through Unquoted User-Controlled File Paths<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:73-76` **Vulnerability Type**: Shell command injection caused by unsafe path interpolation **Risk Level**: High ### Vulnerable Code ```bash # Write content to the user file and record a snapshot using its absolute path. mkdir -p ~/.writing-style-iterator/drafts/$(dirname <ABSOLUTE_USER_FILE_PATH>) && cp <USER_FILE> ~/.writing-style-iterator/drafts/<ABSOLUTE_USER_FILE_PATH> && git -C ~/.writing-style-iterator add . && git -C ~/.writing-style-iterator commit -m "draft: <FILE_NAME>" ``` ### Technical Analysis The command template inserts a user file path and filename directly into shell syntax without quoting or separating the values from the command. The path is used inside command substitution, as a `cp` argument, as part of a destination path, and in a Git commit message. If an agent replaces these placeholders with an untrusted path and submits the resulting string to a shell, spaces and shell metacharacters can change the command's meaning. Characters such as semicolons, redirections, command substitutions, and option prefixes can produce additional commands or alter the behavior of `dirname`, `cp`, or `git`. Using `&&` does not provide atomicity and does not prevent injection. It only controls whether the following command runs based on the preceding command's exit status. ### Attack Path 1. An attacker supplies, creates, or induces the use of a crafted output filename or absolute path. 2. The agent substitutes the path into the documented command template. 3. The agent executes the constructed command through a shell. 4. The shell interprets metacharacters embedded in the path as syntax rather than as literal filename characters. 5. Attacker-selected commands execute with the same operating-system privileges as the agent process. For example, a path containing a shell command separator could terminate the intended `cp` argument and append another command when the agent builds a raw sh ...[truncated 686 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Prefer a structured file-operation API rather than constructing shell command strings. - Pass paths as separate process arguments without invoking a shell. - If shell use is unavoidable, place every expanded path in double quotes and prevent the value from being parsed as shell source. - Use `--` before path arguments where supported to prevent filenames beginning with `-` from being interpreted as options. - Validate that source files reside inside an explicitly approved workspace. - Reject paths containing control characters and normalize paths before use. - Generate snapshot identifiers independently instead of embedding an absolute path directly into a command. - Avoid inserting untrusted filenames into Git commit messages through generated shell syntax. - Do not describe an `&&` chain as atomic; implement explicit error handling and cleanup or use transactional file operations. ]]>

T02 · Agent Memory Poisoning

Warning
Location
SKILL.md:121
Finding
Persistent Style-Memory Poisoning Through Unverified Document Feedback<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:121-143` and `SKILL.md:158` **Vulnerability Type**: Unverified content persisted as cross-session behavioral rules **Risk Level**: Medium ### Vulnerable Skill Instructions ```text Input sources: 1. Diff: modifications made by the user to the draft 2. Inline annotations: markers have no fixed format, and even a single question mark should be recognized 3. Verbal feedback: statements made directly by the user Process: 1. Review the diff, annotations, and verbal feedback 2. Select a location in style.md based on the modification's granularity 3. Write directly to style.md and commit 4. Notify the user about the update Do not ask for confirmation. Perform the update directly and notify the user afterward. ``` The skill additionally designates direct rule storage without confirmation as a primary principle at line 158. ### Technical Analysis The workflow treats loosely structured material found inside edited files as authoritative input for persistent behavioral memory. Inline comments, imported text, collaborator edits, and even ambiguous punctuation may be interpreted as style feedback. The resulting rule is then written to `style.md` and committed without prior confirmation. This creates a trust-boundary failure between document content and persistent agent configuration. A document can contain content authored by someone other than the user, but the skill does not record provenance or distinguish trusted direct feedback from potentially hostile embedded instructions. Because `style.md` is loaded for future writing requests, a malicious or incorrectly inferred rule can continue to influence subsequent sessions. Git rollback provides recovery after discovery but does not prevent poisoning or the generation of affected content. ### Attack Path 1. An attacker contributes to a shared draft, supplies an imported document, or places an instruction-like annotation in a file the user asks the a ...[truncated 1157 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Require explicit user approval before adding or changing persistent style rules. - Present the exact proposed rule, its source, and the affected scope before committing it. - Treat direct conversational feedback as higher-trust than document content. - Never interpret arbitrary inline content or isolated punctuation as persistent instructions without confirmation. - Track provenance for each rule, including the source file, relevant diff, timestamp, and approving user action. - Restrict style memory to presentation preferences; reject rules involving tool use, security controls, file operations, external actions, credentials, or unrelated agent behavior. - Isolate memory by user and project rather than automatically applying one global style file. - Provide commands to inspect, disable, delete, and permanently purge individual rules. - Apply validation and deduplication before writing rules to `style.md`. - Keep rollback support, but use it as a recovery control rather than as a replacement for consent. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:72
Finding
Mandatory Retention of User Documents in a Hidden Git Repository<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:16-19` and `SKILL.md:72-78` **Vulnerability Type**: Unnecessary duplication and persistent retention of potentially sensitive files **Risk Level**: Medium ### Vulnerable Skill Instructions ```text ~/.writing-style-iterator/ is a Git repository containing: - style.md — the user's style rules - drafts/ — draft snapshots used for diff and rollback ``` ```bash # Write content to the user file and record a snapshot using its absolute path. mkdir -p ~/.writing-style-iterator/drafts/$(dirname <ABSOLUTE_USER_FILE_PATH>) && cp <USER_FILE> ~/.writing-style-iterator/drafts/<ABSOLUTE_USER_FILE_PATH> && git -C ~/.writing-style-iterator add . && git -C ~/.writing-style-iterator commit -m "draft: <FILE_NAME>" ``` ```text This step must be performed after every content generation or modification. ``` ### Technical Analysis The skill requires every generated or modified user document to be copied into a hidden directory under the user's home directory and committed to Git. The source document's absolute path is reproduced beneath the snapshot directory. Git commits preserve historical versions even after the current snapshot is changed, sanitized, or deleted. Consequently, confidential text removed from the working copy may remain recoverable from repository objects and commit history. The workflow does not: - Ask the user to opt in to document retention. - Restrict snapshots to an approved project directory. - Exclude credentials, regulated data, private correspondence, or other sensitive files. - Define a retention period. - Configure restrictive repository permissions. - Provide a secure purge operation that removes historical Git objects. - Warn that deleting the original file does not delete committed snapshots. The use of `git add .` also stages every changed file in the hidden repository, not only the intended snapshot. ### Attack Path 1. A user asks the agent to generate or edit a confidential ...[truncated 1431 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Make draft snapshotting opt-in and clearly disclose the storage location and retention behavior. - Limit snapshots to user-approved workspaces and refuse files outside those boundaries. - Allow users to disable persistence globally or for an individual document. - Do not use Git history for sensitive drafts by default. - If versioning is required, encrypt stored content and protect encryption keys separately. - Create the repository and files with restrictive user-only permissions. - Replace absolute-path mirroring with opaque identifiers to avoid retaining path metadata. - Stage only the intended file instead of using `git add .`. - Add configurable retention limits and automatically remove expired snapshots. - Provide a secure purge operation that removes commits, reflogs, unreachable objects, and backups where feasible. - Detect likely secrets and sensitive locations and require explicit confirmation before copying them. - Explain that deleting or modifying the original file does not remove prior committed versions. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (12)

Missing User Warnings

High
Confidence
97% confidence
Finding
The skill mandates automatic writes to user files, snapshot archives, and style memory without warning or confirmation. This combination of silent file mutation and persistent storage is dangerous because users may not realize their documents and preferences are being changed and archived across sessions.

Vague Triggers

High
Confidence
95% confidence
Finding
The activation criteria cover nearly any writing, rewriting, polishing, translation, or 'help me write/edit' request, making the skill likely to trigger in many ordinary contexts. Because this skill also performs persistence and file operations, broad activation materially increases the chance of unexpected retention or writes when the user only wanted ephemeral assistance.

Natural-Language Policy Violations

Medium
Confidence
81% confidence
Finding
The natural-language description and operating instructions are written as a Chinese-only interaction pattern, and the skill does not indicate that users may choose another language. Because the skill is a general writing assistant rather than a clearly region-specific tool, forcing a single language without opt-in is a locale policy concern.

Ssd 3

Medium
Confidence
94% confidence
Finding
The skill is explicitly designed to persist and analyze writing preferences across sessions, but it does so without clear consent gating, minimization, or sensitivity boundaries. Cross-session profiling of user writing and feedback can capture personal, confidential, or identifying information beyond what is needed for style assistance.

Context-Inappropriate Capability

Medium
Confidence
96% confidence
Finding
The skill persists full draft snapshots of user files in a git-backed archive under the home directory, which materially increases data retention and exposure. Retaining complete copies of user writing may capture sensitive content unrelated to style learning and is broader than necessary for the stated purpose.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The skill instructs the agent to initialize and mutate a persistent git repository in the user's home directory, which is filesystem mutation beyond simple text-generation assistance. This expands the agent's authority into persistent local state changes without an explicit consent gate or strong scope limits, increasing the chance of unintended writes and data retention.

Session Persistence

Medium
Category
Rogue Agent
Content
首次使用前,如果目录不存在,先初始化:
```bash
mkdir -p ~/.writing-style-iterator/drafts && git -C ~/.writing-style-iterator init && touch ~/.writing-style-iterator/style.md && git -C ~/.writing-style-iterator add . && git -C ~/.writing-style-iterator commit -m "init"
```

## 核心工作流
Confidence
89% confidence
Finding
The skill establishes session persistence by creating a repository in the user's home directory and committing state to it, which is a real persistence mechanism rather than transient task handling. Persistent state is not always unsafe, but here it is introduced silently and coupled with broad activation and automatic data collection, making it materially risky.

Description-Behavior Mismatch

Medium
Confidence
93% confidence
Finding
The workflow says the agent should save drafts by writing to user files automatically, which exceeds a narrow 'load style and learn from edits' description and creates authority to alter arbitrary content. Automatic modification of user files can overwrite work, introduce errors, or be abused to make changes the user did not explicitly request at that moment.

Ssd 3

Medium
Confidence
97% confidence
Finding
The workflow copies full user files into a drafts history repository for diffing and rollback, creating a second persistent copy of potentially sensitive documents. This broadens the data exposure surface and retention period well beyond what is necessary if only stylistic changes need to be learned.

Ssd 3

Medium
Confidence
95% confidence
Finding
The skill tells the agent to extract signals from all user edits, annotations, and verbal feedback and write them into persistent memory, which can absorb sensitive or incidental information not intended as reusable preferences. Because the extraction rules are broad and informal, the agent may incorrectly memorialize private details or one-off comments as stable user traits.

Ssd 3

Medium
Confidence
93% confidence
Finding
Automatically updating persistent memory without asking the user first removes meaningful control over what is retained across sessions. This is dangerous because errors in inference can become durable behavior, and the user may be unaware that future generations are being shaped by silently stored data.

Description-Behavior Mismatch

Low
Confidence
88% confidence
Finding
The skill instructs the agent to update persistent style rules automatically without confirmation, creating silent cross-session state changes. While not inherently catastrophic, hidden memory updates can surprise users, encode misinterpretations, and change future outputs in ways the user did not knowingly approve.

Static analysis

No suspicious patterns detected.