T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/transcribe.py:28
- Finding
- Audio and Authentication Metadata Transmitted over Plaintext HTTP<![CDATA[ ## Vulnerability Details **File Location**: `scripts/transcribe.py:28`, `scripts/transcribe.py:123-132`, and `scripts/transcribe.py:153-164` **Vulnerability Type**: Plaintext transmission of sensitive data **Risk Level**: High ### Vulnerable Code ```python base_url: str = "http://af-asr.uat.hivoice.cn" ``` ```python def _build_params(self, **kwargs) -> dict[str, str]: """构建带签名的请求参数""" params = { "appkey": self.config.appkey, "timestamp": str(get_timestamp()), **kwargs, } params["signature"] = self._generate_signature(params) return params ``` ```python def upload_file(self, task_id: str, filepath: str) -> str: """上传音频文件""" url = self.config.urls["upload"] file_md5 = calculate_file_md5(filepath) params = self._build_params( userid=self.config.userid, task_id=task_id, md5=file_md5, audiotype=self.config.audiotype, ) with open(filepath, "rb") as f: response_data = self._request("POST", url, params=params, data=f) ``` The same insecure HTTP endpoint is also documented in `SKILL.md:9`, `SKILL.md:166`, and `SKILL.md:181`. ### Technical Analysis The default UniSound API endpoint uses unencrypted HTTP. The script sends audio content directly in the request body and places authentication and task metadata in query parameters, including the application key, timestamp, signature, user ID, task ID, and file digest. HTTP provides neither transport confidentiality nor endpoint authentication. A network-positioned attacker can inspect traffic, alter uploaded audio, modify API responses, or impersonate the remote service. The request signature does not replace TLS because it does not encrypt the recording or transcript and does not authenticate the server to the client. The `UNISOUND_BASE_URL` environment variable can also select an arbitrary endpoint, and the implementation does not require the configured URL to use HTTPS. ### Attack Path 1. A user ...[truncated 1211 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the default endpoint with an authenticated HTTPS endpoint supplied by UniSound. 2. Reject non-HTTPS base URLs before constructing or sending any request: ```python from urllib.parse import urlparse parsed = urlparse(config.base_url) if parsed.scheme != "https": raise ASRError("UNISOUND_BASE_URL must use HTTPS") ``` 3. Keep TLS certificate verification enabled and do not introduce `verify=False`. 4. Restrict configurable endpoints to an explicit allowlist of approved UniSound hostnames where feasible. 5. Avoid placing sensitive authentication metadata in URLs if the API supports authorization headers or signed request bodies. 6. Rotate credentials after migration because authentication metadata may previously have traversed untrusted networks. 7. Do not process production or sensitive recordings through the UAT HTTP endpoint. ]]>
