Back to skill

Security audit

large-file-handler

Security checks for vulnerabilities and agentic risk

Overview

This skill appears intended to process large uploads, but it overstates completed functionality and may retain or handle uploaded files less safely than users expect.

Install only after reviewing the file-handling risks. This skill can write uploaded files to local workspace storage and launch background Python processes; operators should add request-size limits before writing to disk, unpredictable per-job storage paths, user/job isolation, scheduled cleanup for all temp states, real notification handling, and clear user disclosure before enabling automatic Gateway processing.

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

T09 · Insecure Skill Coding Practices

Error
Location
handler.py:101
Finding

Upload Size Limit Is Enforced Only After the Entire File Is Written

Content
View full analysis
MAX_FILE_SIZE: file_path.unlink() # Delete file return { 'success': False, 'error': f'File too large ({format_size(file_size)}); maximum supported size is {format_size(MAX_FILE_SIZE)}' } ``` ### Technical Analysis The configured 500 MB maximum is not enforced while receiving the stream. The handler continues reading and writing until the input reaches end-of-file, regardless of how much data has already been received. It then checks the accumulated size and deletes the file if the limit was exceeded. Consequently, the limit controls whether a completed upload is accepted, but it does not bound temporary disk consumption. A client able to invoke this handler can send a file substantially larger than 500 MB or, depending on the surrounding Gateway behavior, provide a long-running stream. The application will continue consuming disk space until the stream ends, an upstream request limit interrupts it, or the filesystem becomes full. Deletion after completion does not mitigate exhaustion during the upload. Exceptions during reading or writing can also leave a partial file because the function has no exception-safe cleanup block. ### Attack Path 1. An attacker initiates an upload through a Gateway endpoint that passes the reque ...[truncated 1184 chars]
Remediation
View remediation
Tuple[Path, int]: ensure_dirs() dest_path = PENDING_DIR / f"{uuid.uuid4().hex}.upload" total_size = 0 try: with open(dest_path, 'xb') as f: while True: chunk = file_stream.read(CHUNK_SIZE) if not chunk: break if total_size + len(chunk) > MAX_FILE_SIZE: raise ValueError("File exceeds the maximum permitted size") f.write(chunk) total_size += len(chunk) return dest_path, total_size except Exception: dest_path.unlink(missing_ok=True) raise ``` 2. Configure a request-body limit at the Gateway or reverse-proxy layer so oversized requests are rejected before they reach Python. 3. Apply upload timeouts, rate limits, concurrent-upload limits, and per-user storage quotas. 4. Reserve adequate filesystem capacity and monitor pending-storage usage. 5. Ensure partial files are removed in exception and cancellation paths. 6. Consider storing uploads on a dedicated quota-limited volume so exhaustion cannot affect the operating system or unrelated services. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
handler.py:98
Finding

Predictable Upload Names Permit File Collisions and Overwrites

Content
View full analysis
Remediation
View remediation
/payload`, rather than placing all uploads in one flat directory. 6. Associate the job identifier with the authenticated user in trusted server-side state. 7. Use restrictive permissions on upload directories and prevent untrusted local users from creating files or symbolic links there. 8. Apply the same naming and validation logic consistently in both `handler.py` and `scripts/handle_file.py`. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
handler.py:221
Finding

Uploaded Files Are Retained Indefinitely Because Cleanup Is Never Scheduled

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (36)

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · PUBLISH.md (reported line 86)May include surrounding context.

md
---

## 🔄 更新技能 | Update Skill

如果需要更新(修复 bug、添加功能):
If you need to update (bug fixes, new features):

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description emphasizes an automatic large-file async pipeline with streaming upload handling and broad file-type support. The supplied code does not implement those core behaviors. It is a standalone CLI processor invoked with explicit arguments, not an auto-triggered large-file handler. It performs synchronous processing, extracts only metadata, returns a stub message instead of actual content extraction, and prints results rather than integrating with a real push channel. Additionally, it moves processed files to a completed directory and removes a lock file, behaviors not mentioned in the description. These differences are material to the skill’s primary purpose, so this is a mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The declared description presents a broad large-file async processing system with automatic activation, streaming ingestion, background execution, and support for many file types. The supplied code chunk instead implements only a PDF-focused processing script, and even that is mostly scaffolding: PDF extraction and message pushing are TODOs/placeholders. While moving files and deleting lock files may fit a processing pipeline, the primary purpose and implemented behavior are materially narrower and different from the declared description. There is no evidence of upload handling, file-size threshold logic, gateway protection via async processing, or multi-format coverage.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

描述与代码总体方向相关,都是围绕按文件大小区分同步/异步处理,并按类型分派处理器。但存在若干重要不一致:首先,描述强调用户发送大文件时自动启用,而代码只是一个命令行脚本,没有消息接入或自动触发机制。其次,描述声称采用“流式保存”,但代码实际使用 shutil.copy2 一次性复制文件,没有流式读写实现。再次,异步处理仅在大文件时通过 subprocess.Popen 启动后台进程,小文件分支并未调用任何处理器,和“支持 PDF、视频、图片、日志、Office 文档等处理”相比实现不完整。最后,“处理完成后主动推送结果”在本代码中没有实际推送逻辑,只是打印提示并把 user/channel 传给其他脚本,真正推送若存在也依赖未提供的下游处理器。因此该代码块没有完全准确体现声明的能力,属于描述与行为存在实质性偏差。

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The integration instructions encourage automatic background processing and storage of user-uploaded files without requiring any user notice, consent, retention disclosure, or handling policy. In a file-processing skill, this increases privacy and compliance risk because potentially sensitive documents are persisted and processed asynchronously outside the user's immediate awareness.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The documentation materially misrepresents behavior: it advertises proactive result push, but the TODO section says real message push is not implemented and only a print placeholder exists. This can cause operators to rely on asynchronous completion notifications that never occur, leading to silent processing failures, missed user communications, and insecure operational assumptions around file handling workflows.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README states that completed files are automatically cleaned up after 24 hours, but it does not clearly warn users that uploaded data may be deleted before they retrieve results or preserve needed evidence. For a file-handling skill that processes user documents asynchronously, undocumented retention/deletion behavior can cause data loss, compliance issues, and unsafe assumptions about persistence.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill demonstrates file-writing and subprocess execution capabilities but does not declare any tool scope or permissions boundaries. That makes the effective privilege surface opaque to reviewers and increases the chance that an agent can invoke filesystem or shell-like behavior without explicit user or platform consent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The entire skill description and user interaction examples are written only in Chinese, including the quoted user-facing response text, with no indication that users may choose another language. Under the language/locale policy, forcing a specific language without opt-in is a natural-language policy concern unless clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill stores uploaded files on disk and retains completed files for 24 hours without clearly warning users. For potentially sensitive PDFs, logs, office files, or images, undisclosed retention materially increases privacy, compliance, and breach impact if the temp storage is exposed or insufficiently isolated.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The documented use of subprocess.Popen to spawn handler scripts expands the skill from passive file handling into arbitrary process execution. If handler selection or file arguments are not tightly controlled, this creates a larger attack surface for unauthorized code execution, persistence, or abuse of host resources.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest describes an asynchronous large-file processor that streams, processes, and pushes results, but this file also performs lifecycle management by relocating the original file and deleting a companion lock file. Those filesystem modifications are not mentioned in the stated behavior and are more than a purely processing-oriented implementation from the description alone.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This code moves the input file into a completed directory and deletes a corresponding .lock file, which are file-modifying and deletion operations. Although there are runtime status prints, there is no prior warning in the file's user-facing description or CLI help that processing will relocate the original file and remove related lock files.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file's natural-language documentation and user-facing status/error messages are entirely in Chinese, including messages returned to users. Under the policy, forcing a specific language without user opt-in is a locale/language policy violation unless the skill explicitly offers a choice or documents a justified locale restriction.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This code moves uploaded files into a processing directory and starts separate processor scripts via subprocess.Popen, which is a safety-relevant operation for a code file. Although the returned message says the file is being processed in the background, there is no confirmation prompt or explicit disclosure in the execution path itself about spawning subprocesses or handing the file off to another process.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest describes streaming save, background asynchronous processing, and pushing results, but does not disclose that implementation is performed by launching separate Python processes. Process spawning is a materially stronger capability than simple file handling and is not obviously required by the stated skill description alone.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · handler.py (reported line 162)May include surrounding context.

python
script_path = Path(__file__).parent / "processors" / f"{handler_type}.py"
    
    if script_path.exists():
        subprocess.Popen([
            sys.executable, str(script_path),
            '--file', str(processing_path),
            '--user-id', user_id,

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · handler.py (reported line 171)May include surrounding context.

python
creationflags=subprocess.CREATE_NEW_PROCESS_GROUP if sys.platform == 'win32' else 0)
    else:
        # 如果处理器脚本不存在,使用通用处理器
        subprocess.Popen([
            sys.executable, str(Path(__file__).parent / "generic_processor.py"),
            '--file', str(processing_path),
            '--handler', handler_type,

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The handle_file function returns user-facing success and error messages only in Chinese, and the code shows no opt-in or fallback based on user preference. This creates a language policy issue because the skill dictates the interaction language rather than allowing or detecting the user's locale.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The top-level documentation states concrete capabilities such as text extraction and document summarization, but extract_pdf_info explicitly says the real implementation is not present and only fills placeholder values. This is an active contradiction between documented intent and actual behavior, not merely missing detail.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

The manifest describes a large-file handler that streams, asynchronously processes files, and pushes results, but this processor also performs lifecycle-changing filesystem operations: it relocates the original PDF into a completed directory and deletes a related lock file. Those are side effects beyond simple extraction/summarization and are not disclosed in the manifest or this file's top-level feature list.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The code moves the input PDF into a completed directory and deletes a related .lock file, which are file-system modifying operations. Although there is console logging for process start and completion, there is no explicit warning or explanatory disclosure to the user that their original file location will be changed and a lock file may be removed.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code file contains natural-language strings in the module docstring that require Chinese comprehension to use the tool, including usage and examples. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly justified, which is not present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Multiple docstrings, argparse descriptions, help strings, and printed status/error messages are presented only in Chinese. Because the file does not offer a language selection mechanism or explain that the tool is region-specific, it enforces a locale choice in a way the policy disallows.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest describes the skill as using '流式保存 + 后台异步处理' to avoid gateway blocking when handling large files. In this implementation, the file is copied with shutil.copy2 into a pending directory, which is a whole-file copy operation rather than stream-based ingestion, so the documented behavior does not match the actual implementation.

Content

No source excerpt is available for this finding.