Back to skill

Security audit

Wangwen Author Suite

Security checks for vulnerabilities and agentic risk

Overview

This writing skill is mostly coherent, but its TXT export tool can delete unrelated .txt files from a chosen output folder without clear warning.

Review before installing. If used, keep all generated work in a dedicated novels/book folder, avoid custom --out paths unless the directory is empty and backed up, and require explicit confirmation before running the Fanqie export script. The skill does not show credential theft, network exfiltration, or persistence, but its export cleanup behavior can cause local TXT file loss.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/export_fanqie.py:122
Finding

Unrestricted Output Cleanup Can Delete Unrelated TXT Files

Content
View full analysis

Vulnerability Details

File Location: scripts/export_fanqie.py, lines 122–129
Vulnerability Type: Unrestricted destructive file cleanup
Risk Level: Medium

Vulnerable Code

python
out = args.out or (src / "番茄导出")
if not out.is_absolute():
    out = Path.cwd() / out

chapters = collect_chapters(src)
if not chapters:
    raise SystemExit(f"未找到章节 md(第*.md 或 001章*.md): {src}")

out.mkdir(parents=True, exist_ok=True)
for old in out.glob("*.txt"):
    if old.name != "目录.txt":
        old.unlink()

Technical Analysis

The --out argument accepts an arbitrary absolute or relative directory. The resolved output path is not required to remain under the source novel directory, nor is it verified as a dedicated export directory.

Before generating output, the script enumerates every top-level .txt file in the selected directory and permanently deletes all of them except 目录.txt. It does not verify whether each file was produced by a previous export, request confirmation, create a backup, or use a generated-file manifest.

The documented export behavior does not disclose that unrelated TXT files in a custom output directory will be removed. This creates a destructive filesystem hazard when an existing directory is selected accidentally or through an incorrectly generated command.

Attack Path

  1. A user or agent invokes the exporter with --out pointing to an existing writable directory containing unrelated TXT files.
  2. The script accepts that directory without validating its relationship to the source directory.
  3. out.glob("*.txt") enumerates all top-level TXT files in that directory.
  4. old.unlink() permanently deletes each enumerated file except one named 目录.txt.
  5. The script writes newly exported chapter files, potentially obscuring that unrelated files were removed.

This path requires the process to have write permission to the selected directory. It does not provide privilege escalation beyond the permissions already ...[truncated 570 chars]

Remediation
View remediation

Remediation Suggestions

  1. Resolve and validate both paths before performing filesystem operations:
python
src = src.resolve()
out = out.resolve()

if not out.is_relative_to(src):
    raise SystemExit("The output directory must be located under the source directory.")
  1. Require a dedicated export subdirectory rather than accepting arbitrary output locations.

  2. Remove only files known to have been generated by previous runs. Maintain a manifest containing generated filenames and restrict cleanup to entries in that manifest.

  3. Do not clean an existing non-empty directory by default. Require an explicit --clean option for destructive cleanup.

  4. Before deletion, display the exact files that would be removed and require confirmation in interactive use. For automated use, require an explicit force flag.

  5. Consider writing into a newly created temporary directory and atomically replacing the prior export directory only after successful generation.

  6. Document all cleanup behavior, including the effect of --out, and clearly warn that destructive cleanup may occur.

  7. Add regression tests confirming that unrelated TXT files are preserved and that output paths outside the permitted source tree are rejected.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (23)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The FAQ text is written as an instruction for how the skill should answer user questions, and it consistently mandates Chinese phrasing such as answering "按 README 讲" without any indication that other languages are supported. This can violate language/locale policy because the file imposes a specific language behavior without user opt-in or a documented regional justification.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger list is broad and includes common creative-writing phrases such as '写小说', '起书名', and '写简介', which can plausibly appear in ordinary user requests. This can cause unintended invocation of the skill, leading the agent to inject this skill's workflow, constraints, or outputs when the user did not explicitly request it.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill explicitly says it should activate when users mention broad phrases like writing a novel, generating a novel outline, or novel review terms. These phrases overlap heavily with normal creative-writing requests, so the skill may trigger when the user did not intend to use this package, causing unintended behavior, file operations, or workflow steering.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documented invocation examples include multiple short, common commands such as '帮我写个小说', '先写大纲', '导出番茄', and 'MD转TXT'. Because these are ordinary user requests rather than strongly namespaced commands, they increase the chance of accidental activation and unintended execution of skill-specific workflows, especially in multi-skill environments.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill instructs the agent to read and write local files such as novels/[书名]/... and to reference scripts, but the manifest does not declare any explicit tool scope or file access boundaries. That creates an authorization ambiguity where the runtime may grant broader filesystem access than the skill actually needs, increasing the risk of unintended file access or overwrite if the skill is invoked in the wrong context.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest description says the skill should enable whenever users mention a wide set of common terms related to novels, outlines, reviews, exporting, or Markdown conversion, but it does not define exclusions or confirmation requirements. In practice, this broad activation boundary makes accidental routing more likely, which is more dangerous here because the skill can direct file access and operational workflows beyond simple text generation.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The trigger list contains broad phrases like 写小说, 创作小说, 生成小说, and 小说大纲, which are common user requests and could cause the skill to activate in many unrelated writing contexts. Because the skill also includes file read/write behavior and mode switching, overbroad activation increases the chance of unintended invocation, accidental file operations, or the skill hijacking general-purpose conversations.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The markdown defines a trigger example using a short natural-language phrase that could plausibly overlap with ordinary user requests for critique. The file does not clearly specify the full allowed trigger set, scope constraints, or negative examples beyond one unrelated rejection example, making activation conditions ambiguous.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The entire skill specification is written as a Chinese-only persona and output format, with required fixed phrases and labels in Chinese, but it does not state that the user may choose another language. This creates a natural-language locale policy issue because the skill implicitly enforces a specific language for interaction and output without user opt-in or a documented region-specific justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

SQP-3 applies to all file types and covers natural-language policy violations such as forcing a specific language without user opt-in. This file presents all guidance exclusively in Chinese and does not mention that the skill is Chinese-only, optional by locale, or intended for a specific region or audience.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file is entirely framed as a required quality standard in Chinese, including mandatory criteria and workflow language such as '必过' and '必须'. The text does not indicate that language selection is optional or justified as a region-specific constraint, which can constitute a language/locale policy violation under the stated rule.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file says the mode can be invoked when the user says phrases like 「起书名」「写简介」「封面文案」, but it does not define scope, exclusions, or contextual constraints. These phrases are generic content-creation requests and could match normal conversation, increasing the risk of unintended invocation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The entire template is written in Chinese and provides no indication that other languages are supported or that the user can choose their preferred language. Under the policy, forcing a specific language without opt-in is a natural-language locale violation unless the constraint is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The entire skill file is written as prescriptive guidance in Chinese and does not indicate that language selection is optional or user-configurable. Under the policy, forcing a specific language or locale without opt-in is a natural-language policy violation unless the regional constraint is explicitly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The entire skill is written as a Chinese-only writing guide and does not indicate that users may choose another language or locale. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the constraint is explicitly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The template content is entirely written in Chinese and instructs chapter generation using Chinese headings and comments, which implies a fixed language expectation. Under the policy, forcing a specific language without offering a user choice or documenting a justified locale constraint is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The template headings and field labels are entirely in Chinese, which imposes a specific language/locale on skill use. The file does not offer a language choice or explain that the template is intended only for a Chinese-language or region-specific workflow.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

All user-facing labels, descriptions, and trigger examples in this file are presented only in Chinese, with no indication that the user can choose another language or locale. This can violate language/locale policy when a skill implicitly mandates one language without documented opt-in or justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file presents all user-facing examples and instructions in Chinese only, with no indication that the user can choose another language. That can violate a language/locale choice policy when the skill is not clearly documented here as region-specific or opt-in language constrained.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

Natural-language policy violations apply to all file types, including markdown. The instructions and suggested invocation phrases are exclusively Chinese, and there is no indication that the skill is region-specific or that users may opt into another language.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This is a markdown file, so missing user warnings apply to described behaviors that affect user data or files. The document explains custom output and file generation behavior, but does not warn users about filesystem side effects such as creating output directories or potentially overwriting prior exports.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

All instructions and invocation phrases in the file are presented only in Chinese, with no indication that the user can choose another language. This can be a language-policy issue if the organization requires skills not to force a specific language absent user opt-in or explicit regional justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The module docstring is written entirely in Chinese and describes the tool specifically as a '番茄专线' word-count checker, with no indication that other languages or locales are supported. Under the policy, forcing a specific language without offering user choice can be a natural-language locale violation.

Content

No source excerpt is available for this finding.