Back to skill

Security audit

MiniMax Image Generator

Security checks for vulnerabilities and agentic risk

Overview

This image-generation skill mostly matches its stated purpose, but it deserves review because its helper script can write generated files to caller-chosen paths without containment or overwrite protection.

Install only if you are comfortable sending image prompts to MiniMax and using a local script that writes files. Avoid passing untrusted or automated --output values, and prefer containing outputs to the intended workspace image directory until the path handling is tightened.

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-image.mjs:38
Finding
Unrestricted Output Path Allows Arbitrary Writable-File Overwrite## Vulnerability Details **File Location**: `scripts/generate-image.mjs`, lines 38 and 70-71 **Vulnerability Type**: Unrestricted file write and overwrite **Risk Level**: Medium ### Vulnerable Code ```js const outputPath = getArg('--output', `${defaultOutputDir}/minimax-image-${Date.now()}.png`); ``` ```js mkdirSync(dirname(outputPath), { recursive: true }); writeFileSync(outputPath, buffer); ``` ### Technical Analysis The `--output` argument is accepted as a caller-controlled filesystem path. The script does not normalize the path or verify that its canonical destination remains beneath the intended `~/.openclaw/workspace/images` directory. It also does not reject symbolic links, path traversal, absolute paths, or existing files. `writeFileSync()` uses overwrite behavior by default. Therefore, after downloading an image, the script can replace any file writable by the account running the process. Creating the parent directory does not provide containment and can also create attacker-selected directory trees where permissions allow. Exploitation requires influence over the script's command-line arguments. The downloaded content is controlled indirectly through the MiniMax generation response rather than being arbitrary attacker-supplied local bytes, but it can still corrupt or replace targeted files. ### Attack Path 1. An attacker or untrusted automation gains influence over arguments passed to `generate-image.mjs`. 2. The attacker supplies `--output` with an absolute path, traversal path, or path resolving through a symbolic link to a sensitive writable file. 3. The script requests image generation from MiniMax and downloads the first returned image URL. 4. `writeFileSync(outputPath, buffer)` opens the selected destination with overwrite semantics. 5. The target file is replaced with the downloaded image bytes. Example invocation: ```bash node scripts/generate-image.mjs "test image" \ --output "$HOM ...[truncated 710 chars]
Remediation
## Remediation Suggestions 1. Resolve both the trusted output root and requested destination with `realpath` or `resolve`, then verify that the destination remains beneath the trusted root using `relative()`. 2. Reject absolute paths and traversal outside the dedicated image directory unless a trusted operator explicitly authorizes them. 3. Inspect every existing path component with `lstat()` and reject symbolic links. Use platform-supported no-follow behavior where available to reduce time-of-check/time-of-use risks. 4. Prevent silent replacement by opening the destination with exclusive creation, such as `writeFileSync(path, buffer, { flag: 'wx' })`. 5. Generate server-side filenames rather than accepting complete caller-controlled paths. If customization is needed, accept only a sanitized basename. 6. Permit only expected image extensions and verify the downloaded response's content type and file signature before writing. 7. Run the script with a least-privileged account that cannot modify sensitive configuration or executable locations. 8. Add tests covering absolute paths, `../` traversal, existing destinations, nested symlinks, and paths outside the approved output directory.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (3)

Vague Triggers

High
Confidence
98% confidence
Finding
The trigger language is intentionally expansive ('ANY TIME' a user asks to create or improve virtually any visual), which can cause the skill to activate in situations where image generation is only tangentially mentioned or not actually desired. Over-broad activation increases the risk of unintended external API calls, unnecessary data disclosure to third-party services, and workflow hijacking away from more appropriate skills or safer handling paths.

Lp3

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding
The skill declares access to sensitive capabilities via environment gating and intends to call an external image-generation service, but it does not restrict tool usage with an explicit permissions or allowed-tools scope. In an agent environment, this increases the chance that the skill can invoke unintended tools or broader network/file actions than necessary if the runtime defaults are permissive.

External Transmission

Medium
Category
Data Exfiltration
Content
#!/usr/bin/env node
/**
 * MiniMax Image Generation via image-01 model
 * API: POST https://api.minimax.io/v1/image_generation
 * 
 * Response contains image URLs — script downloads the first one as PNG.
 */
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Static analysis

Detected: suspicious.env_credential_access

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
scripts/generate-image.mjs:12