Back to skill

Security audit

Book Processor

Security checks for vulnerabilities and agentic risk

Overview

This EPUB-processing skill mostly matches its stated purpose, but it can automatically run privileged package installation and process untrusted archives without enough safeguards.

Review carefully before installing. Use only on trusted EPUBs, preferably in a sandboxed environment with no sudo privileges, and install dependencies separately through approved system setup. Expect generated summaries and framework files to include generic templates that may need manual review rather than reliable book-specific analysis.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/process_book.sh:20
Finding

Unrestricted Extraction and Parsing of Untrusted EPUB Archives

Content
View full analysis
]+>', ' ', html) txt = re.sub(r'\s+', ' ', txt).strip() if txt: # 只添加非空内容 parts.append(txt) except Exception as e: print(f"Warning: failed to read {fn}: {e}", file=sys.stderr) with open(out_path, 'w', encoding='utf-8') as out: out.write('\n\n'.join(parts)) PY ``` ### Technical Analysis The script treats an uploaded EPUB as a trusted ZIP archive and extracts it without first validating archive members. It does not reject: - Absolute paths or entries containing parent-directory traversal components. - Symbolic links or other non-regular file types. - Excessive archive member counts. - Excessive total uncompressed size. - Highly compressed files intended to exhaust disk space. - Files whose resolved paths fall outside the intended extraction directory. The Python processing stage then recursively finds every file ending in `.html` or `.xhtml` and opens it without checking whether it is a symbolic link or whether its canonical path remains under `TMP_DIR`. Consequently, an archive-created link with an XH ...[truncated 1704 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/process_book.sh:20
Finding

Predictable Temporary Directory and Incomplete Cleanup

Content
View full analysis
` names. 2. The attacker pre-creates candidate paths or manipulates accessible entries beneath a matching directory. 3. The Skill processes an EPUB and selects one of those names using `$RANDOM`. 4. `mkdir -p` accepts the existing directory rather than failing securely. 5. EPUB data is extracted into a location influenced or observable by the local attacker. 6. Alternatively, the attacker supplies a malformed EPUB that causes an early error or quality-check exit. 7. Because cle ...[truncated 615 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/process_book.sh:58
Finding

Document Processing Automatically Invokes Privileged Package Installation

Content
View full analysis
/dev/null; then echo "jq 未安装,尝试使用 apt-get 安装..." sudo apt-get update && sudo apt-get install -y jq fi ``` ### Technical Analysis The script invokes `sudo apt-get` during ordinary EPUB processing when `jq` is unavailable. Document conversion does not legitimately require package-manager privileges at runtime. This behavior crosses a least-privilege boundary and modifies the host's system package state as a side effect of processing user-provided content. If the execution account has passwordless `sudo` access to `apt-get`, the modification occurs automatically. Otherwise, processing may block while requesting credentials or fail unexpectedly. The installation also contacts repositories configured outside the project. Although no malicious repository is embedded in the audited code, runtime security becomes dependent on the host's package sources and package-manager configuration. ### Attack Path 1. The Skill runs on a host where `jq` is not installed. 2. An attacker or ordinary user uploads an EPUB, invoking the automatic processing workflow. 3. Execution reaches the dependency check. 4. The script invokes `sudo apt-get update`. 5. If the Skill account has suitable sudo permissions, the script refreshes package indexes and installs `jq` with elevated privileges. 6. The host is modified without a separate administrator-controlled installation step. If configured repositories or package-manager settings are compromised, privileged package installation increases the resulting exposure. ### Impact Assessment The immediate privilege obtained by the EPUB uploader is indirect: the uploader can trigger a code path that requests or uses administrative package-management privileges. The current command installs ...[truncated 439 chars]
Remediation
View remediation
/dev/null 2>&1; then echo "Error: jq is required. Install it before running this Skill." >&2 exit 1 fi ``` 3. Prefer Python's standard `json` module, since Python is already required, to avoid the additional `jq` dependency. 4. Run the Skill under an unprivileged service account without sudo permissions. 5. Pin and provision dependencies through an administrator-controlled image, package manifest, or deployment process. 6. Apply network restrictions so document processing cannot unexpectedly contact package repositories or other external services. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (19)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The documented behavior does not cleanly match the operational behavior: the skill claims content-derived outputs but also includes system package installation guidance and apparently generates some template-driven artifacts unrelated to the uploaded book. This mismatch is dangerous because users and orchestrators may grant trust or permissions based on the declared purpose while the actual behavior can modify the host environment or produce misleading outputs.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script performs privileged system package installation via sudo apt-get during normal book processing, which exceeds the stated purpose of processing EPUB files. In an agent or automation context this can trigger unexpected root-level system modification, expand attack surface, and violate least-privilege expectations if the skill is run on shared or sensitive hosts.

Content

No source excerpt is available for this finding.

Chaining Abuse

High
Category
Tool Misuse
Confidence
94% confidence
Finding

The chained privileged command combines update and install in one non-interactive flow, making host modification more automatic and harder to interrupt or review. In an automation skill this increases the risk of unintended system changes and compounds the danger of unjustified root access for a task that should remain limited to file processing.

Content

Scanner excerpt · scripts/process_book.sh (reported line 67)May include surrounding context.

sh
# 4. 读取配置(使用 jq)
if ! command -v jq >/dev/null; then
  echo "jq 未安装,尝试使用 apt-get 安装..."
  sudo apt-get update && sudo apt-get install -y jq
fi

check_flag() {

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest promises extraction plus summaries and framework interpretations for arbitrary EPUB books. However, the script writes fixed thematic content about personal growth, inner enemies, and Munger-style thinking models, which can substantially misrepresent books with unrelated subjects instead of actually generating book-specific analyses.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/process_book.sh (reported line 296)May include surrounding context.

sh
echo "- **持久**:..." >> "$BOOK_DIR/examples.md"
    echo "" >> "$BOOK_DIR/examples.md"
  done < "$BOOK_DIR/examples.tmp"
  rm "$BOOK_DIR/examples.tmp"
fi

# 6.2 每日清单

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The workflow describes creating directories under the user's home workspace, saving uploaded content, and executing a local shell script, but it does not warn the user that these actions will occur automatically. This reduces informed consent and can lead to unsafe operation of a skill that performs filesystem modifications and code execution on attacker-controlled files.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README states that processing should trigger automatically whenever a file is received, but the skill is specifically intended for EPUB handling and the trigger condition does not require validating file type, size, source, or explicit user confirmation before writing files and invoking a local shell script. In this context, an overly broad auto-trigger increases the chance of unintended local file writes and execution of the processing pipeline on untrusted input, which can amplify downstream parsing or script vulnerabilities.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill advertises file and environment-related behavior but does not declare any explicit tool scope such as permissions or allowed-tools. In an agent environment, missing tool constraints can cause the runtime or reviewer to underestimate what the skill may read, write, or inspect, increasing the chance of over-broad file access during EPUB processing.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest description and the entire user-facing documentation are written only in Chinese, and the usage text implies the skill will process and report results in that language. There is no indication that users can opt into another language or locale, which can violate a language/locale policy requiring user choice.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
83% confidence
Finding

Including sudo apt-get install instructions inside the skill documentation normalizes privileged system modification as part of using the skill. In agent or semi-automated contexts, this can lead to unnecessary root-level package changes, expanding attack surface and violating least-privilege expectations.

Content

Scanner excerpt · SKILL.md (reported line 77)May include surrounding context.

md
### 必需工具
| 工具 | 用途 | 安装命令 |
|------|------|----------|
| `jq` | JSON 配置解析 | `sudo apt-get install -y jq` |
| `python3` | 文本提取 | `sudo apt-get install -y python3` |
| `unzip` | EPUB 解压 | `sudo apt-get install -y unzip` |

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
83% confidence
Finding

The skill documentation instructs installation of python3 with sudo, again encouraging root-level host modification. While not inherently malicious, embedding this in the skill broadens the expected operational scope from EPUB processing to system administration, which is risky in constrained agent environments.

Content

Scanner excerpt · SKILL.md (reported line 78)May include surrounding context.

md
| 工具 | 用途 | 安装命令 |
|------|------|----------|
| `jq` | JSON 配置解析 | `sudo apt-get install -y jq` |
| `python3` | 文本提取 | `sudo apt-get install -y python3` |
| `unzip` | EPUB 解压 | `sudo apt-get install -y unzip` |

### 验证安装

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
83% confidence
Finding

The sudo apt-get install -y unzip instruction promotes privileged package installation within the skill documentation. If operators or automation treat the skill text as actionable setup guidance, this can trigger unnecessary root operations and increase system exposure beyond the skill's stated file-processing purpose.

Content

Scanner excerpt · SKILL.md (reported line 79)May include surrounding context.

|------|------|----------| | jq | JSON 配置解析 | sudo apt-get install -y jq | | python3 | 文本提取 | sudo apt-get install -y python3 | | unzip | EPUB 解压 | sudo apt-get install -y unzip |

验证安装

bash

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
81% confidence
Finding

Repeating sudo apt-get install commands in troubleshooting reinforces privileged execution as a normal recovery path. In security-sensitive agent environments, this can desensitize operators to root prompts and blur the boundary between document processing and system-level changes.

Content

Scanner excerpt · SKILL.md (reported line 138)May include surrounding context.

md
| 问题 | 原因 | 解决 |
|------|------|------|
| `jq 未安装` | 缺少依赖 | `sudo apt-get install -y jq` |
| `unzip: command not found` | 缺少解压工具 | `sudo apt-get install -y unzip` |
| `未找到 epub 文件` | 文件夹内无 `.epub` 文件 | 确保 EPUB 文件已放入书籍文件夹 |
| 生成文件为空 | EPUB 为图片格式 | 手动补充 `summary.txt` 和 `framework_article.txt` |

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
81% confidence
Finding

This troubleshooting guidance again instructs root-level package installation for unzip, creating the same least-privilege and host-modification concerns. The danger is contextual: a content-processing skill should not implicitly encourage elevated remediation paths inside its operational documentation.

Content

Scanner excerpt · SKILL.md (reported line 139)May include surrounding context.

md
| 问题 | 原因 | 解决 |
|------|------|------|
| `jq 未安装` | 缺少依赖 | `sudo apt-get install -y jq` |
| `unzip: command not found` | 缺少解压工具 | `sudo apt-get install -y unzip` |
| `未找到 epub 文件` | 文件夹内无 `.epub` 文件 | 确保 EPUB 文件已放入书籍文件夹 |
| 生成文件为空 | EPUB 为图片格式 | 手动补充 `summary.txt` 和 `framework_article.txt` |

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Installing packages with sudo apt-get without explicit upfront warning or confirmation causes unexpected privileged changes on the host. In an agent skill, users may reasonably expect file processing only; silent elevation attempts are dangerous because they normalize root operations and can alter system state without informed consent.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
97% confidence
Finding

The explicit use of sudo introduces root-level execution into a workflow that should only parse local EPUB content. In the skill context this is more dangerous because book-processing does not inherently require elevated privileges, so any root action is unjustified and increases the consequences of misuse, operator confusion, or future code changes.

Content

Scanner excerpt · scripts/process_book.sh (reported line 67)May include surrounding context.

sh
# 4. 读取配置(使用 jq)
if ! command -v jq >/dev/null; then
  echo "jq 未安装,尝试使用 apt-get 安装..."
  sudo apt-get update && sudo apt-get install -y jq
fi

check_flag() {

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

While the manifest advertises multiple assets generated from the EPUB, these sections are emitted as static templates with a fixed 'combat/enemy' framing and no substantive linkage to the extracted text. This is a behavior mismatch because the skill appears to promise book-driven analysis artifacts but instead creates generic, prewritten materials.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
72% confidence
Finding

The description states that processing occurs when the user sends an EPUB file directly to "福德", which embeds a specific language-specific assistant name/context without offering any user choice or clarifying that this locale is intentional. This may violate language or locale policy if the skill is expected to be language-neutral unless the user opts in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The script's user-facing comments, status messages, generated report text, and output templates are written entirely in Chinese. This imposes a fixed language/locale on users without opt-in or documented justification, which matches the language-policy violation criteria.

Content

No source excerpt is available for this finding.