Back to skill

Security audit

Gen Music

Security checks for vulnerabilities and agentic risk

Overview

This music-generation skill has a coherent purpose, but its helper script trusts backend-controlled output URLs in ways that can expose local files or bearer tokens.

Install only if you trust the configured ACE-Step backend and understand that prompts, lyrics, and any configured ACESTEP_API_KEY may be sent to it. Avoid remote or plaintext HTTP backends, use a narrowly scoped API key, and treat generated output folders and manifests carefully because a malicious backend could cause unexpected local files to be copied there.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (3)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/generate.py:314
Finding
Backend-Controlled Output Reference Enables Arbitrary Local File Copying## Vulnerability Details **File Location**: `scripts/generate.py:314-329, 342-357` **Vulnerability Type**: Backend-controlled arbitrary local file access **Risk Level**: High ### Vulnerable Code ```python def local_source_path(file_value: str) -> Path | None: if not file_value: return None parsed = urllib.parse.urlparse(file_value) if parsed.scheme in {"http", "https"}: query = urllib.parse.parse_qs(parsed.query) local_path = query.get("path", [None])[0] return expand_optional_path(local_path) if parsed.path == "/v1/audio": query = urllib.parse.parse_qs(parsed.query) local_path = query.get("path", [None])[0] return expand_optional_path(local_path) if file_value.startswith("/v1/audio?path="): query = urllib.parse.parse_qs(parsed.query) local_path = query.get("path", [None])[0] return expand_optional_path(local_path) path = expand_optional_path(file_value) if path and path.exists(): return path return None ``` ```python def save_outputs( entries: list[dict[str, Any]], base_url: str, out_dir: Path, headers: dict[str, str], ) -> list[Path]: out_dir.mkdir(parents=True, exist_ok=True) saved: list[Path] = [] for index, entry in enumerate(entries, start=1): file_value = entry.get("file") if not isinstance(file_value, str) or not file_value: continue source_path = local_source_path(file_value) suffix = Path(source_path.name).suffix if source_path else Path(urllib.parse.urlparse(file_value).path).suffix suffix = suffix or ".mp3" destination = out_dir / f"{index:02d}{suffix}" if source_path and source_path.exists(): shutil.copy2(source_path, destination) else: url = file_value if file_value.startswith("/"): ...[truncated 2327 chars]
Remediation
## Remediation Suggestions 1. Treat all HTTP and HTTPS values exclusively as network URLs. Never derive a local filesystem path from an arbitrary URL query parameter. 2. Allow local-file copying only when the backend is explicitly configured as a trusted loopback service. 3. Configure a dedicated ACE-Step output root and require every local source to remain beneath it: - Resolve both the approved root and candidate path with `Path.resolve()`. - Verify the candidate using `candidate.is_relative_to(approved_root)`. - Reject traversal, symlinks escaping the approved root, and paths outside the allowlist. 4. Reject direct absolute paths received from remote backends. 5. Prefer opaque output identifiers returned by the backend and retrieve files through a fixed API route. 6. Validate that copied outputs are regular files with expected audio types and enforce a maximum file size. 7. Add regression tests covering absolute paths, `..` traversal, symlink escapes, and HTTP URLs containing malicious `path` parameters.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/generate.py:334
Finding
ACE-Step Bearer Credential Is Forwarded to Backend-Selected Download Hosts## Vulnerability Details **File Location**: `scripts/generate.py:334-369` **Vulnerability Type**: Cross-origin credential disclosure **Risk Level**: High ### Vulnerable Code ```python def download_file(url: str, destination: Path, headers: dict[str, str]) -> None: request_headers = {"User-Agent": DEFAULT_USER_AGENT} request_headers.update(headers) req = urllib.request.Request(url, headers=request_headers) with urllib.request.urlopen(req, timeout=300) as resp: with destination.open("wb") as handle: shutil.copyfileobj(resp, handle) ``` ```python def save_outputs( entries: list[dict[str, Any]], base_url: str, out_dir: Path, headers: dict[str, str], ) -> list[Path]: out_dir.mkdir(parents=True, exist_ok=True) saved: list[Path] = [] for index, entry in enumerate(entries, start=1): file_value = entry.get("file") if not isinstance(file_value, str) or not file_value: continue source_path = local_source_path(file_value) suffix = Path(source_path.name).suffix if source_path else Path(urllib.parse.urlparse(file_value).path).suffix suffix = suffix or ".mp3" destination = out_dir / f"{index:02d}{suffix}" if source_path and source_path.exists(): shutil.copy2(source_path, destination) else: url = file_value if file_value.startswith("/"): url = f"{base_url}{file_value}" download_file(url, destination, headers) saved.append(destination) return saved ``` ```python def build_headers(api_key: str | None) -> dict[str, str]: headers: dict[str, str] = {} if api_key: headers["Authorization"] = f"Bearer {api_key}" return headers ``` ### Technical Analysis `build_headers` places the configured API key in an `Authorization` header. The same header collecti ...[truncated 1837 chars]
Remediation
## Remediation Suggestions 1. Parse and normalize `base_url` and every download URL. 2. Add the `Authorization` header only when the download URL’s scheme, hostname, and effective port exactly match the configured API origin. 3. Use a separate unauthenticated header set for cross-origin downloads. 4. Prefer rejecting cross-origin output URLs entirely unless the user explicitly enables and approves a trusted download origin. 5. Disable automatic redirects or validate every redirect target before forwarding credentials. 6. Restrict accepted schemes to HTTPS, with a narrow loopback HTTP exception where needed. 7. Avoid mutating or reusing a general authentication-header dictionary for unrelated requests. 8. Add tests proving that credentials are absent from cross-origin and redirected requests.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate.py:457
Finding
Remote Endpoints May Receive Prompts, Lyrics, and API Credentials over Plaintext HTTP## Vulnerability Details **File Location**: `scripts/generate.py:457-472, 489-495` **Vulnerability Type**: Cleartext transmission of sensitive information **Risk Level**: Medium ### Vulnerable Code ```python base_url = ( args.base_url.strip() or os.environ.get("ACESTEP_API_BASE_URL", "").strip() or str(config.get("baseUrl", "")).strip() or DEFAULT_BASE_URL ).rstrip("/") api_key = ( args.api_key.strip() or os.environ.get("ACESTEP_API_KEY", "").strip() or str(config.get("apiKey", "")).strip() or "" ) out_dir = ( Path(args.out_dir).expanduser() if args.out_dir else expand_optional_path(os.environ.get("ACESTEP_OUTPUT_DIR")) or default_out_dir(config) ) headers = build_headers(api_key) ``` ```python try: created = request_json( "POST", f"{base_url}/release_task", payload=submit_payload, headers=headers, timeout=60, ) ``` The submitted payload is constructed immediately before the request: ```python submit_payload: dict[str, Any] = { "prompt": prompt, "lyrics": lyrics, "audio_duration": args.duration, "sample_mode": args.sample_mode, "batch_size": args.batch_size, "thinking": args.thinking, "audio_format": args.format, } if args.model: submit_payload["model"] = args.model ``` ### Technical Analysis The Skill accepts an arbitrary base URL and does not validate its transport scheme or distinguish loopback endpoints from remote hosts. The API key is added to request headers, while prompts and complete lyrics are placed in the request body. Plaintext HTTP is appropriate for a loopback-only development service in some threat models. It is not appropriate for a remote endpoint because intermediate network participants can observe or alter the request and response. The project documentation explicitly permits remote endpoint configuration, ...[truncated 1104 chars]
Remediation
## Remediation Suggestions 1. Parse the configured endpoint before making any request. 2. Permit plaintext HTTP only when the normalized hostname is a loopback address such as `127.0.0.1`, `::1`, or an explicitly trusted local deployment. 3. Require HTTPS for all non-loopback endpoints and fail closed with a clear error. 4. Retain normal TLS certificate and hostname verification; do not add insecure certificate-bypass options. 5. Warn users that prompts and lyrics are transmitted to the selected backend. 6. Recommend narrowly scoped, revocable API tokens. 7. Consider requiring explicit confirmation or a dedicated opt-in option before sending sensitive lyrics to a newly configured remote origin.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (8)

Direct Prompt Extraction

High
Category
System Prompt Leakage
Content
prompt = (args.prompt_flag or args.prompt or "").strip()
    if not prompt:
        raise RuntimeError("Missing prompt. Pass it positionally or with --prompt.")
    return prompt


def resolve_lyrics(args: argparse.Namespace) -> str:
Confidence
85% confidence
Finding
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Lp3

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding
The skill documents use of Python plus environment variables, local file output, and local/remote HTTP endpoints, but it does not declare any explicit tool scope such as permissions or allowed-tools. That creates an avoidable trust gap: an agent may exercise network, file read/write, and env access more broadly than users expect, especially because the skill can target remote backends and handle API keys.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill explicitly supports remote `--base-url` values and API-key-based access, yet it does not prominently warn that prompts, lyrics, and possibly credentials will be transmitted to a third-party endpoint. In this context, users may submit sensitive creative content or secrets under the assumption of local processing, leading to privacy, confidentiality, and data-handling risks.

Context-Inappropriate Capability

Medium
Confidence
96% confidence
Finding
The script will download any URL contained in result entries if no local source path is found, including absolute `http` or `https` URLs supplied by the API response. Because the service endpoint is configurable and remote response data is treated as trusted, this creates an SSRF-like/arbitrary outbound fetch capability and can also leak the configured `Authorization` header to attacker-controlled hosts.

Tainted flow: 'destination' from os.environ.get (line 357, credential/environment) → shutil.copy2 (file write)

Medium
Category
Data Flow
Content
suffix = suffix or ".mp3"
        destination = out_dir / f"{index:02d}{suffix}"
        if source_path and source_path.exists():
            shutil.copy2(source_path, destination)
        else:
            url = file_value
            if file_value.startswith("/"):
Confidence
65% confidence
Finding
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The script automatically loads an API key from config/environment and sends it as a bearer token on all requests, including follow-up file downloads. In combination with the arbitrary remote URL fetch behavior, this can expose credentials to an attacker-controlled endpoint; even without that, users are not informed that credentials will be used automatically.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The script sends user-provided prompt and lyrics content to the ACE-Step API via network calls, which can include sensitive creative or personal text. While network submission is part of the tool's function, the code does not provide a clear user-facing disclosure that these inputs will be transmitted to the service.

Context-Inappropriate Capability

Low
Confidence
78% confidence
Finding
The manifest describes generating music via an ACE-Step-compatible backend, but the code also inspects user-specific config files and later reads environment variables for base URL, API key, and output directory. While this may support configuration, accessing local config stores and credentials is not explicitly justified by the stated purpose alone.

Static analysis

No suspicious patterns detected.