T09 · Insecure Skill Coding Practices
- Location
scripts/tts.py:66- Finding
TLS Certificate and Hostname Verification Disabled
- Content
View full analysis
Vulnerability Details
File Location:
scripts/tts.py, lines 66–70
Vulnerability Type: Improper TLS certificate validation
Risk Level: HighVulnerable Code
python if parsed.scheme == "wss": ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE self._sock = ctx.wrap_socket(raw, server_hostname=host)Technical Analysis
The WebSocket client creates a TLS context but explicitly disables hostname verification and certificate-chain validation. Consequently, the client accepts any certificate presented during a
wss://connection, including a self-signed or attacker-controlled certificate.This affects the connection to the documented iFlytek TTS endpoint. The request carries a signed authorization URL containing the API key and HMAC signature, as well as the user-supplied text encoded with Base64. Base64 is only transport encoding and provides no confidentiality.
The Base64 encoding itself is necessary for the documented TTS protocol and does not appear to be a covert exfiltration channel. Sending user-supplied text to the disclosed cloud TTS endpoint is consistent with the Skill's declared functionality. However, disabling TLS validation is unnecessary and defeats the security expected from that connection.
Attack Path
- A user invokes the Skill to synthesize sensitive or private text.
- An attacker obtains a network interception position, such as through a malicious Wi-Fi access point, compromised proxy, DNS manipulation, or network-routing attack.
- The attacker redirects or intercepts the connection to the iFlytek hostname.
- The attacker presents an arbitrary TLS certificate.
- Because certificate-chain and hostname validation are disabled, the client accepts the attacker's certificate.
- The client sends the authenticated WebSocket request, including the API key, time-limited signature, application identifier, synthesis settings, and Base64-encoded plaintext ...[truncated 699 chars]
- Remediation
View remediation
Remediation Suggestions
- Preserve the secure defaults from
ssl.create_default_context():
python if parsed.scheme == "wss": ctx = ssl.create_default_context() self._sock = ctx.wrap_socket(raw, server_hostname=host)- Do not set
check_hostnametoFalseorverify_modetossl.CERT_NONE. - Ensure the runtime has an up-to-date trusted CA bundle. If a private CA is legitimately required, load only that CA explicitly rather than disabling validation globally.
- Validate the complete WebSocket upgrade response, including the HTTP status and
Sec-WebSocket-Acceptvalue derived from the client nonce, before transmitting credentials or user text. - Fail closed on any certificate, hostname, handshake, or protocol validation error.
- Consider certificate pinning only if the provider publishes and maintains a supported pinning policy; otherwise, standard platform trust validation is preferable.
- Document that submitted text is sent to the third-party TTS provider so users can avoid transmitting content unsuitable for external processing.
- Preserve the secure defaults from
