T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/wechat.py:2505
- Finding
- Enterprise chat content and contact identities are transmitted to an unrestricted endpoint<![CDATA[ ## Vulnerability Details **File Location**: `scripts/wechat.py:2505-2546`, with call sites at `scripts/wechat.py:1902` and `scripts/wechat.py:2124` **Vulnerability Type**: Sensitive-data transmission to a caller-controlled network destination **Risk Level**: Critical ### Complete Code Snippet ```python def _call_ai_api(self, contact_name: str, customer_messages: List[Dict[str, Any]], api_url: str, api_key: str, model: str = "") -> List[Dict[str, Any]]: try: headers = { "Content-Type": "application/json", "Authorization": f"Bearer {api_key}" } data = { "model": model, "messages": customer_messages, "stream": False, "temperature": 0.7, "max_tokens": 1000 } data["user_id"] = None data["user_name"] = contact_name response = requests.post( api_url, json=data, headers=headers, timeout=30 ) ``` The data flow is invoked after chat messages are extracted: ```python ai_replies = self._call_ai_api( current_chat_name, chat_data, api_url, api_key, model ) ``` ### Technical Analysis The request body contains the extracted conversation in `messages` and the contact identity in `user_name`. The destination is supplied through `api_url` without a hostname allowlist, scheme restriction, destination validation, or user confirmation immediately before disclosure. Network transmission is necessary for the optional AI-reply feature, but unrestricted transmission is not the minimum privilege required. A secure implementation could constrain requests to explicitly trusted HTTPS endpoints and minimize or redact the data sent. The behavior also conflicts with the privacy statement in `SKILL.md:211-214`, which says that operations remain local and no data is uploaded. Users may therefore enable the feature without informed consent to the actual disclo ...[truncated 1092 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Permit only explicitly configured and reviewed HTTPS endpoints. 2. Validate the parsed URL, hostname, resolved addresses, port, and scheme before sending data. 3. Reject plaintext HTTP for non-loopback destinations and prevent unsafe redirects. 4. Display the exact destination and categories of data being sent, then require explicit consent. 5. Redact secrets, identifiers, and unnecessary historical messages before constructing the request. 6. Send only the minimum conversation context required for the requested reply. 7. Add enterprise DLP, retention, and audit controls. 8. Correct the documentation so it clearly states when conversation data leaves the device. 9. Consider a local-model mode for environments where enterprise messages cannot be disclosed externally. ]]>
