Back to skill

Security audit

天谱乐音乐生成大师

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a coherent Tianpuyue music-generation integration, but it needs review because output filenames can escape the promised output folder.

Review before installing. Use a dedicated, low-risk OUTPUT_ROOT and only pass simple short filenames until the skill validates --name as a basename and enforces containment. Expect prompts, optional lyrics, task IDs, and the API key to be sent to Tianpuyue, and expect generated files and logs to persist locally.

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

Warning
Location
scripts/common.py:316
Finding

User-Controlled Output Name Permits Path Traversal and Writes Outside the Intended Directory

Content
View full analysis
Path: timestamp = datetime.now().strftime("%Y%m%d%H%M") stem = f"{name}_{timestamp}" if name else f"{item_id}_{timestamp}" return ensure_scene_output_dir(scene) / f"{stem}{suffix}" ``` The generated path is then used without containment validation: ```python # scripts/generate_music.py audio_url = extract_audio_url(item) local_path = default_output_path("music", item_id, ".mp3", name=args.name) download_file(audio_url, local_path) ``` ```python # scripts/generate_song.py audio_url = extract_audio_url(item) local_path = default_output_path("songs", item_id, ".mp3", name=args.name) download_file(audio_url, local_path) ``` ```python # scripts/generate_lyrics.py local_path = default_output_path("lyrics", item_id, ".md", name=args.name) local_path.write_text(f"# {title}\n\n{lyric}", encoding="utf-8") ``` For audio files, the final write is performed by: ```python def download_file(url: str, output_path: Path) -> Path: output_path.parent.mkdir(parents=True, exist_ok=True) log_params("文件下载开始", url=url, output_path=str(output_path.name)) request = Request(url, method="GET") with urlopen(request) as response: output_path.write_bytes(response.read()) size = output_path.stat().st_size log_params("文件下载完成", url=url, output_path=str(output_path.name), size=size) return output_path ``` ### Technical Analysis The `--name` command-line argument is directly incorporated into the destination path. Although the documentation describes it as a short filename description, the implementation does not enforce ...[truncated 3094 chars]
Remediation
View remediation
Path: target_dir = ensure_scene_output_dir(scene).resolve() raw_name = name.strip() if raw_name: candidate = Path(raw_name) if ( candidate.is_absolute() or candidate.name != raw_name or raw_name in {".", ".."} or "/" in raw_name or "\\" in raw_name ): raise ValueError("Invalid output name") if len(raw_name) > 30: raise ValueError("Output name is too long") stem = raw_name else: stem = item_id timestamp = datetime.now().strftime("%Y%m%d%H%M") output_path = (target_dir / f"{stem}_{timestamp}{suffix}").resolve() if not output_path.is_relative_to(target_dir): raise ValueError("Output path escapes the configured directory") return output_path ``` 3. Perform the containment check immediately before every write as defense in depth, particularly after creating parent directories. 4. Consider exclusive file creation or explicit overwrite controls to prevent replacement of an existing destination. 5. Apply filesystem permission hardening to `OUTPUT_ROOT`, and avoid running the Skill with elevated operating-system privileges. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (14)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

该代码块的行为与描述存在明显范围不一致。脚本名、参数说明、日志文本、默认提示词以及调用流程都指向“纯音乐生成”:它创建 music task,等待完成,提取 audio_url,并下载为 .mp3。本段代码没有任何与人声歌曲生成、歌词生成、歌词文本保存、歌曲人声参数控制等相关的逻辑。因此,若将该代码块视为该 skill 的实现,其实际能力明显窄于声明能力。虽然描述中包含纯音乐生成这一部分,与代码一致,但描述还额外声称支持歌曲(含人声)和歌词生成,而这些在代码中未被体现,属于描述与实际行为不完全匹配。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill declares required environment variables and clearly instructs running scripts that perform network access and local file writes, but it does not declare an explicit tool scope such as permissions or allowed-tools. This weakens least-privilege controls and can let the skill operate with broader capabilities than users or orchestrators may expect.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The default prompt is broadly phrased and can cause this skill to be invoked for generic music-related requests without sufficiently narrow boundaries. Over-broad routing can misapply the skill, leading the agent to generate or download external content when the user intent was ambiguous or better handled by another workflow, increasing the chance of unsafe or unintended actions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The file title and instructions are entirely in Chinese and present the guidance as the default user-facing content. There is no indication that users may choose another language or that the skill is intentionally limited to a Chinese-only audience, which fits the language/locale policy violation criterion.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The logger prefix and many runtime messages in this file are hard-coded in Chinese, indicating the skill communicates in a fixed locale. The policy requires avoiding language/locale lock-in unless the skill offers user choice or clearly documents a justified locale restriction.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This function performs a file write by downloading remote content and saving it to the provided output path. While it logs the operation internally, there is no user-facing confirmation prompt or warning here, and file writes are a safety-relevant operation under the review criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script hard-codes a Chinese default prompt and all user-facing CLI descriptions are in Chinese, which steers the skill toward a single language by default. There is no visible option or documented opt-in for language/locale selection, so this is a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The default prompt and CLI description are written to generate Chinese-language music content by default, and the script interface is also presented only in Chinese. This imposes a specific language/locale behavior without any explicit user opt-in or documented justification for the restriction.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill states that generated results are saved locally, but user-facing invocation guidance does not prominently warn before execution that files will be written to disk. In agent settings, undisclosed local writes can surprise users, expose sensitive prompts or generated content on shared systems, and create unsafe assumptions about persistence.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
71% confidence
Finding

The natural-language trigger and invocation instructions are entirely specified in Chinese terms, which can imply a language-specific usage policy. Because the file does not state that the skill is intended only for Chinese-speaking users or offer an alternative language/opt-in, this may violate the requirement to avoid forcing a specific language without user choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code forces a specific language/locale in user-facing natural-language strings such as the argument parser description and option help text. Under the policy, language-specific behavior should offer user choice or document a justified locale constraint, neither of which appears here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The user-facing argparse description and help text are hard-coded in Chinese, which imposes a specific language/locale on users without any opt-in or documented justification. The policy for natural-language violations applies to all file types, including code string literals.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script's natural-language description, argument help, and log messages are all hard-coded in Chinese (for example, "查询天谱乐纯音乐任务状态" and "作品 ID"). There is no indication that the skill is region-specific or that users can opt into the language, which may violate a language/locale policy requiring user choice or documented justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The user-facing CLI description is hardcoded in Chinese ("查询天谱乐歌曲任务状态"), which imposes a specific language on users without offering a language choice or documenting that the tool is intended only for a Chinese-speaking or region-specific context. This matches the policy category for language or locale constraints lacking opt-in or justification.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.