Back to skill

Security audit

Alibaba Cloud AI Audio TTS Realtime

Security checks for vulnerabilities and agentic risk

Overview

This TTS skill mostly matches its stated purpose, but it can send your Alibaba Cloud API key and text to an arbitrary configured endpoint, so it needs review before use.

Review before installing. Use only the official DashScope endpoint, avoid passing --base-url unless you have removed credential use or added a strict allowlist, pin the dashscope dependency, and use a narrowly scoped API key. Do not synthesize confidential text unless you intend to send it to Alibaba Cloud, and check where fallback audio files are written.

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

Error
Location
scripts/realtime_tts_demo.py:93
Finding
DashScope API Key Disclosure Through a Caller-Controlled Endpoint<![CDATA[ ## Vulnerability Details **File Location**: `scripts/realtime_tts_demo.py`, lines 93-99, 153-160, and 203 **Vulnerability Type**: Credential exposure through an unrestricted network destination **Risk Level**: High ### Vulnerable Code ```python def _probe_realtime(text: str, voice: str, instruction: str | None, language_type: str, base_url: str) -> dict[str, Any]: dashscope.base_http_api_url = base_url try: stream = dashscope.MultiModalConversation.call( model=REALTIME_MODEL, api_key=os.getenv("DASHSCOPE_API_KEY"), text=text, voice=voice, instruction=instruction, language_type=language_type, stream=True, ) ``` The fallback operation has the same behavior: ```python def _fallback_generate(text: str, voice: str, instruction: str | None, language_type: str, base_url: str, output: Path) -> dict[str, Any]: dashscope.base_http_api_url = base_url response = dashscope.MultiModalConversation.call( model=FALLBACK_MODEL, api_key=os.getenv("DASHSCOPE_API_KEY"), text=text, voice=voice, instruction=instruction, language_type=language_type, stream=False, ) ``` The destination is exposed as an unrestricted command-line argument: ```python parser.add_argument("--base-url", default="https://dashscope.aliyuncs.com/api/v1") ``` ### Technical Analysis The script reads a DashScope API key from the process environment, local `.env` files, or `~/.alibabacloud/credentials`. It then explicitly supplies that credential to the DashScope SDK. At the same time, the SDK's global API endpoint is assigned from the caller-controlled `--base-url` argument without validating its scheme, hostname, port, or trust relationship. Consequently, a caller who can influence invocation arguments can redirect authenticated requests away from the intended Alibaba Cloud service. Although sending the API key and synth ...[truncated 2062 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the `--base-url` option if endpoint customization is not required for normal operation. 2. If regional endpoint selection is necessary, map a small set of supported region names to hardcoded Alibaba Cloud HTTPS endpoints instead of accepting arbitrary URLs. 3. Validate any configurable endpoint before assigning it: - Require the `https` scheme. - Require an exact approved Alibaba Cloud hostname. - Reject user information embedded in URLs. - Reject unexpected ports, IP literals, fragments, and malformed hosts. - Avoid suffix-only hostname checks that can be bypassed with domains such as `aliyuncs.com.attacker.example`. 4. Prevent authenticated requests from following redirects to unapproved hosts. Revalidate the destination after every redirect where SDK configuration permits. 5. If custom endpoints are needed for local testing, require an explicit development-only switch and refuse to attach production credentials to untrusted destinations. 6. Use a narrowly scoped API key with usage limits, monitoring, and regular rotation. 7. Document that TTS input is transmitted to Alibaba Cloud and should not contain secrets unless that disclosure is intended. 8. Parse only the required `DASHSCOPE_API_KEY` entry from `.env` files instead of importing every variable into the process environment. ]]>

T08 · Insecure Dependencies

Warning
Location
SKILL.md:23
Finding
Unpinned DashScope SDK Installation Creates Supply-Chain Risk<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 23-28 **Vulnerability Type**: Unpinned third-party dependency **Risk Level**: Medium ### Vulnerable Code ```bash python3 -m venv .venv . .venv/bin/activate python -m pip install dashscope ``` ### Technical Analysis The installation guidance requests the latest package available under the `dashscope` name without specifying a reviewed version, lock file, package hash, or trusted package index. The package name is consistent with the SDK imported by the script, and the audited project contains no evidence of typosquatting or an intentionally malicious dependency. Nevertheless, an unpinned installation is not reproducible and permits the effective dependency code to change after the Skill has been reviewed. If a future package release is compromised, malicious, or simply incompatible, users following these instructions will install and execute it. Python packages can execute code during installation, import, or normal SDK use, so dependency compromise can affect the local environment with the privileges of the user running `pip` or the demo. ### Attack Path 1. A user follows the prerequisite instructions in `SKILL.md`. 2. The command queries the configured Python package index for the newest release of `dashscope`. 3. A compromised package index, compromised maintainer account, malicious future release, or unsafe index configuration supplies an unreviewed package version. 4. `pip` installs that package into the virtual environment. 5. Package-controlled code executes during installation or when this statement runs: ```python import dashscope ``` 6. Malicious dependency code operates with the user's local permissions and can potentially access files, environment variables, network resources, and the DashScope credential available to the process. ### Impact Assessment The potential impact is bounded by the privileges of the user running the installation and script but may inc ...[truncated 467 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin `dashscope` to a specific version that has been reviewed and tested: ```bash python -m pip install "dashscope==<reviewed-version>" ``` 2. Prefer a committed requirements or lock file rather than an inline installation command. 3. Generate and verify cryptographic hashes for all resolved packages, for example by using a hash-locked requirements file with `pip --require-hashes`. 4. Include transitive dependencies in the lock file so their versions cannot change independently. 5. Configure installation to use a trusted package index and disable unintended extra indexes that could enable dependency-confusion attacks. 6. Review and update pinned versions through a controlled dependency-update process with automated security scanning and compatibility tests. 7. Run dependency installation and the demo in an isolated virtual environment or container with minimal filesystem and credential access. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • 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
Findings (8)

Tainted flow: 'audio_url' from os.getenv (line 186, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Content
def _download_audio(audio_url: str, output_path: Path) -> None:
    output_path.parent.mkdir(parents=True, exist_ok=True)
    with urllib.request.urlopen(audio_url) as response:
        output_path.write_bytes(response.read())
Confidence
90% confidence
Finding
The script downloads a URL returned by the remote TTS service and passes it directly to urllib without validating the scheme, host, or size of the response. If the upstream service, SDK response, or base URL is tampered with, this can enable SSRF-like behavior or retrieval of unexpected content, followed by writing attacker-influenced data to disk.

Credential Access

High
Category
Privilege Escalation
Content
def _load_env() -> None:
    _load_dotenv(Path.cwd() / ".env")
    repo_root = _find_repo_root(Path(__file__).resolve())
    if repo_root:
        _load_dotenv(repo_root / ".env")
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
def _load_env() -> None:
    _load_dotenv(Path.cwd() / ".env")
    repo_root = _find_repo_root(Path(__file__).resolve())
    if repo_root:
        _load_dotenv(repo_root / ".env")
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Lp3

Medium
Category
MCP Least Privilege
Confidence
85% confidence
Finding
The skill documents executable behaviors that involve environment access, local file reads/writes, and network/API usage, but it does not declare any explicit tool scope or permissions boundary. This creates an authorization and review gap: an agent may invoke broader capabilities than a user expects, increasing the risk of unintended data exposure, filesystem modification, or outbound requests with sensitive credentials.

Description-Behavior Mismatch

Medium
Confidence
94% confidence
Finding
The workflow and evidence sections include generic cloud-operation guidance such as confirming region, identifiers, permissions, bounded scope, and saving operational evidence, which is not aligned with a narrowly scoped realtime TTS skill. This kind of scope drift can mislead an agent into performing unrelated provider or cloud actions, expanding behavior beyond speech synthesis and increasing the chance of unauthorized or unexpected operations.

Intent-Code Divergence

Medium
Confidence
91% confidence
Finding
The documentation explicitly frames operations as potentially read-only or mutating, which contradicts the stated purpose of a TTS provider skill. In agentic systems, contradictory guidance can cause policy confusion and broaden action selection, making it easier for the skill to be used as justification for state-changing operations unrelated to audio synthesis.

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
The script sets `DEFAULT_LANGUAGE = "Chinese"`, which makes the skill default to a specific language choice unless the user overrides it. This is a natural-language locale policy issue because the file imposes a language preference without explicit opt-in or justification.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The fallback path sends user-provided text to a remote TTS API and then downloads and writes the returned audio to disk, but the script provides no explicit user-facing warning about this behavior beyond generic argument help. While these actions are part of a TTS demo, the file itself does not visibly disclose the remote transmission or local file write in prompts, logs, or comments near the operation.

Static analysis

No suspicious patterns detected.