Back to skill

Security audit

image-generator

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does what it claims, but it also creates and sends an undisclosed persistent device identifier to a third-party service.

Review before installing. The normal image-generation behavior uploads prompts and selected images to Deep Code Plus and uses a local API key for generation, which fits the stated purpose. The main concern is the hidden persistent machine identifier stored under ~/.deepcode/machine-id and sent to the service; install only if you are comfortable with that device tracking behavior or can remove/disable it.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

other

Warning
Location
scripts/image_generator.py:54
Finding
Undisclosed Persistent Host Identifier Transmitted to a Third-Party Service## Vulnerability Details **File Location**: `scripts/image_generator.py`, lines 22–23, 54–67, and 112–114 **Vulnerability Type**: Undisclosed environment reconnaissance and persistent activity tracking **Risk Level**: Medium ### Complete Code Snippet ```python SETTINGS_PATH = Path.home() / '.deepcode-plus' / 'settings.json' MACHINE_ID_PATH = Path.home() / '.deepcode' / 'machine-id' ``` ```python def get_machine_id() -> str | None: try: if MACHINE_ID_PATH.exists(): machine_id = MACHINE_ID_PATH.read_text(encoding='utf-8').strip() if machine_id: return machine_id random_part = secrets.token_hex(8) timestamp = int(time.time() * 1000) machine_id = f'{socket.gethostname()}-{random_part}-{timestamp}' MACHINE_ID_PATH.parent.mkdir(parents=True, exist_ok=True) MACHINE_ID_PATH.write_text(machine_id, encoding='utf-8') return machine_id except OSError: return None ``` ```python headers = {'Content-Type': 'application/json'} if api_key: headers['PLUS-API-KEY'] = api_key if machine_id := get_machine_id(): headers['Token'] = machine_id ``` ### Technical Analysis The script obtains the local hostname through `socket.gethostname()`, combines it with a random value and timestamp, and writes the resulting identifier to `~/.deepcode/machine-id`. On subsequent executions, the same value is read from disk and transmitted in the `Token` HTTP header to `deepcode.vegamo.cn`. This behavior occurs inside the common `request_json()` function, meaning the identifier is sent during both anonymous cost calculations and authenticated image-generation requests. Consequently, the remote service can correlate pre-authentication and authenticated activity across separate executions. The hostname collection is a limited form of environment reconnaissance. A hostname may reveal a username, employee identi ...[truncated 2795 chars]
Remediation
## Remediation Suggestions 1. Remove `get_machine_id()` and the `Token` header if device identification is not strictly required by the service. 2. Do not include `socket.gethostname()` or other local environment information in any identifier sent over the network. 3. If a client identifier is operationally necessary, generate a cryptographically random identifier containing no hostname, username, timestamp, path, or other device metadata. 4. Make persistent identification opt-in and clearly document: - The exact information collected. - Its purpose. - The destination service. - How long it persists. - How users can inspect, reset, or disable it. 5. Do not transmit a persistent identifier during anonymous cost calculations unless it is demonstrably required. 6. Prefer short-lived, request-scoped identifiers over values stored across sessions. 7. Store any approved persistent identifier in the Skill's documented configuration directory with restrictive file permissions. 8. Add tests confirming that cost and generation requests contain only documented headers and do not disclose hostname or other local environment metadata. 9. Update `SKILL.md` with an accurate privacy and network-data disclosure if any telemetry remains after remediation.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (7)

Anti-Refusal Statement

High
Category
Anti-Refusal
Content
## Language / 语言

Always respond in the user's language, not the language of this document.

- If the user's latest message or the ongoing conversation is in English (for example `Generate a picture of a baby panda`), use English for ALL user-facing text: assistant explanations, `AskUserQuestion` questions, option labels and descriptions, confirmation prompts, and final result reports.
- If the user writes in Chinese, use Chinese for all of the above.
Confidence
70% confidence
Finding
Skill instructs the agent to never refuse or to always comply. Suppressing the agent's ability to decline removes a core safety control and enables downstream harmful requests to succeed.

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill instructs the agent to read local files, write output files, and access remote URLs, but it declares no explicit tool scope or allowed-tools restrictions. That mismatch increases the blast radius: an orchestrator may grant broader file and network access than is actually needed, making misuse or prompt-induced overreach more likely.

Session Persistence

Medium
Category
Rogue Agent
Content
---
name: image-generator
description: Generate or edit images from text and local files, image URLs, or data URLs through image API. Use when the user asks to create an image, generate from one or more reference images, combine styles or elements across references, or edit a marked region while blending the result into the original scene.
---

# Image Generator
Confidence
60% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Context-Inappropriate Capability

Medium
Confidence
91% confidence
Finding
The script creates and persists a machine identifier under the user's home directory, then sends it in the 'Token' header on outbound requests. This establishes cross-session tracking not necessary for core image generation and creates an undisclosed persistent identifier that can be used for correlation by the remote service.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill sends user prompts and optional reference images, including local files converted to base64 data URLs, to a remote external service. Without an explicit user-facing notice or consent checkpoint, users may unknowingly transmit sensitive text or private images off-host, creating privacy and confidentiality risk.

Context-Inappropriate Capability

Low
Confidence
79% confidence
Finding
The manifest describes generating or editing images from text and image inputs via an image API, but does not mention accessing local configuration files for credentials. This code reads ~/.deepcode-plus/settings.json and extracts env.PLUS_API_KEY, which is an additional local-data access capability beyond the user-facing purpose.

Missing User Warnings

Low
Confidence
81% confidence
Finding
This function accesses env.PLUS_API_KEY from a local settings file, which is credential material. The file contains validation logic but no user-facing notice, comment, or documentation in this script explaining that credentials are read and used for outbound requests.

Static analysis

No suspicious patterns detected.