T09 · Insecure Skill Coding Practices
- Location
scripts/push_wecom.py:9- Finding
Hardcoded WeCom Webhook Credential
- Content
View full analysis
Vulnerability Details
File Location:
scripts/push_wecom.py, line 9
Vulnerability Type: Hardcoded secret in source code
Risk Level: HighVulnerable Code
python DEFAULT_WEBHOOK_URL = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=0e41994e-9e62-4713-ad69-fddeaaba8e9a"The same credential is also exposed in
SKILL.md, lines 67–74:bash curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=0e41994e-9e62-4713-ad69-fddeaaba8e9a' \ -H 'Content-Type: application/json' \ -d '{ "msgtype": "text", "text": { "content": "百度首页主标题列表:\n1. 标题1\n2. 标题2\n3. 标题3" } }'Technical Analysis
The project embeds a reusable WeCom robot webhook key directly in both executable source code and documentation. A WeCom webhook URL is a bearer credential: possession of the complete URL generally enables the holder to submit messages to the associated robot without another authentication factor.
Sending extracted search-result titles to WeCom is consistent with the Skill's declared functionality. However, distributing a shared destination credential is not required to provide that functionality and violates least-secret-exposure principles. The script supports
WECOM_WEBHOOK_URLand--webhook-url, but silently falls back to the exposed credential, causing ordinary execution to transmit titles to a fixed destination that may not be controlled or understood by the user.No evidence was found that the script reads arbitrary files, harvests credentials, executes remote payloads, establishes persistence, or transmits data other than titles explicitly provided through command-line arguments or standard input.
Attack Path
- An attacker obtains the Skill package, reads its documentation, or accesses a repository or artifact containing these files.
- The attacker copies the complete webhook URL and its embedded key.
- The attacker sends crafted HTTP POST request ...[truncated 1235 chars]
- Remediation
View remediation
Remediation Suggestions
-
Immediately revoke and rotate the exposed WeCom webhook key.
-
Remove the complete webhook URL from both
scripts/push_wecom.pyandSKILL.md, including examples. -
Require the webhook to be supplied explicitly through a protected environment variable or secret manager. Do not provide a shared fallback:
python webhook_url = os.environ.get("WECOM_WEBHOOK_URL") if not webhook_url: parser.error("WECOM_WEBHOOK_URL must be configured") -
Consider removing
--webhook-url, because command-line arguments may be visible in shell history and process listings. If retained, document this exposure and prefer environment-based secret injection. -
Validate that the destination uses HTTPS and restrict the hostname to the expected WeCom API domain when custom destinations are unnecessary.
-
Clearly disclose the destination and request confirmation before the first non-dry-run transmission.
-
Redact webhook URLs and query-string keys from diagnostics, logs, exceptions, and user-facing output.
-
Use placeholder values such as
https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=REDACTEDin documentation. -
Review repository history, build artifacts, logs, and published packages for the exposed key; deleting it only from the current files is insufficient.
-
Add secret-scanning checks to CI to prevent future commits containing webhook keys or comparable bearer credentials.
-
