Back to skill

Security audit

img-upload

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it says by uploading images to a public image host, but its broad trigger and weak file validation create a real risk of unintentionally exposing local files.

Install only if you are comfortable with selected files being sent to img.scdn.io and made publicly accessible. Use it only for non-sensitive images that you explicitly want hosted publicly, and avoid using it for screenshots, documents, credentials, internal work, or private images unless the file has been reviewed first.

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

Error
Location
upload.py:22
Finding

Arbitrary Local File Upload May Cause Public Disclosure

Content
View full analysis

Vulnerability Details

File Location: upload.py, lines 22–31
Vulnerability Type: Missing file-type, path, and size validation before third-party upload
Risk Level: High

Vulnerable Code

python
if not os.path.exists(image_path):
    raise FileNotFoundError(f"图片文件不存在: {image_path}")

with open(image_path, 'rb') as f:
    files = {'image': f}
    data = {}
    if cdn_domain:
        data['cdn_domain'] = cdn_domain
    
    response = requests.post(API_URL, files=files, data=data)

Technical Analysis

The script accepts a caller-provided local path and verifies only that it exists. It does not confirm that the target is a regular image file before reading and transmitting its contents to https://img.scdn.io/api/v1.php.

In particular, the implementation does not:

  • Decode the file with a trusted image library to verify its content.
  • Restrict uploads to approved file formats or MIME types.
  • Restrict file access to an approved directory.
  • Reject symbolic links or other non-regular filesystem objects.
  • Enforce a maximum file size.
  • Require explicit confirmation before transmitting local data to a public third-party service.

This also conflicts with the operational guidance in SKILL.md, which states that the file should be confirmed as an image before upload. Filename-extension checks alone would not adequately fix the issue because arbitrary files can be renamed with image extensions.

Attack Path

  1. An attacker or untrusted prompt influences the image-path argument supplied to the skill.
  2. The supplied path identifies a readable sensitive local file, potentially directly or through a symbolic link.
  3. os.path.exists() succeeds because no approved-root or image-content policy is enforced.
  4. The script opens the file in binary mode.
  5. The complete contents are submitted to the fixed third-party upload API.
  6. If the service accepts the content, it retur ...[truncated 716 chars]
Remediation
View remediation

Remediation Suggestions

  1. Permit uploads only from explicitly approved directories. Resolve paths with realpath() and verify that the resolved path remains within an allowed root.
  2. Require the target to be a regular file and reject symbolic links, directories, devices, sockets, and other special filesystem objects.
  3. Enforce a conservative maximum file size before opening or uploading the file.
  4. Decode and validate the file with a maintained image-processing library, allowlisting only required formats such as JPEG, PNG, or WebP.
  5. Re-encode validated images before upload where practical, removing embedded payloads and unnecessary metadata.
  6. Set the multipart MIME type from the validated image format rather than trusting the filename.
  7. Require explicit user confirmation that the selected file will be transferred to a public third-party service.
  8. Add a request timeout, call response.raise_for_status(), and handle invalid or oversized JSON responses safely.
  9. Treat and display the returned deletion URL as sensitive control information.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill description says it uploads local images and returns public links, but it does not clearly and prominently warn that files are sent to a public third-party host and become externally accessible. This is dangerous because users may unknowingly expose sensitive screenshots, personal images, internal documents, or generated artifacts, and the presence of a delete URL does not eliminate the disclosure risk once shared or cached.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill performs network-capable behavior by uploading local files to a third-party host, but the manifest does not declare any explicit tool scope or permission boundary. This creates a governance and review gap: agents or operators may invoke the skill without clear visibility that it exfiltrates local image data over the network.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The activation text is broad enough to match many normal image-related workflows, including screenshots, generated images, and document insertion tasks. In this context, overbroad triggering is risky because it can cause unnecessary uploads of local files to a public host when the user did not specifically request third-party publication.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script uploads a user-specified local image to a third-party public image hosting service and returns a publicly accessible URL, but it provides no explicit warning, consent step, or privacy notice before transmission. In this skill context, that is a real data-exposure risk because users may upload screenshots or generated images containing sensitive information, and the skill is specifically designed to encourage external sharing.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The natural-language instructions and examples are entirely in Chinese, which can impose a specific language on users without opt-in. Under the stated policy, forcing a language or locale without user choice is a reportable issue unless the locale constraint is clearly documented and justified.

Content

No source excerpt is available for this finding.