Back to skill

Security audit

Universal Doc Processor

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a document parser, but its code trusts supplied file paths and could read local files outside the user’s intended upload.

Review before installing. Use this only in a sandboxed environment or after the publisher fixes path validation, size limits, and retention controls. Do not give it access to directories containing credentials, private workspace files, or other users’ documents unless uploads are constrained to a trusted directory.

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

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/processor.py:75
Finding

Caller-Controlled Path Allows Arbitrary Local File Reads

Content
View full analysis

Vulnerability Details

File Location: scripts/processor.py:75-83, with file-opening sinks at scripts/processor.py:135-153 and scripts/processor.py:202-206
Vulnerability Type: Arbitrary local file read through an unvalidated path
Risk Level: High

Vulnerable Code

python
for file_data in file_list:
    try:
        content = self._parse_file(
            file_data.get('path', ''),
            file_data.get('name', '')
        )
        file_info = FileInfo(
            name=file_data.get('name', 'unknown'),
            path=file_data.get('path', ''),
            size=file_data.get('size', 0),
            content=content
        )

The caller-controlled values are passed to the parser without validation:

python
def _parse_file(self, file_path: str, filename: str) -> str:
    """Parse content according to file type."""
    ext = os.path.splitext(filename)[1].lower()
    
    parsers = {
        '.pdf': self._parse_pdf,
        '.docx': self._parse_docx,
        '.doc': self._parse_docx,
        '.xlsx': self._parse_xlsx,
        '.xls': self._parse_xlsx,
        '.pptx': self._parse_pptx,
        '.ppt': self._parse_pptx,
        '.txt': self._parse_txt,
        '.md': self._parse_txt,
        '.csv': self._parse_csv,
        '.json': self._parse_json
    }
    
    parser = parsers.get(ext, self._parse_binary)
    return parser(file_path)

One resulting file-opening sink is:

python
def _parse_txt(self, file_path: str) -> str:
    """Parse a text file."""
    try:
        with open(file_path, 'rb') as f:
            raw = f.read()
            result = chardet.detect(raw)
            encoding = result['encoding'] or 'utf-8'
            return raw.decode(encoding, errors='ignore')[:50000]
    except Exception as e:
        return f"[Text parsing failed: {e}]"

Technical Analysis

receive_files() trusts th ...[truncated 2418 chars]

Remediation
View remediation

Remediation Suggestions

  1. Do not accept arbitrary filesystem paths from callers. Accept opaque, server-generated upload identifiers and resolve them through a trusted upload registry.
  2. Place uploaded files under a dedicated directory with restrictive permissions.
  3. Canonicalize both the configured upload root and candidate file path with os.path.realpath(), then verify containment using os.path.commonpath().
  4. Reject absolute paths, traversal outside the upload root, symbolic links, device files, directories, sockets, and other non-regular files.
  5. Derive the filename and extension from the validated stored file rather than trusting a separate caller-provided name.
  6. Open files using a race-resistant strategy where supported, such as directory file descriptors and O_NOFOLLOW, to reduce time-of-check/time-of-use and symbolic-link attacks.
  7. Run the processor under a dedicated least-privileged operating-system account with no access to application secrets or other users' files.
  8. Add tests covering absolute paths, ../ traversal, symbolic links, mismatched names and paths, and files outside the upload directory.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/processor.py:202
Finding

Unbounded Text Parsing Can Exhaust Process Memory

Content
View full analysis

Vulnerability Details

File Location: scripts/processor.py:202-206
Vulnerability Type: Uncontrolled resource consumption through an unbounded file read
Risk Level: Medium

Vulnerable Code

python
def _parse_txt(self, file_path: str) -> str:
    """Parse a text file."""
    try:
        with open(file_path, 'rb') as f:
            raw = f.read()
            result = chardet.detect(raw)
            encoding = result['encoding'] or 'utf-8'
            return raw.decode(encoding, errors='ignore')[:50000]
    except Exception as e:
        return f"[Text parsing failed: {e}]"

Technical Analysis

_parse_txt() calls f.read() without a size limit. It then runs encoding detection over the complete byte buffer and decodes the complete file before truncating the resulting string to 50,000 characters.

The final slice does not bound the expensive operations that precede it. During processing, memory may simultaneously contain the original byte buffer and the decoded string, while encoding detection also consumes CPU proportional to the supplied input. A sufficiently large .txt or .md file can therefore cause excessive memory pressure, CPU consumption, swapping, or process termination.

This implementation also conflicts with the documented claim that files larger than 50 MB are processed in chunks; no chunking or enforced size threshold exists in this code path.

Attack Path

  1. The attacker creates or identifies a very large file accessible to the processor.
  2. The attacker submits the file through receive_files() with a filename ending in .txt or .md.
  3. _parse_file() selects _parse_txt().
  4. f.read() attempts to allocate memory for the entire file.
  5. chardet.detect(raw) scans the full buffer, and raw.decode(...) allocates a decoded representation of the full content.
  6. The 50,000-character truncation occurs only after these allocations and processing steps. ...[truncated 703 chars]
Remediation
View remediation

Remediation Suggestions

  1. Enforce a strict maximum accepted file size before parsing, using the actual filesystem size rather than caller-provided metadata.
  2. Read only a bounded sample for encoding detection instead of passing the entire file to chardet.
  3. Process permitted large files incrementally with fixed-size chunks and an incremental decoder.
  4. Stop reading once the maximum extracted-text limit has been reached; do not decode content that will be discarded.
  5. Apply per-request timeouts, memory limits, concurrency limits, and upload quotas.
  6. Reject sparse files or other inputs whose apparent and consumed sizes could bypass naive checks.
  7. Isolate document parsing in a resource-constrained worker or sandbox so parser exhaustion cannot terminate the main Agent process.
  8. Add tests using oversized text and Markdown files to confirm bounded peak memory and processing time.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

描述中的状态管理、收到文件后等待用户指令、信息不足时追问、保留文件支持多轮任务,这些核心流程与代码大体一致。但描述对能力范围有明显夸大:代码并非“所有格式/无大小限制”,而是有限格式解析并带多处截断限制;更重要的是,代码没有真正实现文档分析、修改、摘要、提取、翻译等核心任务,只是记录任务并返回一个模拟执行结果。因此,声明用途与实际行为存在实质性不匹配。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description forces a specific language/locale in user-facing skill instructions, and there is no indication that users can opt into another language. This matches the policy category for language or locale constraints that are not justified or optional.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The processor reads and stores document contents in memory (self.files[].content) immediately after upload without any user-facing disclosure, minimization, or retention control. Because this skill is designed for arbitrary user documents, it is likely to handle sensitive data; silent ingestion and retention increases confidentiality risk if downstream components log, expose, or reuse that content.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The description promises support for all formats, but the parser dispatch only recognizes a specific set of extensions like PDF, Word, Excel, PPT, text, CSV, and JSON. Unrecognized formats are not truly processed; they are reduced to a binary preview, which does not match the claimed universal document handling capability.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest explicitly states the skill supports files with 'no size limit', but the implementation truncates parsed content for PDFs to 50 pages and 50,000 characters. Similar hard limits exist for other formats, so the actual behavior is materially narrower than the declared capability.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill metadata says uploaded files should only be parsed/stored after explicit user tasking, but receive_files immediately opens and parses file contents upon upload. In a document-processing context, this matters because merely uploading a sensitive or malicious file triggers content ingestion earlier than the user was told, increasing privacy exposure and attack surface in parsers.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The translation handling logic only recognizes Chinese prompts that explicitly mention English, Chinese, or Japanese, then asks for a target language otherwise. This embeds a narrow language expectation in natural-language behavior and does not clearly present translation as open to any user-selected language, which can conflict with language-choice policy expectations.

Content

No source excerpt is available for this finding.