T09 · Insecure Skill Coding Practices
- Location
scripts/main_send_msg.py:100- Finding
Sensitive WeChat Context Token Disclosed in Console Logs
- Content
View full analysis
Vulnerability Details
File Location:
scripts/main_send_msg.py:100
Vulnerability Type: Sensitive authentication material written to standard output
Risk Level: MediumVulnerable Code:
python print(f"上下文Token: {CONTEXT_TOKEN if CONTEXT_TOKEN else '(为空,可能影响首次发送)'}")Technical Analysis
The script reads a WeChat conversation context token from the OpenClaw account store and prints the complete value to standard output. This token is authentication-related session material and is not required in logs for the declared message-delivery functionality.
Standard output may be captured by OpenClaw execution logs, terminal recording, CI/CD systems, process supervisors, centralized logging services, or debugging transcripts. Consequently, principals that are not authorized to access the account configuration may nevertheless obtain the token through less-protected log storage.
Printing whether a context token is present would be sufficient for diagnostics. Printing its full value exceeds the minimum disclosure necessary to perform or troubleshoot message delivery.
Attack Path
- A legitimate user invokes
main_send_msg.pyto send a WeChat message. - The script reads the context token from the account's
.context-tokens.jsonfile. - Before sending the request, the script writes the complete token to standard output.
- An execution environment, process supervisor, or logging service stores the output.
- An attacker or lower-privileged operator with access to those logs retrieves the token.
- Depending on server-side token validation and binding, the exposed token may assist unauthorized interaction with or impersonation within the associated conversation.
Impact Assessment
The direct scope is the WeChat conversation associated with the exposed context token. Exploitation requires access to captured output or logs; this issue does not independently grant local code execution or system ...[truncated 378 chars]
- A legitimate user invokes
- Remediation
View remediation
Remediation Suggestions
- Remove the context token from all console and debug output.
- Log only a boolean state, such as
Context token present: yes. - If correlation is operationally necessary, use a short, non-reversible keyed fingerprint rather than any token substring.
- Configure logging filters to redact fields named
token,context_token,Authorization, and similar credential-bearing fields. - Review existing logs and delete or restrict any records containing previously exposed tokens.
- Rotate affected context tokens where rotation is supported.
- Add automated tests that fail if authentication values are passed to logging functions.
