T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/config.py:166
- Finding
- Sensitive authorization codes and task content can be transmitted over plaintext HTTP## Vulnerability Details **File Location**: `scripts/config.py:166-170`, `scripts/hiboards_client.py:51-75` **Vulnerability Type**: Insufficient transport security validation **Risk Level**: High ### Vulnerable Code ```python # scripts/config.py:166-170 # 验证URL格式 hiboards_url = self.config.get('hiboard_url', '') if not hiboards_url.startswith('http'): logger.warning(f"推送URL格式可能不正确: {hiboards_url}") ``` ```python # scripts/hiboards_client.py:51-75 url = self.base_url # 生成追踪ID trace_id = f"task-push-{datetime.now().strftime('%Y%m%d%H%M%S')}" headers = {**self.default_headers, "x-trace-id": trace_id} try: logger.info(f"发送数据到负一屏: {url}") logger.debug(f"请求头: {headers}") # 包装数据,在外层添加data wrapped_data = {"data": push_data} # 记录数据摘要(不记录完整内容) data_summary = self._get_data_summary(push_data) logger.debug(f"请求数据摘要: {data_summary}") # 发送请求 # 使用json参数,requests会自动处理编码 response = requests.post( url, json=wrapped_data, headers=headers, verify=True, timeout=self.timeout ) ``` ### Technical Analysis The URL validation accepts any value beginning with `http`, including an unencrypted `http://` endpoint. It only emits a warning for other malformed schemes and does not fail closed. The HTTP client then sends the complete wrapped payload to that URL. The payload includes the authorization code, task content, task name, result, identifiers, and completion timestamp. Although `verify=True` is passed to `requests.post`, certificate verification only applies to TLS connections and provides no protection when the selected scheme is plain HTTP. The endpoint is loaded from writable OpenClaw configuration. Consequently, a configuration error or an attacker capable of modifying that configuration can redirect sensitive data through an unencrypted connection. No hostname allowlist or HTTPS-only policy prevents this. ...[truncated 974 chars]
- Remediation
- ## Remediation Suggestions 1. Parse the endpoint with `urllib.parse.urlparse` and require the exact `https` scheme. 2. Reject invalid or insecure URLs with an exception rather than merely logging a warning. 3. Consider allowing only documented, trusted service hostnames. If custom endpoints are required, require explicit user approval before sending credentials to a new hostname. 4. Reject URLs containing embedded credentials, unexpected ports, fragments, or ambiguous host representations. 5. Preserve TLS certificate verification and do not provide an option to disable it in production. 6. Add tests proving that `http://`, malformed schemes, user-information components, and unauthorized hosts are rejected. 7. Rotate any authorization code that may previously have been transmitted over HTTP.
