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

Content
View full analysis
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
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:23
Finding

Unpinned DashScope SDK Installation Creates Supply-Chain Risk

Content
View full analysis
Remediation
View remediation
" ``` 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
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.

Content

Scanner excerpt · scripts/realtime_tts_demo.py (reported line 83)May include surrounding context.

python
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())

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · scripts/realtime_tts_demo.py (reported line 54)May include surrounding context.

python
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")

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · scripts/realtime_tts_demo.py (reported line 57)May include surrounding context.

python
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")

Undeclared Tool Scope

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.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
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.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
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.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
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.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
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.

Content

No source excerpt is available for this finding.