Back to skill

Security audit

MiniMax Image Generation

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its image-generation purpose, but it should be reviewed because it can upload local reference images and exposes an unsafe API-key command-line option.

Install only if you are comfortable sending prompts and any selected reference images to MiniMax. Use MINIMAX_API_KEY or a secret manager instead of the --api-key flag, and avoid uploading sensitive personal images unless you accept the third-party data flow.

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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate_image.py:98
Finding

API Key Exposure Through Command-Line Arguments in Text-to-Image Script

Content
View full analysis

Vulnerability Details

File Location: scripts/generate_image.py, line 98
Vulnerability Type: API credential exposure through process arguments and shell history
Risk Level: Medium

python
parser.add_argument("--api-key", dest="api_key")

Technical Analysis

The script permits the MiniMax bearer credential to be supplied through the --api-key command-line argument. Command-line arguments are not an appropriate secret transport mechanism because they may be recorded in shell history, process accounting, terminal logs, diagnostic output, or automation logs. Depending on operating-system configuration, they may also be visible to other local users or processes through process-inspection interfaces while the script is running.

Supporting the MINIMAX_API_KEY environment variable is sufficient for the declared image-generation functionality; therefore, the credential-bearing command-line option creates an unnecessary exposure path.

Attack Path

  1. A user invokes the script with python generate_image.py "prompt" --api-key SECRET.
  2. The complete command is saved in shell history, captured by process monitoring, or exposed in the process list while running.
  3. A local attacker or an operator with access to those records extracts the API key.
  4. The attacker submits authenticated requests to the MiniMax API using the stolen credential.
  5. The attacker may consume the victim's API quota or exercise other capabilities granted to that credential until it is revoked.

Impact Assessment

Exploitation requires access to the local process list, shell history, execution logs, or equivalent records. It does not directly grant operating-system privilege escalation. The exposed credential can, however, grant unauthorized access to the MiniMax account capabilities associated with the key, including consumption of paid API quota and generation requests within the key's authorization scope.

Remediation
View remediation

Remediation Suggestions

  • Remove the --api-key command-line option.
  • Obtain the credential from MINIMAX_API_KEY, an operating-system keyring, or a protected configuration file with restrictive permissions.
  • If interactive entry is necessary, use a hidden-input mechanism such as Python's getpass rather than a visible argument.
  • Ensure CI jobs and launch scripts inject the secret through a protected secret-management facility rather than embedding it in command strings.
  • Document that credentials must not be placed in shell history, source files, logs, or error messages.
  • Rotate any API key previously supplied on a command line if process or history records may have been accessible.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/image_to_image.py:122
Finding

API Key Exposure Through Command-Line Arguments in Image-to-Image Script

Content
View full analysis

Vulnerability Details

File Location: scripts/image_to_image.py, line 122
Vulnerability Type: API credential exposure through process arguments and shell history
Risk Level: Medium

python
parser.add_argument("--api-key", dest="api_key")

Technical Analysis

The image-to-image script accepts the MiniMax bearer credential through the --api-key command-line argument. Secrets passed this way can persist in shell history and automation logs and may be observable through operating-system process inspection while the command is active.

This exposure is not required for image-to-image generation because the implementation already supports retrieving the credential from MINIMAX_API_KEY. The command-line credential mechanism therefore exceeds the minimum secret-handling surface necessary for the Skill's declared function.

The script's separate Base64 encoding of a user-selected local reference image is necessary serialization for the documented MiniMax API request and is not, by itself, evidence of covert exfiltration.

Attack Path

  1. A user invokes the script with python image_to_image.py "prompt" --local reference.jpg --api-key SECRET.
  2. The command and credential are stored in shell history, collected by operational logging, or observed through the process list.
  3. An attacker with access to those local records obtains the bearer token.
  4. The attacker reuses the token in requests to https://api.minimaxi.com/v1/image_generation.
  5. Unauthorized requests can continue within the credential's permissions until the key expires or is revoked.

Impact Assessment

The vulnerability does not independently provide local code execution or privilege escalation. Its scope is the MiniMax API authorization attached to the disclosed key. A successful attacker could impersonate the credential holder for supported API operations, consume account quota, cause financial loss, and submit generation request ...[truncated 29 chars]

Remediation
View remediation

Remediation Suggestions

  • Delete the --api-key argument and rely on a protected credential source.
  • Prefer MINIMAX_API_KEY, an operating-system keyring, or a secret manager with access restricted to the invoking user or workload.
  • Use hidden interactive input if environment-based or managed secret injection is unavailable.
  • Prevent credentials from being included in command examples, shell scripts, process supervisors, CI logs, and exception messages.
  • Add documentation describing secure key provisioning and rotation procedures.
  • Revoke and replace keys that may already have been exposed through command histories or process-monitoring records.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (28)

Tainted flow: 'headers' from os.getenv (line 50, 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/generate_image.py (reported line 56)May include surrounding context.

python
}

    print(f"正在生成 {n} 张图片...")
    response = requests.post(url, json=payload, headers=headers, timeout=60)
    result = response.json()

    if result.get("base_resp", {}).get("status_code") != 0:

Tainted flow: 'headers' from os.getenv (line 72, 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_to_image.py (reported line 78)May include surrounding context.

python
}

    print(f"正在生成图片 (参考图: {'本地文件' if local_file else ref_url})...")
    response = requests.post(url, json=payload, headers=headers, timeout=60)
    result = response.json()

    if result.get("base_resp", {}).get("status_code") != 0:

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill claims support for both text-to-image and image-to-image workflows, but the examples are inconsistent and also imply local file reads and post-generation downloads that are not surfaced as security-relevant behaviors. This mismatch can mislead users about what data leaves the system and what local files are accessed or created.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The skill claims support for both text-to-image and image-to-image workflows, but the examples are inconsistent and also imply local file reads and post-generation downloads that are not surfaced as security-relevant behaviors. This mismatch can mislead users about what data leaves the system and what local files are accessed or created.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill demonstrates access to environment variables and outbound network use, but it does not declare any explicit tool scope or permissions. This makes the skill's effective capabilities less transparent to reviewers and users, increasing the chance of unintended secret access or network use without informed approval.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The workflow states that reference images are read, remote APIs are called, and results are automatically saved locally, but there is no explicit warning or consent language about local writes or data transmission. In an image skill, users may upload personal photos, so silent transmission and storage materially increase privacy risk.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · SKILL.md (reported line 54)May include surrounding context.

md
"Content-Type": "application/json"
}

response = requests.post(URL, json=payload, headers=headers)
result = response.json()
image_url = result["data"]["image_urls"][0]

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

md
API_KEY = os.getenv("MINIMAX_API_KEY")

response = requests.post(
    "https://api.minimaxi.com/v1/image_generation",
    headers={
        "Authorization": f"Bearer {API_KEY}",

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

md
API_KEY = os.getenv("MINIMAX_API_KEY")

response = requests.post(
    "https://api.minimaxi.com/v1/image_generation",
    headers={
        "Authorization": f"Bearer {API_KEY}",

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

md
API_KEY = os.getenv("MINIMAX_API_KEY")

response = requests.post(
    "https://api.minimaxi.com/v1/image_generation",
    headers={
        "Authorization": f"Bearer {API_KEY}",

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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/image-api.md (reported line 98)May include surrounding context.

md
API_KEY = os.getenv("MINIMAX_API_KEY")

response = requests.post(
    "https://api.minimaxi.com/v1/image_generation",
    headers={
        "Authorization": f"Bearer {API_KEY}",

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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/image-api.md (reported line 121)May include surrounding context.

示例 2: 带风格的图片生成

python
response = requests.post(
    "https://api.minimaxi.com/v1/image_generation",
    headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
    json={

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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/image-api.md (reported line 139)May include surrounding context.

示例 2: 带风格的图片生成

python
response = requests.post(
    "https://api.minimaxi.com/v1/image_generation",
    headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
    json={

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstring and CLI help text are entirely in Chinese, and all user-facing status/error messages in the script follow the same locale. This imposes a specific language on users without any option to select another language, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest states the skill supports both '文生图' and '图生图', including generating new images based on a reference image upload. However, this file only accepts a text prompt, calls a text-to-image API payload with no image input, and saves returned images locally. There is no handling of uploaded/reference images or any image-to-image request flow.

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

md
if not api_key:
        raise ValueError("未设置 MINIMAX_API_KEY 环境变量")

    url = "https://api.minimaxi.com/v1/image_generation"

    payload = {
        "model": model,

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

md
if not api_key:
        raise ValueError("未设置 MINIMAX_API_KEY 环境变量")

    url = "https://api.minimaxi.com/v1/image_generation"

    payload = {
        "model": model,

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

md
if not api_key:
        raise ValueError("未设置 MINIMAX_API_KEY 环境变量")

    url = "https://api.minimaxi.com/v1/image_generation"

    payload = {
        "model": model,

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

md
if not api_key:
        raise ValueError("未设置 MINIMAX_API_KEY 环境变量")

    url = "https://api.minimaxi.com/v1/image_generation"

    payload = {
        "model": model,

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

md
if not api_key:
        raise ValueError("未设置 MINIMAX_API_KEY 环境变量")

    url = "https://api.minimaxi.com/v1/image_generation"

    payload = {
        "model": model,

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 33)May include surrounding context.

python
if not api_key:
        raise ValueError("未设置 MINIMAX_API_KEY 环境变量")

    url = "https://api.minimaxi.com/v1/image_generation"

    payload = {
        "model": model,

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/image_to_image.py (reported line 49)May include surrounding context.

python
if not api_key:
        raise ValueError("未设置 MINIMAX_API_KEY 环境变量")

    url = "https://api.minimaxi.com/v1/image_generation"

    payload = {
        "model": model,

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

python
}

    print(f"正在生成 {n} 张图片...")
    response = requests.post(url, json=payload, headers=headers, timeout=60)
    result = response.json()

    if result.get("base_resp", {}).get("status_code") != 0:

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The module docstring, help text, and user-facing messages are all written in Chinese, which imposes a specific language on users. There is no indication that this is region-specific or that users can opt into another language.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

When --local is used, the script base64-encodes the user's local image and sends it to the external MiniMax API. In a skill that may process user-supplied files, failing to clearly disclose that local content leaves the host boundary can cause unintended data exposure, especially if users provide sensitive images.

Content

No source excerpt is available for this finding.