T09 · Insecure Skill Coding Practices
- Location
skill.js:3- Finding
Unrestricted TTS Endpoint May Expose Dialogue and API Credentials
- Content
View full analysis
Vulnerability Details
File Location:
skill.js, lines 3–16
Vulnerability Type: Unvalidated external endpoint and sensitive-data transmission
Risk Level: MediumVulnerable Code
js const { dialogue } = inputs; const API_KEY = env.API_KEY; const API_BASE = env.API_BASE; const MODEL_NAME = env.MODEL_NAME; const res = await fetch(`${API_BASE}/tts`, { method: "POST", headers: { "Authorization": "Bearer " + API_KEY, "Content-Type": "application/json" }, body: JSON.stringify({ model: MODEL_NAME, text: dialogue }) });Technical Analysis
The Skill sends the user-provided dialogue and an API key to a URL constructed directly from the environment-controlled
API_BASEvalue. It does not parse or validate the URL, enforce HTTPS, restrict the destination hostname, reject embedded credentials, or limit the destination port.Sending dialogue to an external service is necessary for the declared remote TTS functionality. However, allowing an unrestricted destination exceeds the minimum safe network scope. A malicious or compromised configuration can redirect the request to an attacker-controlled endpoint. If an
http://URL is accepted, the bearer credential and dialogue can also traverse the network without transport encryption.Attack Path
- An attacker compromises deployment configuration or otherwise gains influence over
API_BASE. - The attacker changes
API_BASEto an attacker-controlled server or a plaintext HTTP endpoint. - A user invokes the Skill with dialogue that may contain confidential content.
- The Skill sends the dialogue in the JSON request body and
API_KEYin theAuthorizationheader to the configured endpoint. - The attacker captures the dialogue and bearer credential and may reuse the credential within the permissions granted by the TTS provider.
Impact Assessment
Successful exploitation can disclose user dial ...[truncated 598 chars]
- An attacker compromises deployment configuration or otherwise gains influence over
- Remediation
View remediation
Remediation Suggestions
- Parse
API_BASEwithnew URL()and reject malformed values. - Require the
https:protocol; reject plaintext HTTP and all unexpected schemes. - Enforce an explicit allowlist of approved TTS provider hostnames rather than accepting arbitrary destinations.
- Reject embedded URL credentials, unexpected ports, and hosts resolving to loopback, link-local, or private network ranges unless such access is explicitly required.
- Use a provider-specific, least-privileged API key with restricted capabilities and quotas, and rotate it if exposure is suspected.
- Document clearly that dialogue is transmitted to an external TTS provider and may be subject to that provider's retention and privacy policies.
- Validate required environment values at startup and fail closed when endpoint validation fails.
- Avoid logging the authorization header, API key, dialogue, or full request payload.
- Parse
