Back to skill

Security audit

Minimax Music Gyh

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward MiniMax music-generation helper, with some privacy and hardening caveats but no evidence of hidden or malicious behavior.

Use this only if you are comfortable sending prompts, lyrics, and request metadata to MiniMax. Set MINIMAX_API_KEY only for users who should access that account, prefer a virtual environment with pinned dependencies, avoid sensitive unpublished lyrics, and run it from a network environment where an unvalidated provider download URL would not expose private internal services.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/music_gen.py:82
Finding

Unvalidated Server-Provided Download URL Enables SSRF

Content
View full analysis

Vulnerability Details

File Location: scripts/music_gen.py, lines 82-92
Vulnerability Type: Server-Side Request Forgery through an unvalidated download URL
Risk Level: Medium

Vulnerable Code

python
def download_music(file_id: str, output_path: str):
    """下载音乐文件"""
    url = f"{API_HOST}/v1/files/retrieve"
    params = {"file_id": file_id}
    resp = requests.get(url, headers=HEADERS, params=params, timeout=30)
    resp.raise_for_status()
    download_url = resp.json()["file"]["download_url"]

    print(f"📥 正在下载音乐至 {output_path}...")
    with open(output_path, "wb") as f:
        vr = requests.get(download_url, timeout=120)
        vr.raise_for_status()
        f.write(vr.content)

Technical Analysis

The download URL is taken directly from the MiniMax API response and passed to requests.get() without validating its scheme, hostname, resolved IP address, port, or redirect chain. Redirects are followed by default.

If the upstream API, its account context, or the communication response is compromised, an attacker could provide a URL targeting resources reachable from the machine running the skill. Potential targets include loopback services, private network addresses, link-local services, and cloud instance metadata endpoints.

The authorization header containing the MiniMax API key is not included in this second request, which limits direct credential disclosure. However, the response body from the attacker-selected destination is written to the caller-selected output file.

Attack Path

  1. The user invokes music generation with a chosen output path.
  2. The script requests file metadata from the fixed MiniMax API endpoint.
  3. An attacker who controls or compromises the relevant API response supplies an internal URL, such as a loopback, private-network, or cloud metadata address, in file.download_url.
  4. Alternatively, the attacker supplies an external URL that redire ...[truncated 767 chars]
Remediation
View remediation

Remediation Suggestions

  • Require download URLs to use HTTPS.
  • Allowlist the documented MiniMax download hostnames rather than accepting arbitrary hosts.
  • Reject URLs containing embedded credentials, unexpected ports, fragments, or malformed hostnames.
  • Resolve the destination hostname and reject loopback, private, link-local, multicast, reserved, and unspecified IP ranges for both IPv4 and IPv6.
  • Disable redirects with allow_redirects=False, or validate every redirect destination before following it.
  • Stream the response instead of loading it entirely into memory, and enforce a maximum permitted download size.
  • Verify the returned content type and, where supported, its expected checksum before writing it to disk.
  • Open the output file only after the URL and initial response have passed validation.

T08 · Insecure Dependencies

Note
Location
SKILL.md:24
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, line 24
Vulnerability Type: Unpinned and non-reproducible dependency installation
Risk Level: Low

Vulnerable Code

bash
pip3 install requests

Technical Analysis

The installation instructions request the latest version of requests available from the configured Python package index without specifying an exact reviewed version or integrity hashes. The command also installs into the active Python environment rather than explicitly requiring an isolated virtual environment.

Consequently, installation results can change over time and depend on the user's package-index configuration. A compromised package release, compromised package index, or unsafe alternate index could cause unreviewed package code to be installed and subsequently executed when the script imports requests.

No malicious dependency is embedded in the reviewed project, and requests is spelled correctly. This finding concerns the absence of version and integrity controls rather than evidence that the current package is malicious.

Attack Path

  1. A user follows the documented prerequisite command.
  2. pip3 resolves requests and its transitive dependencies from the user's configured package indexes.
  3. A compromised index, package release, or resolved transitive dependency supplies malicious code.
  4. The package is installed into the active Python environment.
  5. Malicious package code may execute during installation or when music_gen.py imports the dependency.

Impact Assessment

Successfully substituted dependency code would execute with the privileges of the user running pip3 or the music-generation script. It could access that user's files, environment variables—including MINIMAX_API_KEY—and network resources.

The scope may be broader if the installation is performed in a shared or privileged Python environment. This project does not instruct users to run ...[truncated 111 chars]

Remediation
View remediation

Remediation Suggestions

  • Provide a reviewed dependency lock file with exact versions for requests and all transitive dependencies.
  • Include cryptographic hashes and require hash verification, for example through pip install --require-hashes -r requirements.txt.
  • Direct users to create and activate a dedicated virtual environment before installation.
  • Specify the trusted package index explicitly where appropriate and avoid untrusted extra indexes.
  • Use automated dependency monitoring and periodically regenerate the lock file after security review.
  • Document that dependency installation should not be performed with administrator or root privileges.
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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

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

python
if lyrics:
        print(f"   歌词: {lyrics[:50]}{'...' if len(lyrics) > 50 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/music_gen.py (reported line 66)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()

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/music_gen.py (reported line 83)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()

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill advertises capabilities that require environment-variable access and outbound network use, but it does not declare any explicit tool scope or permissions. This weakens least-privilege boundaries and makes it harder for users or hosting systems to understand that the skill can access a credential and transmit data externally.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill states that it uses MINIMAX_API_KEY and a remote music-generation API, but it does not clearly warn that user prompts and optional lyrics will be sent to a third-party service. This creates a privacy and data-handling risk, especially if users provide sensitive text, proprietary content, or unpublished lyrics expecting local-only processing.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code presents its title, docstrings, help text, progress messages, and error output in Chinese only. That creates a natural-language locale constraint for all users without offering any language selection or documenting a justified region-specific limitation.

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

python
if lyrics:
        print(f"   歌词: {lyrics[:50]}{'...' if len(lyrics) > 50 else ''}")

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

Tainted flow: 'download_url' from requests.get (line 85, network input) → requests.get (network output)

Medium
Category
Data Flow
Confidence
87% confidence
Finding

The script trusts a download URL returned by a remote API and fetches it without validating the destination host, scheme, or size. If the upstream service is compromised or returns an unexpected URL, the client could be induced to contact arbitrary hosts, enabling SSRF-like outbound requests or downloading malicious/oversized content.

Content

Scanner excerpt · scripts/music_gen.py (reported line 89)May include surrounding context.

python
print(f"📥 正在下载音乐至 {output_path}...")
    with open(output_path, "wb") as f:
        vr = requests.get(download_url, timeout=120)
        vr.raise_for_status()
        f.write(vr.content)
    print(f"✅ 音乐已保存: {output_path}")