T09 · Insecure Skill Coding Practices
- Location
aliyun_tts.py:76- Finding
Alibaba Cloud Token Request Uses Unencrypted HTTP
- Content
View full analysis
Vulnerability Details
File Location:
aliyun_tts.py, lines 76–80
Vulnerability Type: Plaintext transmission of authentication material
Risk Level: Highpython full_url = f"http://nls-meta.{REGION}.aliyuncs.com/?Signature={signature}&{query_string}" host = f"nls-meta.{REGION}.aliyuncs.com" conn = http.client.HTTPConnection(host) conn.request("GET", full_url) resp = conn.getresponse()Technical Analysis
The skill retrieves an Alibaba Cloud bearer token through an unencrypted HTTP connection. The request exposes the access-key ID, HMAC signature, nonce, timestamp, and other authentication metadata to any party capable of observing network traffic. More importantly, the token returned by the service is also transmitted without transport encryption.
Although the access-key secret itself is not directly included in the request, an on-path attacker can capture the returned bearer token. The Base64 operation at line 73 is a normal encoding step for the HMAC-SHA1 request signature and is not, by itself, a covert exfiltration mechanism. The security issue is that the resulting authentication exchange occurs over plaintext HTTP.
The use of
HTTPConnectionalso provides no TLS certificate authentication or transport integrity. An active attacker could inspect or alter the token-service response, steal a valid token, or return a forged response that causes synthesis requests to fail.Attack Path
- The victim invokes the skill to synthesize speech.
- The skill sends a signed
CreateTokenrequest tonls-meta.cn-shanghai.aliyuncs.comover plaintext HTTP. - An attacker on the same network, a compromised proxy, or another on-path system observes or intercepts the connection.
- The attacker captures the token returned in the plaintext response.
- While the token remains valid, the attacker combines it with the relevant application key and submits unauthorized requests to the Alibaba Cloud T ...[truncated 633 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace
http.client.HTTPConnection(host)withhttp.client.HTTPSConnection(host, timeout=...). - Send only the origin-form request path rather than a plaintext
http://absolute URL. - Rely on Python's validated default TLS context, or explicitly create a secure context with hostname and certificate verification enabled.
- Never permit fallback or redirects from HTTPS to HTTP.
- Add connection and read timeouts and close the connection reliably.
- Avoid logging signed request URLs, token responses, or bearer tokens.
- Rotate credentials and invalidate active tokens if this implementation has been used on an untrusted network.
Example hardened structure:
python request_path = f"/?Signature={signature}&{query_string}" conn = http.client.HTTPSConnection(host, timeout=10) try: conn.request("GET", request_path) resp = conn.getresponse() body = resp.read().decode("utf-8") finally: conn.close()- Replace
