Back to skill

Security audit

MiniMax Feishu Music

Security checks for vulnerabilities and agentic risk

Overview

The skill’s core purpose is clear, but its raw file path handling can upload or overwrite unintended local files.

Review before installing. Use this only with trusted prompts and recipients, avoid cover files outside a dedicated audio folder, and require fixes that validate cover paths and sanitize output filenames before routine use.

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
skill-scripts/send_feishu_music.py:181
Finding

Unrestricted Local File Disclosure Through Cover Audio Upload

Content
View full analysis

Vulnerability Details

File Location: skill-scripts/send_feishu_music.py, lines 181–184; transmitted by generate_music() at line 92
Vulnerability Type: Unrestricted local file read and external transmission
Risk Level: High

Vulnerable Code

python
cover_audio_b64 = None
if args.cover:
    with open(os.path.expanduser(args.cover), 'rb') as f:
        cover_audio_b64 = base64.b64encode(f.read()).decode('utf-8')
    print(f"Using cover mode with reference audio: {args.cover}", file=sys.stderr)

The resulting value is included in the MiniMax request:

python
"audio_base64": cover_audio_base64,

Technical Analysis

The --cover argument accepts an arbitrary filesystem path. The script expands the user directory marker and reads the complete file without verifying that the path:

  • Resides in an approved audio directory.
  • Refers to a regular file rather than a symlink or special file.
  • Contains supported audio data.
  • Meets a reasonable size limit.
  • Was explicitly approved for upload.

The entire file is Base64-encoded and inserted into a request sent to https://api.minimaxi.com/v1/music_generation. Base64 is a transport encoding and provides no confidentiality or access control.

Uploading a user-selected reference audio file is necessary for the documented cover-generation feature. However, unrestricted access to every file readable by the process exceeds the minimum privileges needed for that feature and creates a local-file disclosure channel.

Attack Path

  1. An attacker or untrusted instruction gains influence over the arguments used to invoke the Skill.
  2. The attacker supplies a sensitive readable path through --cover, such as an application configuration, credential file, or private document.
  3. The script opens and reads the entire target file using the privileges of the OpenClaw process.
  4. The file content is Base64-encoded.
  5. generate_music() places the encoded content in the audio_base64 request ...[truncated 780 chars]
Remediation
View remediation

Remediation Suggestions

  1. Canonicalize the supplied path with Path.resolve() before opening it.
  2. Restrict reference files to a dedicated, trusted audio directory and verify that the resolved path remains beneath that directory.
  3. Reject absolute paths, traversal components, symlinks, device files, pipes, sockets, and other non-regular files.
  4. Validate the file using content-based audio inspection rather than relying only on its extension.
  5. Allowlist supported formats and enforce a strict maximum file size before reading the file into memory.
  6. Open files defensively, including protection against symlink and time-of-check/time-of-use attacks where supported.
  7. Require explicit user confirmation before uploading any file outside the expected workspace.
  8. Document clearly that the selected reference audio is transmitted to MiniMax.
  9. Consider accepting a previously approved media object rather than a raw local filesystem path.

T09 · Insecure Skill Coding Practices

Error
Location
skill-scripts/send_feishu_music.py:136
Finding

Arbitrary File Overwrite Through Unsanitized Music Title

Content
View full analysis

Vulnerability Details

File Location: skill-scripts/send_feishu_music.py, lines 136–142; invoked with user-controlled input at line 190
Vulnerability Type: Path traversal and arbitrary file overwrite
Risk Level: High

Vulnerable Code

python
def save_to_workspace(file_data: bytes, file_name: str) -> str:
    """Save music file to workspace directory for OpenClaw to send."""
    workspace_dir = os.path.expanduser('~/.openclaw/workspace/songs')
    os.makedirs(workspace_dir, exist_ok=True)
    file_path = os.path.join(workspace_dir, file_name)
    with open(file_path, 'wb') as f:
        f.write(file_data)
    return file_path

The unsanitized command-line value is passed directly to this function:

python
file_path = save_to_workspace(mp3_data, args.title)

Technical Analysis

The --title value is used directly as the second argument to os.path.join(). The code does not reject absolute paths, parent-directory components, path separators, or symlink targets.

If file_name is absolute, os.path.join() discards the intended workspace prefix. If it contains sequences such as ../, the resulting path can escape the songs directory after filesystem resolution. The destination is then opened with wb, which creates a new file or truncates an existing file before writing generated MP3 bytes.

The implementation also follows filesystem symlinks. Consequently, even a path that appears to be inside the songs directory could resolve to a target outside it.

Attack Path

  1. An attacker or untrusted instruction gains control or influence over the --title argument.
  2. The attacker supplies an absolute path, a traversal path such as ../../target, or a path to a maliciously prepared symlink.
  3. MiniMax successfully returns generated MP3 data.
  4. save_to_workspace() joins the untrusted title with the songs directory without canonical validation.
  5. open(file_path, 'wb') creates or truncates the resolved target.
  6. Generat ...[truncated 753 chars]
Remediation
View remediation

Remediation Suggestions

  1. Treat --title strictly as a filename, not as a path.
  2. Reject absolute paths, . and .. components, directory separators, control characters, and platform-specific alternate separators.
  3. Reduce the input to a validated basename and allow only a conservative character set.
  4. Require or safely append the .mp3 extension.
  5. Resolve the destination path and verify that it remains beneath the canonical songs directory before writing.
  6. Reject existing symlinks and ensure that parent directories are trusted and not symlink-controlled.
  7. Use exclusive file creation where overwriting is not required, or generate a unique server-controlled filename while preserving the requested title only as display metadata.
  8. If replacement is supported, require explicit confirmation and use atomic writes through a temporary file in the same trusted directory.
  9. Apply restrictive file permissions to newly created audio files.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (8)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · skill-scripts/send_feishu_music.py (reported line 52)May include surrounding context.

python
}

def get_tenant_token(app_id: str, app_secret: str) -> str:
    """Get Feishu tenant access token."""
    import urllib.request

    url = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal"

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

python
lib.request.Request(url, data=data, headers={
        'Authorization': f'Bearer {token}',
        'Content-Type': 'application/json'
    })

    with urllib.request.urlopen(req, timeout=10) as resp:
        result = json.loads(resp.read())

    if result.get('code') != 0:
        raise ValueError(f"Send failed: {result}")

    return result['data']['message_id']

def main():
    parser = argparse.ArgumentParser(description='Generate music via MiniMax and send to Feishu')
    parser.add_argument('user_id', help='Feishu open_id of recipient')
    parser.add_argument('--prompt', required=True, help='Music style prompt (English)')
    parser.add_argument('--lyrics', required=True, help='Song lyrics')
    parser.add_argument('--title', default='song.mp3', help='File name for the music file')
    parser.add_argument('--cover', help='Path to reference audio file for music-cover mode (preserves melody, swaps lyrics)')
    parser.add_argument('--config', default='~/.openclaw/openclaw.json', hel

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger phrases include very generic terms like "send music", "generate song", and common conversational Chinese phrases such as "唱给我听", which can match ordinary user requests without clearly signaling that an external action will occur. In this skill, that ambiguity is riskier because the action is not just content generation but also delivery of an audio attachment to a Feishu recipient, increasing the chance of unintended invocation and data transmission.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The description says the skill can send generated music as a Feishu attachment, but it does not present this as an explicit user-facing warning or consent checkpoint. Because the skill performs outbound delivery to a recipient identified by open_id, users may not realize their generated content will be transmitted externally, which can cause accidental sharing or privacy issues.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
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.

Content

Scanner excerpt · SKILL.md (reported line 22)May include surrounding context.

Configure music_config.json

Create ~/.openclaw/workspace/skills/minimax-feishu-music/music_config.json:

json
{

External Transmission

Medium
Category
Data Exfiltration
Confidence
94% confidence
Finding

The skill sends user-supplied prompts, lyrics, and optionally full reference audio to the external MiniMax service. In an agent-skill context this is security-relevant because local or user data may be exfiltrated to a third party without strong consent boundaries, especially when --cover can upload arbitrary local files as base64 audio.

Content

Scanner excerpt · skill-scripts/send_feishu_music.py (reported line 77)May include surrounding context.

python
"""
    import urllib.request

    url = "https://api.minimaxi.com/v1/music_generation"
    
    if cover_audio_base64:
        # Cover mode: preserve melody/structure, swap lyrics

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The function send_feishu_file_message is documented as sending a file attachment via the Feishu API, and the module/doc text also frames the script as directly sending via Feishu. However, this function is never used; the actual send path in main shells out to openclaw message send instead. This is an active contradiction between documented intent and implemented behavior.

Content

No source excerpt is available for this finding.

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

python
print("Sending via openclaw...", file=sys.stderr)
        import subprocess
        result = subprocess.run(
            ['openclaw', 'message', 'send', '--channel', 'feishu', '--target', args.user_id, '--media', file_path],
            capture_output=True, text=True
        )