T01 · Skill Instruction Hijacking
- Location
scripts/improve.py:153- Finding
Persistent Skill Poisoning Through Untrusted Document Content
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a coherent self-improving writing-style tool, but it stores full drafts and can automatically rewrite its own instructions, so it needs careful review before install.
Install only if you are comfortable with full drafts and final edits being stored on disk and possibly sent through your configured LLM CLI. Avoid using it on confidential, regulated, credential-containing, or client material unless you first add redaction, retention, and explicit approval controls. Do not run auto mode unattended; review proposals and diffs before allowing SKILL.md to be changed.
scripts/improve.py:153Persistent Skill Poisoning Through Untrusted Document Content
scripts/observe.py:118Plaintext Retention and External Processing of Complete User Documents
README.md:16Execution of an Unpinned Mutable Package During Installation
The script has shell/process-execution capability via subprocess.run, but that power is not clearly declared for a writing-style skill. In this context, undeclared process execution is more dangerous because users expect text-style assistance, not launching external binaries based on local availability or environment settings.
The script has shell/process-execution capability via subprocess.run, but that power is not clearly declared for a writing-style skill. In this context, undeclared process execution is more dangerous because users expect text-style assistance, not launching external binaries based on local availability or environment settings.
Allowing IMPROVE_LLM_CMD to specify an arbitrary executable is an unjustified capability for this skill’s stated purpose and effectively creates a generic command runner. In agent environments, this can be chained into arbitrary code execution, persistence, or exfiltration under the user account.
The script sends logged original/final content, account metadata, and part of the current SKILL.md to external LLM tooling without a clear consent or disclosure step. These inputs may contain sensitive user data, proprietary text, or internal instructions, making silent transmission a meaningful privacy and security issue.
Automatic mode extracts suggestions from logs and then applies P0 changes to SKILL.md without explicit user confirmation. This creates an unsafe self-modifying pipeline where untrusted or manipulated content can cause persistent changes to the skill configuration without a human review gate.
The original-submission logger writes full content plus context such as account and content type to a local JSONL file. This is a concrete sensitive-data retention issue because users may submit confidential drafts, credentials, personal information, or business data, all of which become readable to anyone with filesystem access.
The final logger embeds both original_content and final_content verbatim in the log entry, doubling sensitive text storage and centralizing it in a single artifact. This raises the chance of privacy breaches, insider disclosure, and unnecessary replication of regulated or proprietary material.
npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.
The README explicitly describes recording AI drafts and user-edited final content, then sending diffs to an LLM for rule extraction, but it does not warn users about privacy, retention, or sensitive-data handling. This creates a real risk that users will process confidential drafts or edits through local logs and external model tooling without informed consent or sanitization. In a writing-style skill, this is more dangerous because users are likely to feed it real documents, emails, or internal text that may contain sensitive information.
The skill explicitly describes an automated workflow that writes learned rules back into SKILL.md and highlights auto-apply behavior, but it does not clearly require an explicit user confirmation before modifying repository files. In an agent setting, self-modifying prompt/config files can create integrity and persistence risks, especially if changes accumulate silently or are later used as trusted instructions.
The skill instructs recording the original AI draft and the final human-edited version, which can capture sensitive user content and revision history, yet it does not present a clear privacy notice, retention policy, or consent mechanism. This creates a data-handling risk because personal, confidential, or proprietary text may be stored on disk and later processed by automation or external LLM tooling.
The natural-language interface exposed in the module docstring, including description, usage notes, and environment variable explanations, is exclusively Chinese. There is no indication that the skill is region-specific or that users can select another language, which can violate language/locale choice expectations.
The skill presents itself as a reusable writing-style template, but it executes external LLM CLIs and sends edit logs plus SKILL.md content for analysis and rewriting. That is a significant behavioral expansion and a data-transfer action that users may not expect from the description alone.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
]
for cmd in candidates:
try:
result = subprocess.run(cmd, input=prompt, capture_output=True,
text=True, timeout=timeout)
if result.returncode == 0 and result.stdout.strip():
return result.stdout.strip()
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
]
for cmd in candidates:
try:
result = subprocess.run(cmd, input=prompt, capture_output=True,
text=True, timeout=timeout)
if result.returncode == 0 and result.stdout.strip():
return result.stdout.strip()
The script executes a command sourced from the IMPROVE_LLM_CMD environment variable, giving whoever controls the environment the ability to run arbitrary programs. In an agent or automation context, this expands the skill from 'writing-style improvement' into unrestricted command execution and can be abused for code execution or exfiltration.
custom_cmd = os.environ.get("IMPROVE_LLM_CMD")
if custom_cmd:
try:
result = subprocess.run(custom_cmd.split(), input=prompt,
capture_output=True, text=True, timeout=timeout)
if result.returncode == 0 and result.stdout.strip():
return result.stdout.strip()
This path combines two risks: attacker-controlled command selection via IMPROVE_LLM_CMD and transmission of prompt data into that command. If the environment is influenced by another component, the skill can be turned into an arbitrary launcher that also feeds it potentially sensitive content.
custom_cmd = os.environ.get("IMPROVE_LLM_CMD")
if custom_cmd:
try:
result = subprocess.run(custom_cmd.split(), input=prompt,
capture_output=True, text=True, timeout=timeout)
if result.returncode == 0 and result.stdout.strip():
return result.stdout.strip()
The skill feeds raw edit logs, including original/final content and account metadata, directly into an LLM prompt. This can disclose sensitive user content and also enables prompt-injection-style manipulation because untrusted logged text is embedded wholesale into later model instructions.
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
return None
name = f"SKILL-{datetime.now().strftime('%Y%m%d-%H%M%S')}.md"
backup_path = backup_dir / name
shutil.copy2(target, backup_path)
print(f"📦 备份: {backup_path}")
return backup_path
Applying a proposal overwrites the target SKILL.md with model-produced content without an explicit confirmation step. Even though there is a backup, users can still suffer silent corruption, prompt-injection persistence, or policy drift if they do not review what the model generated.
The merge step asks the model to reproduce a complete updated SKILL.md while providing the full proposal and current SKILL.md. This encourages unnecessary reproduction of embedded content and increases the chance that malicious or irrelevant text from proposals persists into the final file.
The script writes LLM-generated output directly over the target SKILL.md without validation or mandatory approval. Because the generated content is influenced by log data and proposal text, prompt injection or malformed output can silently corrupt the skill, insert unsafe instructions, or destroy prior configuration.
print("❌ 合并失败")
return
target.write_text(updated)
new_content = proposal_content.replace(
"status: pending",
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
# 保存当前版本
if target.exists():
emergency = backup_dir / f"SKILL-pre-rollback-{datetime.now().strftime('%Y%m%d-%H%M%S')}.md"
shutil.copy2(target, emergency)
shutil.copy2(latest, target)
print(f"✅ 已回滚到: {latest.name}")
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
emergency = backup_dir / f"SKILL-pre-rollback-{datetime.now().strftime('%Y%m%d-%H%M%S')}.md"
shutil.copy2(target, emergency)
shutil.copy2(latest, target)
print(f"✅ 已回滚到: {latest.name}")
The script's stated purpose is to record original and final content for later analysis, which establishes intentional persistent retention of natural-language data. In this skill context, that is more dangerous because writing workflows commonly involve unpublished drafts, client material, or personal text, and the feature is presented as a reusable template without strong safeguards.