Back to skill

Security audit

Minimax Image Gyh

Security checks for vulnerabilities and agentic risk

Overview

This MiniMax image skill is purpose-aligned, but it ships an undisclosed hardcoded API key and has insecure secret-handling guidance, so users should review it before installing.

Install only after the publisher removes and rotates the embedded MiniMax credential, requires users to provide their own key, narrows activation to explicit image-generation requests, and improves secret-handling guidance. Avoid putting sensitive text in prompts unless you are comfortable sending it to MiniMax, and choose output paths carefully because the scripts write files locally.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/generate_image.py:34
Finding

Hard-Coded MiniMax API Credential in Root Image Generation Script

Content
View full analysis
str: """Build the API endpoint URL.""" return f"{API_BASE_URL}" def get_api_key() -> str: """Get the MiniMax API key from environment variable, or use default.""" api_key = os.environ.get("MINIMAX_API_KEY") or DEFAULT_API_KEY if not api_key or api_key == "your-api-key-here": print("Error: MINIMAX_API_KEY environment variable not set and no default key available", file=sys.stderr) print("\nTo set it:", file=sys.stderr) print(" Windows (PowerShell): $env:MINIMAX_API_KEY = 'your-key'", file=sys.stderr) print(" Windows (CMD): set MINIMAX_API_KEY=your-key", file=sys.stderr) print(" macOS/Linux: export MINIMAX_API_KEY='your-key'", file=sys.stderr) print("\nGet your key from MiniMax dashboard:", file=sys.stderr) sys.exit(1) return api_key ``` The credential value is redacted in this report because it must be treated as compromised. ### Technical Analysis The script embeds a live-looking MiniMax API credential directly in distributed source code. The `get_api_key()` function silently selects this credential whenever `MINIMAX_API_KEY` is unset. This conflicts with the documented requirement that users supply their own API key and violates secret-management and least-privilege principles. The credential is subsequently placed in an HTTP bearer authorization header and transmitted to the declared MiniMax endpoint: ```python headers = { "Content-Type": "application/json", "Authorization": f"Bearer {api_key}" } ``` Sending a user-supplied key to the declared HTTPS API is necessary for image generation. Embedding and a ...[truncated 1056 chars]
Remediation
View remediation
str: api_key = os.environ.get("MINIMAX_API_KEY") if not api_key: raise RuntimeError("MINIMAX_API_KEY is required") return api_key ``` 4. Do not place replacement credentials in source code, examples, documentation, test fixtures, or commit history. 5. Store secrets in environment variables or an approved secret manager. 6. Add automated secret scanning to pre-commit hooks and CI release checks. 7. Review MiniMax account logs and billing records for unauthorized use. 8. If repository history has been published, remove the secret from history where practical, while recognizing that history rewriting does not replace credential revocation. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
minimax-image/scripts/generate_image.py:32
Finding

Duplicated Hard-Coded MiniMax API Credential in Nested Skill Script

Content
View full analysis
str: """Build the API endpoint URL.""" return f"{API_BASE_URL}/v1/image_generation" def get_api_key() -> str: """Get the MiniMax API key from environment variable, or use default.""" api_key = os.environ.get("MINIMAX_API_KEY") or DEFAULT_API_KEY if not api_key or api_key == "your-api-key-here": print("Error: MINIMAX_API_KEY environment variable not set and no default key available", file=sys.stderr) print("\nTo set it:", file=sys.stderr) print(" Windows (PowerShell): $env:MINIMAX_API_KEY = 'your-key'", file=sys.stderr) print(" Windows (CMD): set MINIMAX_API_KEY=your-key", file=sys.stderr) print(" macOS/Linux: export MINIMAX_API_KEY='your-key'", file=sys.stderr) print("\nGet your key from MiniMax dashboard:", file=sys.stderr) sys.exit(1) return api_key ``` The credential value is redacted in this report because it must be treated as compromised. ### Technical Analysis A second script contains the same exposed credential and the same automatic fallback behavior. Duplication increases the chance that partial remediation will leave a usable copy in the package. The nested Skill documentation states that `MINIMAX_API_KEY` must be set, but this implementation does not enforce that requirement. It silently authenticates with the bundled credential and transmits it to `https://api.minimaxi.com/v1/image_generation`. The outbound authorization request is part of the declared image-generation operation, but distributing a reusable shared credential exceeds the minimum privileges necessary. Each user should supp ...[truncated 1112 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
SKILL.md:18
Finding

Unpinned Third-Party Requests Dependency and Inaccurate Dependency Documentation

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (33)

Tainted flow: 'headers' from os.environ.get (line 94, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · minimax-image/scripts/generate_image.py (reported line 100)May include surrounding context.

python
}

    try:
        response = requests.post(endpoint, headers=headers, json=request_body, timeout=120)
        
        if response.status_code != 200:
            error_detail = response.text

Tainted flow: 'req' from os.environ.get (line 100, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/generate_image.py (reported line 103)May include surrounding context.

python
req = urllib.request.Request(endpoint, data=request_body, headers=headers, method="POST")

    try:
        with urllib.request.urlopen(req, timeout=120) as response:
            return json.loads(response.read().decode("utf-8"))
    except urllib.error.HTTPError as e:
        error_body = e.read().decode("utf-8") if e.fp else ""

Tainted flow: 'HEADERS' from os.environ.get (line 18, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/image_gen.py (reported line 49)May include surrounding context.

python
print(f"   模型: {model} | 尺寸: {size} | 数量: {n}")
    print(f"   描述: {prompt[:80]}{'...' if len(prompt) > 80 else ''}")

    resp = requests.post(url, headers=HEADERS, json=payload, timeout=60)
    resp.raise_for_status()
    data = resp.json()

Tainted flow: 'HEADERS' from os.environ.get (line 18, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/image_gen.py (reported line 80)May include surrounding context.

python
for i in range(max_wait // 10):
        time.sleep(10)
        resp = requests.get(url, headers=HEADERS, params=params, timeout=30)
        resp.raise_for_status()
        data = resp.json()

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding describes the same core issue: the skill is represented as environment-key driven, but the code reportedly contains an embedded API key and writes image data to disk without clearly declaring that behavior. Hidden credentials and hidden side effects undermine trust boundaries and can expose secrets or modify the local environment unexpectedly.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding describes the same core issue: the skill is represented as environment-key driven, but the code reportedly contains an embedded API key and writes image data to disk without clearly declaring that behavior. Hidden credentials and hidden side effects undermine trust boundaries and can expose secrets or modify the local environment unexpectedly.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The documentation states that the API key comes from the environment, but the code silently falls back to a hardcoded secret. This mismatch is dangerous because users and reviewers may believe no embedded credential exists, while the script can actually use a baked-in key tied to some account without informed consent.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill metadata and code behavior diverge: although the skill claims to use MINIMAX_API_KEY, it can operate using an embedded API key instead. In a shared skill ecosystem, this increases the risk of unauthorized use of someone else's credentials, hidden billing exposure, and reduced transparency about where authentication material originates.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
100% confidence
Finding

A hardcoded API key is present in source code and used automatically if the environment variable is unset. Embedded credentials are highly sensitive because they can be extracted by anyone with code access, abused for unauthorized API usage, and may expose the owner to billing, quota depletion, or account compromise.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The script contains a hardcoded fallback API key despite documentation stating the key should come from MINIMAX_API_KEY. Embedding live credentials in distributed code can expose the vendor account to unauthorized use, quota theft, billing abuse, and key leakage through source control or package redistribution.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill documentation declares no explicit tool scope even though the skill behavior necessarily involves reading an environment variable, making network requests to an external API, and writing files locally. This creates a transparency and least-privilege problem: users and enforcement systems cannot accurately assess or constrain what the skill will do.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The description omits that user prompts are transmitted to a third-party image-generation service using an API key, which is a meaningful privacy and data-handling concern. Users may supply sensitive text without realizing it leaves the local environment, so the omission weakens informed consent and safe usage.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The examples instruct the agent to generate files at specific paths and, in several workflow scenarios, to update project files after generation, but they do not tell the agent to warn the user, confirm overwrites, or verify that file modifications are intended. In an agent setting, this can lead to unintended local file creation or overwriting of existing assets and source files, especially when paths like ./src/assets or ./docs are used as if writes are always safe.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The activation guidance is unusually broad, including 'any purpose' and 'any task where an AI-generated image would be helpful,' which can cause the agent to invoke the skill in situations the user did not explicitly request. Because the skill performs an external API call and writes files to disk, unintended invocation can lead to unnecessary data disclosure to a third party, unexpected filesystem changes, and avoidable cost-incurring operations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The skill states that it saves generated images to a specified location and defaults to the current directory, but it does not prominently warn that disk writes happen by default. In agent workflows, silent file creation can surprise users, overwrite expected workspace state, or leave sensitive/generated content on disk without clear consent or awareness.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

The documentation recommends persisting the API key by appending it in plaintext to shell startup files such as ~/.zshrc or ~/.bashrc. This increases exposure because the secret becomes long-lived, may be included in backups or dotfile sync, and can be read by other local tools or users depending on system configuration.

Content

Scanner excerpt · minimax-image/reference.md (reported line 32)May include surrounding context.

bash
export MINIMAX_API_KEY="your-api-key-here"

# Add to ~/.zshrc or ~/.bashrc to persist
echo 'export MINIMAX_API_KEY="your-api-key-here"' >> ~/.zshrc

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script sends the user-provided prompt to the MiniMax remote service via an HTTP POST request. While this network call is part of the skill's purpose, the code and usage text do not explicitly warn users that their prompt content will leave the local system and be shared with a third-party API.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% 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 · minimax-image/scripts/generate_image.py (reported line 100)May include surrounding context.

python
}

    try:
        response = requests.post(endpoint, headers=headers, json=request_body, timeout=120)
        
        if response.status_code != 200:
            error_detail = response.text

Tainted flow: 'response' from requests.get (line 162, network input) → pathlib.Path.write_bytes (file write)

Medium
Category
Data Flow
Confidence
71% confidence
Finding

The script downloads arbitrary content from a URL returned by the remote API and writes it directly to a user-chosen file path without validating content type, size, or destination safety. In this skill context, the URL is expected to be an image, but a compromised API, MITM on a misconfigured system, or unexpected response could cause overwriting files with untrusted data or filling disk with oversized content.

Content

Scanner excerpt · minimax-image/scripts/generate_image.py (reported line 164)May include surrounding context.

python
try:
        response = requests.get(url, timeout=120)
        response.raise_for_status()
        output_path.write_bytes(response.content)
    except Exception as e:
        print(f"Error: Failed to download image: {e}", file=sys.stderr)
        sys.exit(1)

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

The documentation recommends persisting the API key by appending it directly to shell startup files such as ~/.zshrc or ~/.bashrc. Storing long-lived secrets in plaintext config files increases exposure to local compromise, accidental disclosure via backups/dotfile sync, and inadvertent sharing of shell configuration files.

Content

Scanner excerpt · reference.md (reported line 32)May include surrounding context.

bash
export MINIMAX_API_KEY="your-api-key-here"

# Add to ~/.zshrc or ~/.bashrc to persist
echo 'export MINIMAX_API_KEY="your-api-key-here"' >> ~/.zshrc

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The troubleshooting guidance explicitly tells users to print the value of MINIMAX_API_KEY to the terminal to verify it is set. Displaying secrets on screen can expose them through screen sharing, terminal logging, shell session capture, screenshots, or shoulder surfing, and the documentation does not warn about that risk or suggest safer verification methods.

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 · minimax-image/reference.md (reported line 41)May include surrounding context.

md
# Configuration
DEFAULT_MODEL_ID = "image-01"
API_BASE_URL = "https://api.minimaxi.com/v1/image_generation"
DEFAULT_IMAGE_SIZE = "1K"
DEFAULT_ASPECT_RATIO = "1:1"
VALID_SIZES = {"1K", "2K", "4K"}

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 · reference.md (reported line 41)May include surrounding context.

md
# Configuration
DEFAULT_MODEL_ID = "image-01"
API_BASE_URL = "https://api.minimaxi.com/v1/image_generation"
DEFAULT_IMAGE_SIZE = "1K"
DEFAULT_ASPECT_RATIO = "1:1"
VALID_SIZES = {"1K", "2K", "4K"}

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 · scripts/generate_image.py (reported line 29)May include surrounding context.

python
# Configuration
DEFAULT_MODEL_ID = "image-01"
API_BASE_URL = "https://api.minimaxi.com/v1/image_generation"
DEFAULT_IMAGE_SIZE = "1K"
DEFAULT_ASPECT_RATIO = "1:1"
VALID_SIZES = {"1K", "2K", "4K"}

Tainted flow: 'image_bytes' from os.environ.get (line 196, credential/environment) → pathlib.Path.write_bytes (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/generate_image.py (reported line 197)May include surrounding context.

python
"""Decode and save the base64 image data."""
    try:
        image_bytes = base64.b64decode(image_data)
        output_path.write_bytes(image_bytes)
    except Exception as e:
        print(f"Error: Failed to save image: {e}", file=sys.stderr)
        sys.exit(1)