Back to skill

Security audit

ERNIE Image Visual Promptsmith

Security checks for vulnerabilities and agentic risk

Overview

The skill matches its stated image-generation purpose, but it should be reviewed because it automatically downloads and saves any image URL returned by the remote API without validation or size limits.

Install only if you are comfortable sending prompts and generation parameters to Baidu AI Studio and storing returned images locally. Avoid secrets, private designs, personal data, or regulated content in prompts. For safer use, the downloader should restrict image URLs to trusted HTTPS hosts, validate image content, and enforce response-size limits before auto-attaching saved files.

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

Warning
Location
scripts/generate.py:330
Finding

Unrestricted Retrieval of Server-Supplied URLs Enables SSRF and Resource Exhaustion

Content
View full analysis
None: req = urllib.request.Request( url, headers={"User-Agent": "OpenClaw ERNIE-Image Skill"} ) try: with urllib.request.urlopen(req, timeout=180) as resp: data = resp.read() except Exception as exc: raise RuntimeError(f"Failed to fetch generated image: {exc}") from None out_path.write_bytes(data) ``` ```python def save_outputs(response: dict, response_format: str, out_dir: Path) -> None: for index, item in enumerate(response_items(response), start=1): if response_format == "url": url = item.get("url") if not url: raise RuntimeError(f"Image item missing URL: {item}") print(f"IMAGE_URL:{url}") out_path = out_dir / timestamp_name(index, extension_from_url(url)) download_url(url, out_path) ``` ### Technical Analysis The image URL is obtained directly from the remote API response and passed to `urllib.request.urlopen()` without validating its scheme, hostname, resolved address, port, or redirect chain. The downloader does not: - Require HTTPS. - Restrict destinations to documented Baidu or approved CDN domains. - Reject loopback, private, link-local, reserved, or multicast IP addresses. - Revalidate destinations after HTTP redirects. - Defend against DNS rebinding. - Verify that the response has an expected image media type or valid image signature. - Enforce a maximum response size. Consequently, a compromised API endpoint, manipulated response, malicious CDN path, or unsafe redirect could direct the process to an internal service such as `127.0.0.1`, an RFC1918 address, or a cloud metadata endpoint. Although the outbound request does n ...[truncated 2419 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • 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 (12)

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

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

md
## Decide the Mode

- Generate immediately when the user asks to generate, draw, create, make an image, or uses equivalent Chinese generation wording.
- Return prompt-only guidance when the user asks to optimize, rewrite, improve, or review a prompt.
- Ask one concise question only if an exact visible text string, language, or required aspect ratio is missing and guessing would likely break the result.

## API Endpoint

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

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

md
- Chinese examples: `ERNIE image: <prompt>`, `Wenxin image: <prompt>`, `generate image: <prompt>`, or equivalent Chinese wording for image generation.
- English examples: `ernie image: <prompt>`, `generate image: <prompt>`, `create image: <prompt>`.
- Treat text after the colon as the raw user prompt, improve it, choose a preset, then generate.
- If the user asks to optimize, rewrite, improve, or review a prompt, return prompt-only guidance and do not call the API.

## Prompt Workflow

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill invokes a Python script that uses an API key, performs outbound network requests to Baidu AI Studio, downloads returned image URLs, and writes files locally, but the manifest does not declare tool scope or permissions. This creates a transparency and containment problem: users and hosting platforms may not realize the skill can access env vars, write files, and communicate over the network.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill description explains the API endpoint and key requirement but does not clearly warn users that their prompts and image-generation inputs are transmitted to Baidu AI Studio. In this context, prompts may contain proprietary designs, personal data, or sensitive business content, so undisclosed third-party transmission is a real privacy and data-handling risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill states that images are downloaded immediately and saved locally, but it does not present this as an explicit user-facing warning in the description or consent flow. Local persistence can create privacy, storage, and data-retention issues, especially if generated images contain sensitive or regulated content.

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 · references/api.md (reported line 138)May include surrounding context.

print(img.data[0].url)

text

## curl Shape

```bash
curl --location "https://aistudio.baidu.com/llm/lmapi/v3/images/generations" \

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file states that generated images are downloaded immediately and saved locally, which affects user data/system state and involves network transfer of prompt content to a third-party API. While the behavior is documented operationally, it does not clearly warn the user about these privacy and local-write effects.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

Several examples use Chinese prompts as the default behavior, which may imply a fixed language expectation. The document does not state that Chinese is optional, nor does it justify a locale-specific constraint for this skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The SDK example hardcodes a Chinese-language prompt and does not indicate that other languages are supported. In the absence of opt-in or justification, this can be read as a language/locale policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The curl example provides only a Chinese-language prompt and no statement that users may choose their own language. This may imply an unnecessary locale constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The example requires the generated poster to contain the exact English text "Spring Sale 50% OFF" even though the user input is in Chinese, and the file does not frame this as an optional language choice. This can encourage behavior that overrides the user's apparent language context without explicit opt-in.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This code creates the output directory and saves returned image data to local files, but it does not explicitly warn the user at execution time that files will be written unless they infer it from the --out-dir argument. For SQP-2 on code files, file writes can merit a disclosure when there is no confirmation prompt or explicit user-facing notice near the write operation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.