Back to skill

Security audit

Cheapest Image Generation

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent image-generation integration, but one bash reference pattern can turn user-supplied prompt or filename text into local command execution.

Review carefully before installing. Prefer the Python or PowerShell reference over the curl/bash template, avoid placing sensitive data in prompts, use a revocable EvoLink API key, and check output filenames so generated downloads do not overwrite important 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

Error
Location
references/curl_heredoc.md:17
Finding
Arbitrary Command Execution Through Unsafe Bash Template Substitution<![CDATA[ ## Vulnerability Details **File Location**: `references/curl_heredoc.md`, lines 17–30 and 90–100 **Vulnerability Type**: Shell command injection **Risk Level**: High ### Vulnerable Code Lines 17–30: ```bash API_KEY="<API_KEY>" RAW_OUT="<OUTPUT_FILE>" # CRITICAL: Sanitize filename to prevent shell injection OUT_FILE=$(echo "$RAW_OUT" | tr -cd 'A-Za-z0-9._-') # Ensure it has a valid extension if [[ ! "$OUT_FILE" =~ \.(webp|png|jpg|jpeg)$ ]]; then OUT_FILE="${OUT_FILE}.webp" fi # Ensure it's not empty if [ -z "$OUT_FILE" ]; then OUT_FILE="evolink-$(date +%s).webp" fi PROMPT="<USER_PROMPT>" ``` Lines 90–100: ```bash RAW_OUT="<OUTPUT_FILE>" # CRITICAL: Sanitize filename OUT_FILE=$(echo "$RAW_OUT" | tr -cd 'A-Za-z0-9._-') if [[ ! "$OUT_FILE" =~ \.(webp|png|jpg|jpeg)$ ]]; then OUT_FILE="${OUT_FILE}.webp" fi if [ -z "$OUT_FILE" ]; then OUT_FILE="evolink-result.webp" fi curl -L -o "$OUT_FILE" "<URL>" ``` ### Technical Analysis The reference instructs the caller to replace placeholders such as `<USER_PROMPT>`, `<OUTPUT_FILE>`, `<API_KEY>`, and `<URL>` directly in executable Bash source. Double quotes prevent word splitting and pathname expansion, but they do not prevent command substitution. If a substituted value contains `$(...)` or backtick syntax, Bash executes it while evaluating the assignment or command. The output filename is sanitized only after Bash has evaluated: ```bash RAW_OUT="<OUTPUT_FILE>" ``` Consequently, commands embedded in the replacement value execute before `tr` removes shell metacharacters. The same issue applies directly to `PROMPT="<USER_PROMPT>"`, the API-key assignment, and the literal URL template. The later `json_escape` function does not mitigate this issue because the prompt has already been parsed and command substitutions have already executed by the time the function receives it. ### Attack Path 1. An attacker supplies an image-generation prompt containing shell command-substitution syntax, for example: ...[truncated 1624 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Do not insert untrusted values into shell source code.** Replace textual placeholder substitution with positional parameters: ```bash API_KEY=$1 PROMPT=$2 SIZE=$3 NSFW_CHECK=$4 RAW_OUT=$5 ``` Invoke the script through an execution interface that supplies each value as a distinct argument rather than constructing a shell command string. 2. **Prefer the Python or PowerShell reference implementation.** Both use structured argument parsing and JSON serialization instead of embedding the prompt into executable source. 3. **Use a real JSON serializer.** Pass values to Python, `jq`, or another structured encoder rather than maintaining a custom shell escaping routine. For example: ```bash PAYLOAD=$(python3 -c ' import json, sys print(json.dumps({ "model": "z-image-turbo", "prompt": sys.argv[1], "size": sys.argv[2], "nsfw_check": sys.argv[3].lower() == "true" })) ' "$PROMPT" "$SIZE" "$NSFW_CHECK") ``` 4. **Validate output paths before use.** Accept only a basename with an approved image extension, reject path separators, and create the output in a predetermined directory. Sanitization should operate on data received through arguments or environment variables, not on text inserted into source. 5. **Validate result URLs structurally.** Require HTTPS and, where the service contract permits, restrict downloads to documented EvoLink or trusted storage hosts. Do not place a URL directly into generated shell source. 6. **Remove the standalone literal-substitution example.** Replace: ```bash curl -L -o "$OUT_FILE" "<URL>" ``` with an argument-based form such as: ```bash URL=$1 curl --fail --location --output "$OUT_FILE" "$URL" ``` 7. **Avoid command-string execution mechanisms.** Do not pass constructed values to `eval`, `bash -c`, or similar interfaces. Ensure the Agent invokes the script using an argument array whenever supported. ...[truncated 4 chars]
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (9)

External Transmission

Medium
Category
Data Exfiltration
Content
## API Endpoint

- Base: `https://api.evolink.ai/v1`
- Submit: `POST /images/generations`
- Poll: `GET /tasks/{id}`
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
## API Endpoint

- Base: `https://api.evolink.ai/v1`
- Submit: `POST /images/generations`
- Poll: `GET /tasks/{id}`
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
## API Endpoint

- Base: `https://api.evolink.ai/v1`
- Submit: `POST /images/generations`
- Poll: `GET /tasks/{id}`
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
## API Endpoint

- Base: `https://api.evolink.ai/v1`
- Submit: `POST /images/generations`
- Poll: `GET /tasks/{id}`
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
PROMPT_ESC=$(json_escape "$PROMPT")

RESP=$(curl -s -X POST "https://api.evolink.ai/v1/images/generations" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<EVOLINK_END
Confidence
94% confidence
Finding
This command performs an outbound POST request to a third-party API and includes an authorization bearer token plus user-supplied prompt content. In the context of documentation for a network-backed image generation skill this behavior is expected, but it still creates a real data-exposure risk if users send sensitive content without clear notice.

External Transmission

Medium
Category
Data Exfiltration
Content
PROMPT_ESC=$(json_escape "$PROMPT")

RESP=$(curl -s -X POST "https://api.evolink.ai/v1/images/generations" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<EVOLINK_END
Confidence
94% confidence
Finding
This command performs an outbound POST request to a third-party API and includes an authorization bearer token plus user-supplied prompt content. In the context of documentation for a network-backed image generation skill this behavior is expected, but it still creates a real data-exposure risk if users send sensitive content without clear notice.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The example instructs users to send both their prompt content and an API key to a third-party service, but it does not explicitly warn that the prompt data leaves the local environment and is processed externally. This can lead to unintentional disclosure of sensitive prompts, secrets, or regulated data if users paste private content into the command.

Missing User Warnings

Low
Confidence
86% confidence
Finding
The script downloads remote content and writes it to a local file, but it does not explicitly warn users that a file will be created or overwritten in the current working context. Even with filename sanitization, users may unintentionally overwrite existing files or save untrusted remote content locally without realizing the side effects.

Missing User Warnings

Low
Confidence
90% confidence
Finding
The direct-download example fetches a remote URL and saves the response locally without an explicit warning about both network contact and local file creation. Users may not appreciate that this step discloses their IP/client metadata to the remote service and stores potentially untrusted content on disk.

Static analysis

No suspicious patterns detected.