Back to skill

Security audit

SenseAudio

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it claims, but its audio-generation script can send text and API credentials over the network with weak endpoint and download controls.

Review before installing. Use script-only output for sensitive content, and generate audio only when you are comfortable sending the text to SenseAudio. Do not pass a custom --url or untrusted endpoint unless the script is changed to bind credentials to approved hosts, validate returned media URLs, and enforce timeouts and size limits.

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/senseaudio_tts.py:29
Finding
Unrestricted Endpoint Configuration and Response URL Handling## Vulnerability Details **File Location**: `scripts/senseaudio_tts.py`, lines 29 and 58–111 **Vulnerability Type**: Arbitrary credential forwarding, server-side request forgery, and unbounded response retrieval **Risk Level**: Medium ### Vulnerable Code ```python parser.add_argument("--url", default=DEFAULT_URL, help="SenseAudio API URL.") ``` ```python def build_request(args: argparse.Namespace, text: str) -> urllib.request.Request: api_key = args.api_key or os.environ.get("SENSEAUDIO_API_KEY") if not api_key: raise SystemExit("Missing API key. Set SENSEAUDIO_API_KEY or pass --api-key.") payload = { "model": args.model, "text": text, "voice_setting": {"voice_id": args.voice_id}, } data = json.dumps(payload).encode("utf-8") headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json", } return urllib.request.Request(args.url, data=data, headers=headers, method="POST") ``` ```python def maybe_download_url(url: str) -> bytes: with urllib.request.urlopen(url) as resp: return resp.read() ``` ```python url_candidates = [ payload.get("audio_url"), payload.get("url"), payload.get("data", {}).get("audio_url"), payload.get("data", {}).get("url"), payload.get("result", {}).get("audio_url"), payload.get("result", {}).get("url"), ] for item in url_candidates: if isinstance(item, str) and item: return maybe_download_url(item) ``` ### Technical Analysis The command-line `--url` option accepts an arbitrary destination and passes it directly to `urllib.request.Request`. The request always includes the SenseAudio bearer credential and submitted TTS text. There is no enforcement of HTTPS, no trusted-host allowlist, and no separation between credentials intended for SenseAudio and credentials sent to a custom endpoint. Consequently, anyone who can influence the invocation may redirect the API key and potentially sensitive ...[truncated 2577 chars]
Remediation
## Remediation Suggestions 1. Remove the `--url` option unless custom API providers are a required feature. If custom providers must be supported, require explicit opt-in and do not automatically send the SenseAudio credential to them. 2. Enforce HTTPS for the API endpoint and maintain an allowlist of approved API hostnames, such as the documented SenseAudio host. 3. Bind credentials to their intended origin. Refuse to attach the SenseAudio bearer token when the request host differs from the approved SenseAudio API host. 4. Validate every response-provided media URL before opening it: - Permit only `https` URLs. - Allowlist trusted media hosts. - Resolve the hostname and reject loopback, private, link-local, multicast, reserved, and unspecified addresses. - Revalidate every redirect destination and resolved address. - Reject local-file and other non-HTTP(S) schemes. 5. Configure explicit connection and read timeouts for both the API call and secondary download. 6. Stream responses in bounded chunks instead of calling `read()` without a limit. Enforce a maximum API response size and maximum audio size before writing data. 7. Verify the downloaded content type and, where supported, expected content length before accepting it as audio. 8. Avoid disclosing raw provider error bodies if they can contain sensitive data; return sanitized diagnostic information instead. 9. Add tests covering arbitrary endpoint rejection, credential origin binding, redirects to private addresses, non-HTTPS URLs, local URL schemes, oversized responses, and slow-response timeouts.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (12)

Direct Prompt Extraction

High
Category
System Prompt Leakage
Content
Avoid exaggerated emotional markers that would make TTS sound unnatural or theatrical unless explicitly requested.

## Output Rules

Default to Chinese output unless the user requests another language.
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
95% confidence
Finding
The skill instructs use of environment variables, local file inputs, and an external TTS API, but it does not declare any tool scope or permission boundaries. That makes the skill capable of triggering networked data transmission and credential use without explicit least-privilege constraints, increasing the chance of unintended execution or overbroad access in an agent runtime.

Vague Triggers

Medium
Confidence
90% confidence
Finding
The description is broad enough to match ordinary conversational, companionship, encouragement, and narration requests, which can cause the skill to activate outside a narrowly bounded TTS-rewriting scenario. Overbroad routing is dangerous because it can steer unrelated user content into persona-driven rewriting and potentially external audio generation workflows without clear necessity.

Vague Triggers

Medium
Confidence
90% confidence
Finding
The activation guidance lists many positive examples but provides no negative boundaries for when the skill should not be used. In agent systems, this increases misrouting risk and can cause sensitive or general-purpose requests to be handled by a skill that rewrites content and may invoke external services.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill gives operational instructions for making real audio-generation API calls and handling API keys, but it does not warn that user text may be transmitted to a third-party service or that secrets must be protected. This is risky because users may provide sensitive personal, emotional, or proprietary text that is then sent externally without informed consent.

External Transmission

Medium
Category
Data Exfiltration
Content
- or pass `--api-key`

Default endpoint and model:
- endpoint: `https://api.senseaudio.cn/v1/t2a_v2`
- model: `SenseAudio-TTS-1.0`

Use `--text-file` when the spoken script is long or already saved as a file.
Confidence
97% confidence
Finding
The skill embeds a concrete external endpoint for TTS generation, confirming that user-provided text can leave the local environment. In this skill's context, the danger is elevated because likely inputs include intimate, emotional, or personalized text, and the file does not pair transmission with privacy notice, minimization guidance, or consent gating.

Vague Triggers

Medium
Confidence
91% confidence
Finding
The default prompt says to use the skill for broadly rewriting text into a persona-driven TTS script, which can overlap with ordinary writing, narration, or stylistic rewording requests. This broad invocation scope increases the chance the agent will route general user input through a persona/comfort-oriented skill unnecessarily, expanding exposure to prompt-injection-style behavior or inappropriate emotional/role-based outputs in situations that did not require this capability.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The file explicitly presents itself as a Chinese-only template set ('人物化 TTS 中文模板') and instructs users to prioritize these templates without any indication that language should follow user preference. In an agent skill, this can cause undesired language switching, reduce usability, and create policy/compliance issues where user locale, accessibility, or consent around language choice matters.

External Transmission

Medium
Category
Data Exfiltration
Content
import urllib.request


DEFAULT_URL = "https://api.senseaudio.cn/v1/t2a_v2"
DEFAULT_MODEL = "SenseAudio-TTS-1.0"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
import urllib.request


DEFAULT_URL = "https://api.senseaudio.cn/v1/t2a_v2"
DEFAULT_MODEL = "SenseAudio-TTS-1.0"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Context-Inappropriate Capability

Medium
Confidence
93% confidence
Finding
The script will fetch any URL supplied in the API's JSON response without validating the host, scheme, or relationship to the trusted SenseAudio service. This creates an SSRF-style outbound fetch primitive and broadens the tool from a simple TTS client into a generic downloader, which is riskier in agent environments where remote responses may be attacker-controlled or tampered with.

Natural-Language Policy Violations

Low
Confidence
97% confidence
Finding
The instruction 'Default to Chinese output unless the user requests another language' imposes a specific language preference by default. The policy allows locale constraints only when the user is offered a choice or the restriction is clearly justified, which is not present here.

Static analysis

No suspicious patterns detected.