Back to skill

Security audit

aliyun-image

Security checks for vulnerabilities and agentic risk

Overview

This skill is mostly a coherent Aliyun DashScope image tool, but its helper script can upload arbitrary readable local files and overwrite arbitrary writable paths without adequate guardrails.

Review before installing. Use only with non-sensitive prompts and images you are authorized to send to Alibaba Cloud DashScope. Avoid giving the helper script arbitrary local paths, do not run it on untrusted instructions, and be careful with the download command because it can overwrite files you can write.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/client.py:142
Finding

Unrestricted Local File Upload Through the Image Editing Interface

Content
View full analysis

Vulnerability Details

File Location: scripts/client.py, lines 142-147
Vulnerability Type: Unrestricted local-file read and external upload
Risk Level: Medium

Vulnerable Code

python
for img in images:
    # Supports local files
    if os.path.exists(img):
        with open(img, "rb") as f:
            b64 = base64.b64encode(f.read()).decode()
        content.append({"image": f"data:image/jpeg;base64,{b64}"})
    else:
        content.append({"image": img})

Technical Analysis

The image editing interface treats every existing filesystem path as a valid image. It reads the entire file, Base64-encodes it, labels it as JPEG data, and subsequently sends it to the configured DashScope API endpoint.

Base64 encoding is a legitimate transport mechanism for local image uploads and is not, by itself, evidence of covert exfiltration. The security issue is the absence of controls confirming that the selected file is an image appropriate for upload. The implementation does not validate:

  • The file extension or detected MIME type.
  • The file's image signature or whether an image parser can decode it.
  • The resolved path or whether it is located in an approved directory.
  • Whether the path points to a regular file rather than a special filesystem object.
  • The documented 10 MB input limit.
  • Whether the selected path is likely to contain credentials or system configuration.

Consequently, any readable local file can be submitted through the editing interface. This behavior exceeds the minimum file access needed for image editing, which only requires access to user-selected and validated image files.

Attack Path

  1. An attacker or untrusted instruction influences the edit command's image argument.
  2. The supplied argument identifies a readable sensitive file rather than an image.
  3. os.path.exists(img) returns true.
  4. The client reads the entire file without validating its typ ...[truncated 1088 chars]
Remediation
View remediation

Remediation Suggestions

  • Resolve the candidate path with Path.resolve() and permit local uploads only from explicitly approved directories.
  • Require explicit user confirmation before uploading any local file to an external service.
  • Reject symbolic links, device files, named pipes, and other non-regular files.
  • Enforce an allowlist of supported image extensions.
  • Verify the actual file signature and decode the file with a trusted image library before upload; do not rely only on extensions.
  • Enforce the documented maximum input size before reading or encoding the file.
  • Derive the correct MIME type instead of unconditionally labeling every file as image/jpeg.
  • Consider accepting file objects selected through a trusted image picker rather than arbitrary filesystem paths.
  • Clearly disclose that selected local images are transmitted to DashScope for processing.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/client.py:174
Finding

Unrestricted URL Download and Arbitrary Writable-Path Overwrite

Content
View full analysis

Vulnerability Details

File Location: scripts/client.py, lines 174-192
Vulnerability Type: Unrestricted network request and unsafe destination-file handling
Risk Level: Medium

Vulnerable Code

python
@staticmethod
def download(url: str, save_path: str) -> str:
    """
    Download an image

    Args:
        url: Image URL
        save_path: Save path

    Returns:
        Saved file path
    """
    resp = requests.get(url, timeout=60)
    resp.raise_for_status()

    with open(save_path, "wb") as f:
        f.write(resp.content)

    return os.path.abspath(save_path)

The interface is exposed directly through the command-line handler:

python
dl_parser = subparsers.add_parser("download", help="Download image")
dl_parser.add_argument("url", help="Image URL")
dl_parser.add_argument("path", nargs="?", default="output.png", help="Save path")
python
elif args.command == "download":
    path = client.download(args.url, args.path)
    print(f"Saved to: {path}")

Technical Analysis

The download operation accepts an arbitrary URL and writes the complete response to an arbitrary path selected by the caller. It does not enforce:

  • HTTPS as the required transport.
  • An allowlist of expected DashScope result hosts.
  • Rejection of loopback, private, link-local, or cloud metadata addresses.
  • Validation of redirect destinations.
  • An image content type or valid image signature.
  • A maximum response size or streamed download limit.
  • A restricted output directory.
  • Protection against overwriting an existing file.

This creates a server-side request forgery-like network primitive when an untrusted party can influence invocation arguments. It also creates an arbitrary file-overwrite primitive within the permissions of the executing user. Because the response is stored but not executed, the code does not independently constitute remote payload e ...[truncated 1857 chars]

Remediation
View remediation

Remediation Suggestions

  • Permit only HTTPS URLs.
  • Prefer an allowlist of documented DashScope result domains where practical.
  • Resolve hostnames and reject loopback, private, reserved, link-local, multicast, and cloud metadata address ranges.
  • Disable redirects or validate every redirect destination using the same network policy.
  • Stream downloads in bounded chunks and enforce a strict maximum size.
  • Validate both the declared content type and the downloaded file's image signature.
  • Restrict output to a dedicated download directory and normalize the destination path before writing.
  • Generate safe filenames instead of accepting arbitrary paths where possible.
  • Refuse to overwrite existing files unless the user explicitly confirms the operation.
  • Write to a temporary file first and atomically rename it only after successful validation.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (39)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This markdown file includes usage examples that POST user prompts and image URLs to DashScope and poll for results, but the surrounding documentation does not warn users that their content is transmitted to a third-party cloud API. For a skill handling user images and text, the README should disclose the remote processing and potential privacy implications.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · README.md (reported line 115)May include surrounding context.

python
import requests

response = requests.post(
    "https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
    headers={
        "Authorization": f"Bearer {DASHSCOPE_API_KEY}"

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · README.md (reported line 137)May include surrounding context.

图像编辑

python
response = requests.post(
    "https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
    headers={"Authorization": f"Bearer {DASHSCOPE_API_KEY}"},
    json={

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · README.md (reported line 160)May include surrounding context.

md
import time

# 1. 创建翻译任务
response = requests.post(
    "https://dashscope.aliyuncs.com/api/v1/services/aigc/image2image/image-synthesis",
    headers={
        "Authorization": f"Bearer {DASHSCOPE_API_KEY}",

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill demonstrates use of environment variables and outbound network access but does not declare any tool scope or allowed-tools constraints. This can lead to overbroad execution permissions in host environments, making it harder to sandbox the skill and increasing the blast radius if the skill or downstream content is modified or abused.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The examples send user prompts, image URLs, and image-translation inputs to a third-party remote API, but the skill does not clearly warn users that their content will be transmitted off-platform. This is dangerous because prompts and image references may contain sensitive personal, proprietary, or regulated data, and users may not realize that content is being shared externally.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · README.md (reported line 115)May include surrounding context.

python
import os, requests

resp = requests.post(
    "https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
    headers={"Authorization": f"Bearer {os.getenv('DASHSCOPE_API_KEY')}"},
    json={

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · README.md (reported line 137)May include surrounding context.

python
import os, requests

resp = requests.post(
    "https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
    headers={"Authorization": f"Bearer {os.getenv('DASHSCOPE_API_KEY')}"},
    json={

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · README.md (reported line 160)May include surrounding context.

python
import os, requests

resp = requests.post(
    "https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
    headers={"Authorization": f"Bearer {os.getenv('DASHSCOPE_API_KEY')}"},
    json={

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

python
import os, requests

resp = requests.post(
    "https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
    headers={"Authorization": f"Bearer {os.getenv('DASHSCOPE_API_KEY')}"},
    json={

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

python
import os, requests

resp = requests.post(
    "https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
    headers={"Authorization": f"Bearer {os.getenv('DASHSCOPE_API_KEY')}"},
    json={

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

python
import os, requests

resp = requests.post(
    "https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
    headers={"Authorization": f"Bearer {os.getenv('DASHSCOPE_API_KEY')}"},
    json={

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/image-edit.md (reported line 203)May include surrounding context.

python
import os, requests

resp = requests.post(
    "https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
    headers={"Authorization": f"Bearer {os.getenv('DASHSCOPE_API_KEY')}"},
    json={

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/image-edit.md (reported line 140)May include surrounding context.

完整示例

cURL

bash
curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The Python example explicitly supports reading local image files and uploading their Base64 contents to a remote Alibaba Cloud endpoint, but the documentation does not warn users that local files will leave the device. In a skill centered on image editing, users may reasonably provide sensitive personal or proprietary images, so omission of a privacy/transmission warning creates a real risk of unintentional data disclosure.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/image-edit.md (reported line 203)May include surrounding context.

md
if size:
        payload["parameters"]["size"] = size

    resp = requests.post(
        "https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
        headers={"Content-Type": "application/json", "Authorization": f"Bearer {api_key}"},
        json=payload

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documentation instructs users to submit image URLs to a third-party API but does not warn that the referenced images and any embedded text may contain sensitive, personal, or regulated data. In a skill focused on image translation, this omission increases the chance that users unknowingly transmit private content to an external processor, creating privacy, compliance, and data-handling risk.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
89% confidence
Finding

The cURL example demonstrates direct transmission of image translation requests to an external service, including authorization credentials and a user-specified image URL. In documentation for an image-processing skill this is expected, but it still presents a real privacy and operational risk if users are not warned that external processing occurs and that images may contain sensitive content.

Content

Scanner excerpt · references/image-translate.md (reported line 243)May include surrounding context.

完整示例

cURL

bash
# 1. 创建任务

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

This duplicate finding points to the same outbound POST request in the Python sample, which transmits user-provided content to a third-party service. While necessary for the feature, it remains a genuine data-transfer risk if operators assume processing is local or submit sensitive images without appropriate review.

Content

Scanner excerpt · references/image-translate.md (reported line 325)May include surrounding context.

md
payload["input"]["ext"] = ext

    # 创建任务
    resp = requests.post(
        "https://dashscope.aliyuncs.com/api/v1/services/aigc/image2image/image-synthesis",
        headers={
            "Content-Type": "application/json",

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

This duplicate finding points to the same outbound POST request in the Python sample, which transmits user-provided content to a third-party service. While necessary for the feature, it remains a genuine data-transfer risk if operators assume processing is local or submit sensitive images without appropriate review.

Content

Scanner excerpt · references/image-translate.md (reported line 325)May include surrounding context.

md
payload["input"]["ext"] = ext

    # 创建任务
    resp = requests.post(
        "https://dashscope.aliyuncs.com/api/v1/services/aigc/image2image/image-synthesis",
        headers={
            "Content-Type": "application/json",

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The document instructs users to send prompts directly to a remote Alibaba DashScope endpoint but does not warn that prompt content leaves the local environment and is transmitted to a third-party service. In an image-generation skill, prompts may contain sensitive business data, personal information, or confidential creative material, so the missing disclosure creates a real privacy and data-handling risk.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
92% confidence
Finding

The cURL example demonstrates direct transmission of prompts and an Authorization bearer token to a remote DashScope endpoint. This is expected for the skill's purpose, but without nearby warnings it can normalize unsafe use, such as sending confidential prompts or exposing tokens through copied commands, shell history, CI logs, or screenshots.

Content

Scanner excerpt · references/text-to-image.md (reported line 101)May include surrounding context.

完整示例

cURL

bash
curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \

External Transmission

Medium
Category
Data Exfiltration
Confidence
94% confidence
Finding

This finding is a duplicate view of the same Python requests.post call and reflects the same security concern: user content and credentials are sent to an external service endpoint. The behavior is not covert or malicious, but the documentation lacks clear disclosure and guardrails around what data should not be transmitted.

Content

Scanner excerpt · references/text-to-image.md (reported line 139)May include surrounding context.

md
if negative_prompt:
        payload["parameters"]["negative_prompt"] = negative_prompt

    resp = requests.post(
        "https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
        headers={"Content-Type": "application/json", "Authorization": f"Bearer {api_key}"},
        json=payload

External Transmission

Medium
Category
Data Exfiltration
Confidence
94% confidence
Finding

This finding is a duplicate view of the same Python requests.post call and reflects the same security concern: user content and credentials are sent to an external service endpoint. The behavior is not covert or malicious, but the documentation lacks clear disclosure and guardrails around what data should not be transmitted.

Content

Scanner excerpt · references/text-to-image.md (reported line 139)May include surrounding context.

md
if negative_prompt:
        payload["parameters"]["negative_prompt"] = negative_prompt

    resp = requests.post(
        "https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
        headers={"Content-Type": "application/json", "Authorization": f"Bearer {api_key}"},
        json=payload

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/client.py (reported line 50)May include surrounding context.

python
def _request(self, payload: dict) -> dict:
        """发送API请求"""
        resp = requests.post(
            API_BASE,
            headers={
                "Content-Type": "application/json",

Static analysis

No suspicious patterns detected.