T09 · Insecure Skill Coding Practices
- Location
scripts/providers/wecom.py:59- Finding
Unrestricted WeCom webhook destinations allow outbound disclosure of messages and local images
- Content
View full analysis
tuple[bool, str, dict]: st, r = request(url, body, timeout=self.timeout) code = r.get("errcode", -1) if st == 200 and code == 0: return True, "", r ``` ```python with open(path, "rb") as f: data = f.read() body = {"msgtype": "image", "image": { "base64": base64.b64encode(data).decode(), "md5": hashlib.md5(data).hexdigest(), }} good, err, _ = self._post(url, body) ``` ### Technical Analysis The WeCom provider accepts any destination beginning with `http://` or `https://`. It does not verify that the destination uses HTTPS, belongs to `qyapi.weixin.qq.com`, uses the expected webhook path, or contains a valid WeCom webhook key. Messages and user-selected local images are subsequently transmitted to this unrestricted destination. Images are read into memory and Base64-encoded before transmission. Base64 encoding is required by the legitimate WeCom image webhook protocol and is not intrinsically covert or malicious. The vulnerability arises because the encoded file content can be sent to an arbitrary HTTP endpoint rather than being restricted to the intended WeCom service. The HTTP helper also uses standard redirect handling without an explicit same-origin policy, so destination validation must cover both the initial request and redirects. ### Attack Path 1. An attacker causes a malicious URL to be supplied as `--chat-id`, stored as a WeCom group alias, or configured as the account's default webhook. 2. The user or Agent invokes a ...[truncated 1019 chars]- Remediation
View remediation
