Back to skill

Security audit

faq-knowledge-mining

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed FAQ-mining helper, but its bundled file reader has a weak path boundary that could expose unintended local files.

Review before installing. Use it only with desensitized log files you control, and avoid running it in workspaces that contain secrets or unrelated private files until the file reader is constrained to a dedicated upload directory with canonical path validation.

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

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/read_file.py:25
Finding

Path Containment Bypass Enables Unauthorized Local File Disclosure

Content
View full analysis
MAX_FILE_SIZE: raise ValueError("错误:文件大小超过限制") return abs_path ``` ### Technical Analysis The function attempts to restrict input files to `project_root` by applying `os.path.abspath()` and then performing a string-prefix comparison: ```python if not abs_path.startswith(project_root): ``` A string-prefix check does not establish that the candidate is a descendant of the permitted directory. For example, if the permitted root is `/tmp/project`, a file under `/tmp/project-secret/records.txt` also starts with `/tmp/project` and therefore passes validation. In addition, `os.path.abspath()` normalizes a lexical path but does not resolve symbolic links. A path that appears to be inside the permitted tree can consequently be a symbolic link to a file outside it. The later calls to `os.path.exists()`, `os.path.getsize()`, and `open()` follow symbolic links. The extension is checked using the accepted path after validation rather than the resolved target. Therefore, a symbolic link named with an accepted extension such as `.txt` can point to a target whose real path and extension would otherwise be rejected. ### Attack Path 1. The attacker supplies a path to a file in a sibling directory whose name share ...[truncated 1562 chars]
Remediation
View remediation
MAX_FILE_SIZE: raise ValueError("File exceeds the size limit") return str(candidate) ``` 2. Alternatively, use `os.path.realpath()` together with `os.path.commonpath()`: ```python root = os.path.realpath(project_root) candidate = os.path.realpath(file_path) if os.path.commonpath([root, candidate]) != root: raise ValueError("File path is outside the permitted directory") ``` 3. Restrict file access to a dedicated upload directory rather than the parent directory of the Skill package. 4. Reject symbolic links explicitly when they are not required. Where race conditions are relevant, open files with platform-supported no-follow semantics such as `O_NOFOLLOW`, then validate the opened file descriptor. 5. Apply the extension policy to the canonical target and, where possible, verify the actual file format rather than relying solely on its filename. 6. Add regression tests covering sibling-prefix paths, `..` traversal, absolute external paths, relative and absolute symbolic links, broken links, nested links, and files exceeding the configured size limit. ]]>
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • 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
Findings (3)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

声明的核心能力是对客服会话日志进行分析归纳,提炼FAQ并生成Markdown文档。实际代码只是一个通用文件读取器:校验路径和大小后,读取Excel或文本类文件,并将内容原样或按行列转换为纯文本输出。代码中没有任何统计高频问题、问答配对、摘要、聚类、知识提炼或Markdown FAQ格式化逻辑。因此其主要用途与声明明显不符。尽管“支持Excel文件读取”与部分实现一致,但这只是声明目标的辅助步骤,无法覆盖核心功能缺失。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill instructs use of a local file-reading script (scripts/read_file.py) and accepts multiple file types, but it does not declare any explicit tool scope or permissions boundary. In an agent environment, undocumented file-read capability increases the risk of over-broad filesystem access, unintended ingestion of sensitive local files, and weak auditability of what the skill is allowed to touch.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Multiple user-visible error and usage strings are hard-coded in Chinese, including path validation, dependency, and CLI usage messages. For a general-purpose file-reading skill, this enforces a specific language without user opt-in, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.