T03 · Remote Payload Retrieval and Execution
- Location
SKILL.md:28- Finding
Mandatory execution of an unpinned remote npm package
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is for image canvas workflows, but it asks agents to automatically run mutable external code and persist API keys while under-disclosing some data exposure.
Review this skill carefully before installing. Use it only in a restricted environment, avoid automatic activation, pin and verify the npm package version, do not store provider API keys in shell startup files, and do not pass sensitive local files or internal URLs as image inputs unless you intend them to be sent to the selected service.
SKILL.md:28Mandatory execution of an unpinned remote npm package
SKILL.md:68API keys are required to be stored persistently in plaintext startup configuration
scripts/push_to_canvas.py:27Unrestricted image and marker URL fetching enables SSRF and resource exhaustion
scripts/qwen_edit_image.py:63Arbitrary local image contents are uploaded to Qwen despite contradictory privacy disclosure
scripts/gemini_generate_image.py:17Configurable API base URLs can redirect credentials and prompts to untrusted endpoints
The request URL is derived from environment-controlled GEMINI_BASE_URL and then used in urllib.request.urlopen with an Authorization header carrying the Gemini API key. If an attacker can influence the environment or deployment config, they can redirect requests to an attacker-controlled host and exfiltrate the credential and prompt data; in this image-generation skill, transmitting prompts externally is expected, but allowing the destination itself to be overridden materially increases risk.
req = urllib.request.Request(url, data=data, headers=headers, method="POST")
try:
with urllib.request.urlopen(req, timeout=300) as resp:
result = json.loads(resp.read().decode("utf-8"))
except urllib.error.HTTPError as e:
error_body = e.read().decode("utf-8", errors="replace")
The upload target is derived from environment-controlled CANVAS_SERVER and used for a POST of image content. If an attacker can set this variable, the skill can be coerced into sending generated image data or large payloads to an unintended internal or external endpoint, creating SSRF/data exfiltration risk; the canvas context makes local uploads expected, but not arbitrary destination control.
method="POST",
)
try:
with urllib.request.urlopen(req, timeout=30) as resp:
result = json.loads(resp.read().decode("utf-8"))
return result.get("url", "")
except Exception:
The script fetches an attacker-controlled image_url with urllib and only distinguishes 'local' vs 'non-local' by hostname prefix, without validating scheme, resolving redirects, or restricting destinations. In an agent skill context, this creates an SSRF primitive that can reach internal services, cloud metadata endpoints, or local resources, and it also downloads arbitrary-sized content into memory, increasing abuse potential.
def _download_and_upload(image_url: str) -> str:
"""下载远程图片并上传到本地服务器,返回本地 URL"""
req = urllib.request.Request(image_url, headers={"User-Agent": "Mozilla/5.0"})
with urllib.request.urlopen(req, timeout=60) as resp:
image_data = resp.read()
content_type = resp.headers.get("Content-Type", "image/png")
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
headers={"Content-Type": f"multipart/form-data; boundary={boundary}"},
method="POST",
)
with urllib.request.urlopen(upload_req, timeout=30) as resp:
result = json.loads(resp.read().decode("utf-8"))
return result.get("url", image_url)
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
headers={"Content-Type": "application/json"},
method="POST",
)
with urllib.request.urlopen(req, timeout=10) as resp:
resp.read()
return element_id, final_url
The skill description emphasizes canvas/image operations, but the actual behavior includes local file reading, remote content retrieval from user-provided URLs, and image-to-base64 conversion tooling not clearly declared as separate sensitive capabilities. This mismatch undermines informed consent and can hide broader data access and network behavior than a user expects.
Appending secrets to ~/.bashrc establishes persistence for sensitive credentials across future sessions. While this is not a malware backdoor in the classic sense, it creates durable secret exposure in a broadly readable/configuration location and can be abused by later processes or accidental disclosure.
ronment]::SetEnvironmentVariable("QWEN_BASE_URL", "https://dashscope.aliyuncs.com/api/v1", "User")
[Environment]::SetEnvironmentVariable("QWEN_EDIT_IMAGE_API_KEY", "用户提供的值", "User") [Environment]::SetEnvironmentVariable("QWEN_EDIT_IMAGE_MODEL", "qwen-image-edit", "User")
> 设置后需要**重启终端**才能生效。
Mac/Linux(追加到 ~/.bashrc 或 ~/.zshrc):
```bash
echo 'export QWEN_TEXT_IMAGE_API_KEY="用户提供的值"' >> ~/.bashrc
echo 'export QWEN_TEXT_IMAGE_MODEL="qwen-image-2.0-pro"' >> ~/.bashrc
echo 'export QWEN_BASE_URL="https://dashscope.aliyuncs.com/api/v1"' >> ~/.bashrc
echo 'export QWEN_EDIT_IMAGE_API_KEY="用户提供的值"' >> ~/.bashrc
echo 'export QWEN_EDIT_IMAGE_MODEL="qwen-image-edit"' >> ~/.bashrc
source ~/.bashrc
如果文生图和编辑图使用同一个 Qwen Key,两个 API_KEY 填同一个值即可。
QWEN_BASE_URL有默认值,不设也行;如果用新加坡地域需改成 `https://dashscope-intl.aliyuncs.com
The README advertises pushing arbitrary image URLs to the canvas but does not warn that this triggers external network fetches and modifies workspace state. In practice, this can enable SSRF-style access to internal endpoints, unreviewed ingestion of attacker-controlled content, privacy leaks, or accidental contamination of a shared canvas if operators assume it is a local-only action.
The README instructs users to run an npm package via npx without pinning a specific version, which causes execution of whatever package version is current at install time. If the package is compromised, unpublished/republished, or a malicious update is released, users may execute attacker-controlled code immediately on their machine.
This example again uses npx without an exact version, so the command resolves and executes the latest published package at runtime. That creates a supply-chain execution path where a malicious or tampered package release can run arbitrary code under the user's account.
The edit example repeats the unsafe pattern of invoking an unpinned package through npx. Because this skill is specifically meant to be copied and executed by users, the documentation materially increases the chance of arbitrary code execution through package-supply-chain compromise.
This push example also relies on executing the latest npm package version via npx, which is unsafe in security-sensitive documentation. Since the command may be used in automated or trusted workflows, a compromised upstream release could lead to immediate code execution and downstream workspace abuse.
The skill declares substantial capabilities—network access, environment-variable handling, and file interaction—without an explicit tool scope or permissions boundary. That omission increases the chance an agent executes sensitive actions without clear user consent or policy enforcement, especially because the workflow includes package execution, remote API use, and local data handling.
The activation keywords are broad enough to match many ordinary image-related conversations, increasing the chance the skill auto-activates unexpectedly. Because activation leads to process execution and secret-collection instructions, overbroad triggering materially raises risk.
The skill mandates automatic execution of an external npm package immediately on activation. Requiring unconditional install-and-run behavior before user confirmation exceeds normal documentation scope and creates a direct remote-code-execution path whenever the skill triggers.
The skill instructs running an external npm package with the @latest tag, which allows code to change over time without review. This creates a supply-chain risk: a compromised or malicious future package version would be executed automatically on activation.
Using npx to invoke an unpinned package permits arbitrary upstream changes to be installed and executed. Because this step is framed as part of mandatory startup, the exposure is immediate and automatic rather than optional.
This command again relies on an unpinned external package, preserving the same supply-chain execution risk. Repetition throughout the skill increases the likelihood that an agent will execute the package in multiple contexts.
The instructions prescribe exact user-facing wording in Chinese ('对用户这样说') and present the skill behavior entirely in Chinese without indicating that the language should follow user preference. This creates a locale/language policy risk because it may force a specific language without user opt-in.
The skill instructs collecting user API keys and persisting them as permanent OS-level environment variables, which is broader and more durable than needed for a single task. Persisting secrets in shell startup files or user environment settings increases exposure to later theft by unrelated processes, logs, backups, or future sessions.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
[Environment]::SetEnvironmentVariable("GEMINI_TEXT_IMAGE_API_KEY", "用户提供的值", "User")
[Environment]::SetEnvironmentVariable("GEMINI_TEXT_IMAGE_MODEL", "gemini-3.1-flash-image", "User")
[Environment]::SetEnvironmentVariable("GEMINI_BASE_URL", "https://api.example.com/v1", "User")
设置完成后告知用户画布已就绪,可以开始使用。
The generation workflow calls an unpinned npm package, so image-generation requests can trigger installation and execution of code that has not been reviewed in advance. In an agent setting, this widens the attack surface beyond simple API invocation.
The Gemini variant has the same unpinned package risk as the default provider path. An attacker controlling or compromising the package could affect all supported providers uniformly.
The edit workflow still depends on unpinned remote code execution via npx. Because edit operations may process user-supplied URLs and files, combining that with mutable upstream code materially increases risk.
This invocation again allows latest-package execution for image editing, which is a classic supply-chain exposure. The risk is amplified because the command consumes user-controlled image sources.