Back to skill

Security audit

Ali Minimax Toolkit

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a MiniMax media-generation wrapper, but it can send the MiniMax API key and user prompts or uploaded media to any host set in an environment variable without validation.

Install only if you are comfortable sending generation prompts and selected media to MiniMax. Keep MINIMAX_API_KEY private, avoid setting MINIMAX_API_HOST unless you fully trust the endpoint, and do not upload portraits, voice samples, or confidential media without consent and a clear data-handling reason.

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
scripts/minimax_api.py:31
Finding

Unrestricted API Host Override Can Expose Credentials and User Content

Content
View full analysis

Vulnerability Details

File Location: scripts/minimax_api.py, lines 31-37, with credential transmission at lines 44-59 and 109-141
Vulnerability Type: Unvalidated network destination for authenticated requests
Risk Level: High

Vulnerable Code

python
def _get_config():
    """Return (api_key, api_host, api_base). Raises if key is missing."""
    api_key = os.environ.get("MINIMAX_API_KEY", "")
    if not api_key:
        raise RuntimeError("MINIMAX_API_KEY environment variable is not set")
    api_host = os.environ.get("MINIMAX_API_HOST", DEFAULT_API_HOST).rstrip("/")
    return api_key, api_host, api_host + "/v1"

The resulting destination is used for authenticated API requests:

python
def _api_request(endpoint, method="GET", body=None, timeout=120, query=None):
    """Make an API request and return the parsed JSON response."""
    api_key, _, api_base = _get_config()
    url = api_base + "/" + endpoint
    if query:
        sep = "&" if "?" in url else "?"
        url += sep + urllib.parse.urlencode(query)

    data = None
    if body is not None:
        data = json.dumps(body, ensure_ascii=False).encode("utf-8")

    req = urllib.request.Request(url, data=data, method=method)
    req.add_header("Authorization", "Bearer " + api_key)
    if body is not None:
        req.add_header("Content-Type", "application/json; charset=utf-8")

It also controls the destination for local file uploads:

python
def _upload_file(filepath, purpose="image"):
    """Upload a file and return file_id."""
    api_key, _, api_base = _get_config()
    url = api_base + "/files/upload"

    import mimetypes
    mime = mimetypes.guess_type(filepath)[0] or "application/octet-stream"

    boundary = uuid.uuid4().hex
    with open(filepath, "rb") as f:
        file_data = f.read()
    filename = os.path.basename(filepath)

    body_parts = []
    body_parts.append(("--" + boundary).encode())
    body_parts.append(
        ('Content-Disposition: form-da
...[truncated 3604 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove MINIMAX_API_HOST configurability unless custom endpoints are an essential supported requirement.
  2. If an override is necessary, parse it with urllib.parse.urlsplit() and enforce:
    • HTTPS only.
    • An explicit allowlist of trusted hostnames, preferably only api.minimaxi.com.
    • No embedded username or password.
    • No fragment or query string.
    • No unexpected path.
    • No nonstandard port unless explicitly approved.
  3. Resolve and compare the final request origin before adding the Authorization header.
  4. Disable redirects or ensure authorization headers are never forwarded across origins.
  5. Require explicit user confirmation before uploading local files, clearly identifying both the file and destination.
  6. Reject plain HTTP even for custom hosts.
  7. Consider separating credentials by allowed origin so a MiniMax credential cannot be attached to arbitrary requests.
  8. Add automated tests confirming that attacker-controlled hosts, malformed URLs, HTTP URLs, embedded credentials, and cross-origin redirects are rejected.

A hardened configuration pattern could use a fixed endpoint:

python
DEFAULT_API_HOST = "https://api.minimaxi.com"

def _get_config():
    api_key = os.environ.get("MINIMAX_API_KEY", "")
    if not api_key:
        raise RuntimeError("MINIMAX_API_KEY environment variable is not set")
    return api_key, DEFAULT_API_HOST, DEFAULT_API_HOST + "/v1"

If override support must remain, validate the parsed origin against a strict allowlist before constructing any request or attaching credentials.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (18)

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

Scanner excerpt · scripts/generate_and_send.py (reported line 26)May include surrounding context.

python
fter generation, prints the file path so the agent can send via feishu-media skill.
Set FEISHU_CHAT_ID env var to auto-print the feishu-media command.
"""

import argparse
import json
import os
import sys

# Add skill scripts dir to path so we can import minimax_api
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import minimax_api


def main():
    parser = argparse.ArgumentParser(description="Generate with MiniMax and prepare for Feishu send")
    parser.add_argument("type", choices=["tts", "music", "image", "i2i", "video"],
                        help="Generation type")
    parser.add_argument("prompt", help="Text prompt for generation")
    parser.add_argument("-o", "--output", default="", help="Output file path")
    parser.add_argument("--feishu-chat", default="", help="Feishu chat/group ID to send to")
    parser.add_argument("--caption", default="", help="Caption text for the message")

    # TTS args
    parser.add_argument("--voice", default="female-shaonv", h

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill advertises executable Python and CLI usage that relies on environment variables, network access to MiniMax APIs, and shell invocation, but it does not declare any tool scope or permission boundaries. This creates an authorization and review gap: an agent may invoke capabilities broader than users or operators expect, increasing the chance of unintended external calls or secret exposure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill encourages sending text prompts, local images, image URLs, and generated media to external MiniMax endpoints without clearly warning that this transfers potentially sensitive user content to a third-party service. In an agent setting, users may assume local-only processing, so the missing disclosure can lead to accidental privacy breaches or policy violations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation instructs users to provide a portrait image to an external third-party API for image-to-image generation, but it does not warn that this may transmit sensitive biometric or personal data off-platform. Because portraits are inherently privacy-sensitive and may implicate consent, retention, and compliance concerns, omission of a warning can lead to unsafe or unauthorized disclosure.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 7)May include surrounding context.

md
## Endpoint

`POST https://api.minimaxi.com/v1/music_generation`

## Auth

External Transmission

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

md
## Endpoint

`POST https://api.minimaxi.com/v1/music_generation`

## Auth

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/tts-guide.md (reported line 8)May include surrounding context.

bash
cd skills/MiniMaxStudio
pip install -r requirements.txt
brew install ffmpeg   # macOS (or: sudo apt install ffmpeg)
export MINIMAX_API_KEY="your-api-key"   # sk-api-xxx or sk-cp-xxx
python scripts/check_environment.py

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The guide instructs users to clone a voice from a local audio sample but does not disclose that the sample will be uploaded to an external third-party API/service for processing. This creates a privacy and consent risk, especially if users provide sensitive, copyrighted, or biometric voice data without understanding where it is sent or retained.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The document states 'Gender (mandatory match) — male voices for male characters, female for female,' which imposes a strict gender policy in natural language rather than offering user preference or flexibility. This is a language/policy-style constraint that can conflict with organizational expectations around user choice and inclusive voice selection.

Content

No source excerpt is available for this finding.

YARA rule 'network_reconnaissance': Network reconnaissance and scanning patterns [hacktools]

Medium
Category
YARA Match
Confidence
65% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

Scanner excerpt · references/tts-voice-catalog.md (reported line 235)May include surrounding context.

md
| M | A | Humorous | Comedy |
| `Spanish_Debator` | Debator | M | A | Persuasive | Debate |
| `Spanish_ToughBoss` | Tough Boss | M | A | Harsh, demanding | Business, drama |
| `Spanish_AngryMan` | Angry Man | M | A | Frustrated | Drama, comedy |
| `Spanish_PowerfulSoldier` | Powerful Soldier | M | A | Strong, brave | Action, military |
| `Spanish_PassionateWarrior` | Passionate Warrior | M | A | Fierce, dedicated | Action, fantasy |
| `Spanish_PowerfulVeteran` | Powerful Veteran | M | A | Experienced | Military |
| `Spanish_SensibleManager` | Sensible Manager | M | A | Practical | Business |
| `Spanish_Kind-heartedGirl` | Kind-hearted Girl | F | C | Warm, compassionate | Children's |
| `Spanish_SophisticatedLady` | Sophisticated Lady | F | A | Elegant, refined | Formal |
| `Spanish_FrankLady` | Frank Lady | F | A | Direct, honest | Comedy |
| `Spanish_Fussyhostess` | Fussy Hostess | F | A | Demanding | Comedy, drama |
| `Spanish_Wiselady` | Wise Lady | F | E | Experienced, wise | Guid

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/minimax_api.py (reported line 158)May include surrounding context.

python
def get_duration_ms(filepath):
    """Get duration of a media file in milliseconds using ffprobe if available, else raise."""
    try:
        out = subprocess.check_output(
            ["ffprobe", "-v", "error", "-show_entries", "format=duration",
             "-of", "default=noprint_wrappers=1:nokey=1", filepath],
            stderr=subprocess.STDOUT,

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The manifest describes this skill as a MiniMax multimodal generation toolkit for TTS, music, image, and video generation. However, the documentation also includes a 'Generate & Send to Feishu' workflow, introducing messaging-platform delivery preparation that is outside the stated MiniMax generation scope.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This markdown file documents use of Authorization: Bearer <MINIMAX_API_KEY> but provides no warning that the skill requires a sensitive secret or that the key should be protected and not exposed in logs, examples, or shared output. For markdown files, omission of warnings about privacy- or credential-relevant behavior is in scope for missing user warnings.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file includes natural-language usage guidance that requires specific Chinese bracketed commands such as [左移] and [右摇]. Because the file does not offer an alternative language, opt-in, or justification that the API is intentionally Chinese-only, it can conflict with language/locale policy expectations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The examples embed Chinese terms such as "固定", "拉远", and "跟随" directly in otherwise English guidance. This imposes a mixed-language usage pattern without explaining that users may choose their preferred language or locale, which can violate language-choice policy expectations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The section teaches bracketed commands using only Chinese tokens like "左摇", "上升", "推进", and "下摇". Because the file is otherwise in English, this effectively mandates a specific language format for commands without user opt-in or justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The checklist says to use "[运镜指令]" for precise control, which is a Chinese placeholder embedded in English documentation. This suggests a required locale-specific format without offering a language choice or justification.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest and module documentation frame the skill as a MiniMax API wrapper for generating voice, music, images, and video. However, get_duration_ms invokes the local ffprobe binary via subprocess, which is a host-command execution capability not clearly justified by the stated API-client purpose and is not used elsewhere in this file's generation flow.

Content

No source excerpt is available for this finding.