Back to skill

Security audit

Generate ai Music

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent music-generation integration, but its scripts can send the user's API key and prompts to an arbitrary endpoint if an environment variable is set.

Review this skill before installing. It appears intended to generate music through MakebestMusic, but only use it in an environment where MBM_API_BASE cannot be set or inherited from an untrusted source, avoid submitting confidential prompt text, and consider rotating the MakebestMusic key if it was ever used with a non-official endpoint.

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

Error
Location
scripts/generate.js:3
Finding
Configurable API endpoint can disclose the API credential and user prompts<![CDATA[ ## Vulnerability Details **File Location**: `scripts/generate.js`, lines 3 and 22-36 **Vulnerability Type**: Unrestricted destination for authenticated network requests **Risk Level**: High ### Vulnerable Code ```js const API_BASE = process.env.MBM_API_BASE || "https://api.makebestmusic.com"; ``` ```js const res = await fetch(`${API_BASE}/api/skill/generate_music`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${API_KEY}`, }, body: JSON.stringify({ model: "Fi", custom: true, instrumental: instrumental, prompt: prompt, title: "", style: "", advance: { vocal_gender: "", ai_lyrics: true } }), }); ``` ### Technical Analysis The script obtains its API destination from the unrestricted `MBM_API_BASE` environment variable. It then sends the MakeBestMusic API key in an `Authorization` header and the user's music prompt in the request body to that destination. The endpoint override is not documented as part of the Skill's declared functionality and is unnecessary for normal operation. No validation ensures that the destination uses HTTPS or belongs to the official `api.makebestmusic.com` origin. Consequently, a process or configuration source capable of setting `MBM_API_BASE` can redirect the authenticated request to an arbitrary server. A plaintext HTTP URL would also expose the credential and prompt to interception. Sending the credential to the official HTTPS service is necessary for music generation. Allowing arbitrary destinations to receive that credential exceeds the minimum privilege required. ### Attack Path 1. An attacker gains influence over the environment used to launch the Skill, such as through a compromised launcher, unsafe configuration, or inherited environment variable. 2. The attacker sets `MBM_API_BASE` to an attacker-controlled URL, for example `https://attacker.example`. 3. A user asks the Skill to generate music. 4. `generate. ...[truncated 845 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the runtime endpoint override and use the fixed official origin: ```js const API_BASE = "https://api.makebestmusic.com"; ``` 2. If an override is genuinely required for controlled development or testing, validate it before reading or transmitting the API key: ```js const allowedOrigins = new Set([ "https://api.makebestmusic.com" ]); const apiUrl = new URL( process.env.MBM_API_BASE || "https://api.makebestmusic.com" ); if (apiUrl.protocol !== "https:" || !allowedOrigins.has(apiUrl.origin)) { throw new Error("Untrusted MakeBestMusic API endpoint"); } ``` 3. Reject plaintext HTTP, embedded URL credentials, unexpected ports, redirects to other origins, and hostnames not present in an explicit allowlist. 4. Disable automatic cross-origin redirects or verify the final destination before forwarding the `Authorization` header. 5. Read the API key only after the destination has passed validation. 6. Rotate any API key that may have been used while `MBM_API_BASE` pointed to an untrusted endpoint. 7. Document all data sent to the provider, including the prompt and generation options. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/query.js:3
Finding
Configurable status endpoint can disclose the API credential and music task identifiers<![CDATA[ ## Vulnerability Details **File Location**: `scripts/query.js`, lines 3 and 24-29 **Vulnerability Type**: Unrestricted destination for authenticated network requests **Risk Level**: High ### Vulnerable Code ```js const API_BASE = process.env.MBM_API_BASE || "https://api.makebestmusic.com"; ``` ```js const res = await fetch(`${API_BASE}/api/skill/music_status?${musicIdsParam}`, { headers: { Authorization: `Bearer ${API_KEY}`, }, }); const data = await res.json(); ``` ### Technical Analysis The status-query script uses the unrestricted `MBM_API_BASE` environment variable as the destination of a request carrying the MakeBestMusic Bearer API key. Music task identifiers are also placed in the query string and sent to that destination. The script does not require HTTPS, enforce the official MakeBestMusic hostname, restrict ports, or otherwise establish that the credential is being sent to a trusted origin. A malicious environment value can therefore redirect both the API key and task identifiers to an attacker-controlled endpoint. If a plaintext HTTP endpoint is supplied, network observers may also intercept these values. Querying the official service is required for the declared status-checking functionality. The ability to transmit authentication material to arbitrary origins is not required and violates least-privilege design. ### Attack Path 1. An attacker influences the environment in which the Skill runs. 2. The attacker assigns an attacker-controlled or plaintext URL to `MBM_API_BASE`. 3. The user or agent invokes `query.js` to check generated music. 4. The script sends the Bearer API key and requested music IDs to the configured endpoint. 5. The attacker records the credential and identifiers. 6. The attacker may reuse the key against the legitimate service and use the task identifiers to correlate or query the user's generation activity, subject to server-side authorization. ### Impact Assessment Successful exploitation can discl ...[truncated 528 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Hard-code the official HTTPS API origin unless endpoint configurability is an explicit requirement: ```js const API_BASE = "https://api.makebestmusic.com"; ``` 2. If development overrides must remain, parse the value with `new URL()` and enforce: - The `https:` protocol. - An explicit hostname or origin allowlist. - Approved ports only. - No embedded username or password. - No cross-origin redirects carrying the authorization header. 3. Validate the destination before accessing `process.env.apiKey`. 4. Prefer sending identifiers in a request body where supported, reducing their exposure in URLs, proxy logs, and server access logs. 5. Apply strict validation to music IDs, including expected length and character set. 6. Rotate potentially exposed credentials and review service-side usage logs for unauthorized activity. ]]>
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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (6)

Lp3

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding
The skill invokes local Node.js scripts and requires environment and network capabilities, but it does not declare an explicit tool scope such as permissions or allowed-tools. This weakens least-privilege controls and can let the agent execute capabilities beyond what reviewers or users can easily assess, especially since requests are sent to an external service using a stored API key.

Session Persistence

Medium
Category
Rogue Agent
Content
---
name: text-to-music
description: AI music generation assistant powered by MakebestMusic. Use when user wants to create AI-generated music, songs, or audio tracks. Perfect for content creators, musicians, and anyone wanting custom AI music. Triggers on requests like "create a song", "generate music", "makebestmusic", "AI music", "write a melody", etc.
version: 1.2.0
metadata:
  openclaw:
Confidence
60% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger phrases include broad everyday requests like "create a song," "generate music," and "write a melody," which can cause unintended invocation in contexts where the user did not mean to call this external-service skill. Unintended activation can send user prompts to a third-party provider and consume the user's API-backed quota without clear consent at that moment.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill explains how to configure the API key and use the feature, but it does not clearly warn that prompts are transmitted to an external music-generation service using the user's API key. Users may unknowingly disclose sensitive or proprietary text in prompts, creating privacy and data-sharing risk.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The script reads an API credential from an environment variable and only reports an error if it is missing, but it does not disclose to the user that the skill will access and use a secret for authentication. Under the code-file warning criteria, sensitive environment-variable access should have some visible warning, comment, or documented disclosure.

Natural-Language Policy Violations

Low
Confidence
72% confidence
Finding
The setup instructions direct users to "MBM官网," introducing a Chinese-language term in otherwise English instructions without indicating language options or whether localization is required. This can amount to an implicit locale assumption rather than giving users a clear language choice.

Static analysis

Detected: suspicious.env_credential_access

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
scripts/generate.js:3

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
scripts/query.js:3