Back to skill

Security audit

auto-novel-writer

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Chinese novel-writing helper, but its local file scripts can read or write outside the intended novels folder through unsanitized path inputs.

Review before installing. Use it only in a dedicated workspace, avoid absolute paths or names containing ../, and back up existing writing projects before running create or chapter commands. Expect Chinese-language prompts and local file reads/writes as part of normal operation.

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/novel_manager.py:53
Finding

Path Traversal Through Unsanitized Novel Directory Names

Content
View full analysis
Path: """Get the chapter directory path.""" return get_novels_dir() / novel_name / "chapters" / f"{volume:02d}-{chapter:03d}" ``` ```python # lines 290–294 chapters_dir = get_novels_dir() / novel_name / "chapters" if not chapters_dir.exists(): return [] ``` ```python # lines 353–354 meta_path = get_novels_dir() / novel_name / "meta.md" ``` ```python # lines 377–378 novel_dir = get_novels_dir() / novel_name if not novel_dir.exists(): ``` ### Technical Analysis The application constructs filesystem paths by directly joining caller-controlled `name_en` and `novel_name` values with the relative `novels` root. The `sanitize_name()` function is applied only when `name_en` is omitted. An explicitly supplied English name is accepted without validation. Furthermore, subsequent operations such as chapter creation, status retrieval, backlog generation, and metadata updates use `novel_name` without sanitization or canonical containment checks. Python's `pathlib.Path` join operation does not remove or reject parent-directory components. For example: ```text novels/../../tmp/attacker-book ``` resolves outside the intended `novels/` directory. Absolute path components may also replace the preceding path during path composition. The vulnerable path is subsequently used by directory-creation, file-read, and file-write operations. Chapter creation is especially relevant because it creates missing parent directories and writes templates using `write_text()`, overwriting files with the expected fix ...[truncated 2554 chars]
Remediation
View remediation
str: if not name or not SAFE_NOVEL_NAME.fullmatch(name): raise ValueError("Invalid novel name") return name ``` 2. **Apply validation consistently** Validate both `name_en` and every `novel_name` argument, regardless of whether the value was explicitly supplied or generated from another name. 3. **Enforce canonical path containment** Resolve the root and candidate path before every filesystem operation and confirm that the candidate remains beneath the root: ```python def safe_novel_dir(name: str) -> Path: validated_name = validate_novel_name(name) root = get_novels_dir().resolve() candidate = (root / validated_name).resolve() if not candidate.is_relative_to(root): raise ValueError("Novel path escapes the configured root") return candidate ``` For Python versions without `Path.is_relative_to()`: ```python try: candidate.relative_to(root) except ValueError: raise ValueError("Novel path escapes the configured root") ``` 4. **Use the safe helper everywhere** Replace direct expressions such as: ```python get_novels_dir() / novel_name ``` with `safe_novel_dir(novel_name)` in creation, chapter, backlog, status, metadata, chapter-writer, and consistency-checker paths. 5. **Prevent accidental overwrite** Before writing chapter files, either reject existing files or require an explicit overwrite option: ```python content_path = chapter_dir / "content.md" if content_path.exists() and not overwrite: raise FileExistsError(f"Refusing to overwrite {content_path}") ...[truncated 315 chars]
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (15)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

代码总体仍属于小说写作辅助工具,与声明的大方向一致,没有发现越权、外部网络访问或明显恶意行为。但声明描述的若干核心能力在该代码片段中并未真正实现,而只是部分相关或间接支持:例如“多小说管理”没有管理逻辑,“章节记忆管理”主要是读取已有文件形成上下文,“AI味去除”只是提示约束而非文本处理能力。同时,代码还包含生成摘要/笔记模板的功能,这属于声明未明确说明的附加能力。基于描述与实际行为存在这些实质性偏差,应判定为不完全匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
89% confidence
Finding

描述将该技能定位为“写作助手”并强调 AI 相关能力(如去除 AI 味、解决长上下文限制),但代码并未调用模型、分析文本或进行任何改写/润色操作。它主要管理本地小说目录结构、元数据、章节模板与摘要回顾,确实部分支持多小说管理、章节摘要回顾和大纲模板,但这些都是文件管理层面的基础功能。描述中最突出的 AI 写作辅助能力与代码行为不符,因此存在实质性描述-行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

描述涵盖一个较完整的长篇小说写作助手,包含项目管理、记忆管理与大纲追踪等核心功能;但提供的代码片段只是一個风格检查工具,主要用于文本分析和建议生成,确实与“AI味去除”和“爽文风格建议”部分相关。它没有实现多小说管理、章节状态保存、记忆机制、大纲跟踪,也没有体现任何解决长上下文限制的逻辑。因此描述只部分覆盖实际代码,且整体宣称的主要用途明显大于代码实际能力,构成描述与行为不匹配。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill explicitly instructs reading and writing local files and even creating directory structures, but it declares no tool scope or permission boundaries. In an agent environment, this can lead to overbroad filesystem access, making unintended reads or writes possible if the agent or surrounding runtime grants more access than the user expects.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest description and opening instructions are written as a Chinese-only skill specification and require inputs such as '小说名称(中文)', indicating a fixed language/locale assumption. This can violate language/locale policy because the skill does not offer the user any choice of language or explain a justified region-specific constraint.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill instructs automatic creation and modification of files and directories without an explicit warning or confirmation step. In practice, this can cause unintended filesystem changes, overwrite user content, or create artifacts in the wrong location, especially when novel names or paths are user-influenced.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This is a code file, so natural-language policy checks apply to its docstrings and user-facing strings. The title and surrounding user-facing text present the tool exclusively in Chinese, and the CLI usage/help and status messages elsewhere in the file also remain Chinese-only, with no opt-in or documented reason for the locale restriction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The embedded natural-language instructions require a fixed Chinese writing format and content conventions, including Chinese headings and output structure, with no opt-in or language-selection mechanism. This can violate language/locale policy when a skill mandates one language unconditionally rather than allowing user choice or documenting a justified locale constraint.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

L285-L287 的命令说明和 L286-L287 的用途描述表明 summary/note 应该只读取内容文件并生成模板。但在 L321 和 L335,代码调用 ChapterWriter("temp"),而其构造函数在 L26-L27 要求对应小说目录必须存在,因此这两个命令在多数环境下会因 FileNotFoundError 失败,与文档描述直接矛盾。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This Python skill presents its purpose, docstrings, CLI help text, and status/output messages in Chinese, which effectively forces a specific language on users. The file does not provide any opt-in, fallback, or documentation indicating that the skill is intentionally limited to Chinese-speaking users for a justified regional purpose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This Python skill is entirely described and oriented around Chinese-language analysis, and the docstring states its purpose only in Chinese. Because there is no indication that users can choose another language or that the locale restriction is explicitly documented as a justified regional constraint, this creates a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The skill directs the agent to automatically read multiple local files to assemble context, but it does not warn users about that access pattern or define scope limits. Even though the intended context is the novel project, absent disclosure and path constraints this can expose more local content than users expect if filenames or directories are manipulated.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

SQP-3 applies to all file types and covers language or locale policy violations. This markdown file presents all instructions and examples exclusively in Chinese, with no opt-in, alternative language option, or justification that the skill is region-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

This Python code accepts a path from the command line and reads the referenced file contents via read_text(), but the only visible messaging is a usage string and missing-file error. There is no explicit warning or disclosure that the command will access arbitrary local files provided by the user.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

SQP-3 applies to all file types and covers language or locale policy violations in natural-language content. The module docstring and subsequent user-facing messages indicate the skill is designed to operate only in Chinese, with no indication that users can select another language or that the constraint is documented as region-specific.

Content

No source excerpt is available for this finding.