T09 · Insecure Skill Coding Practices
- Location
scripts/onebot_ws_listener.py:81- Finding
Unredacted OneBot Events Expose Message and Identity Data in Logs
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This QQ/OneBot adapter is mostly coherent, but it exposes moderation actions and private message data in ways users should review carefully before installing.
Install only if you are comfortable giving the skill access to your configured OneBot server and bot account. Before production use, restrict the token and endpoint to trusted hosts, prefer TLS for remote connections, disable or redact verbose event logging, and add explicit authorization and confirmation around message deletion, kicks, bans, and group-setting changes.
scripts/onebot_ws_listener.py:81Unredacted OneBot Events Expose Message and Identity Data in Logs
scripts/onebot_client.py:25Configurable Plaintext Transports Can Expose OneBot Tokens and Message Traffic
scripts/onebot_ws_listener.py:45Incorrect Handler Registration Processes Group Messages as Private Messages
The declared description frames the skill as a message send/receive adapter, but the referenced client capabilities imply substantially broader powers including enumerating contacts/groups and performing destructive or administrative actions such as recalls, kicks, bans, and renames. This mismatch is dangerous because downstream users or agents may grant or invoke the skill under the assumption of low-risk messaging behavior while it can actually perform moderation and information-gathering operations on QQ/OneBot targets.
The skill documents network access and use of environment variables for connection endpoints and tokens, but it does not declare any explicit tool scope or permissions. This creates a capability transparency problem: an agent or reviewer may invoke the skill without realizing it can access sensitive configuration and communicate with external/local services, increasing the chance of unintended data exposure or unauthorized actions.
This markdown file includes a group-management example that removes a user from a group via client.set_group_kick(group_id, user_id) without any accompanying warning, confirmation, or note that the action is administrative and disruptive. For markdown files, examples that can affect user access or system integrity should disclose such behavior so users understand the consequence before adopting the pattern.
This code performs outbound HTTP requests and can transmit message content, group identifiers, and user identifiers to a configured OneBot endpoint. While there are internal docstrings, there is no user-facing confirmation, log message, or warning in this file indicating that data will be sent over the network.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
if method == "GET":
resp = requests.get(url, headers=self.headers, timeout=10)
else:
resp = requests.post(url, headers=self.headers, json=data, timeout=10)
resp.raise_for_status()
return resp.json()
The skill is described as QQ message integration, but this client also exposes administrative operations such as kicking users, banning users, and changing group metadata. In an agent-skill context, capability expansion beyond the stated purpose increases the risk of unintended or unauthorized destructive actions if the skill is invoked with untrusted inputs or granted broad access.
Group moderation and configuration functions are not necessary for simple send/receive QQ integration, so their presence violates least privilege for the advertised purpose. In an autonomous agent environment, these extra functions could be abused to remove users, mute members, or rename groups without operator awareness.
The listener logs the full incoming OneBot event payload, which can include message bodies, user IDs, group IDs, and other metadata. In a QQ/OneBot integration context this is sensitive user data, and printing it to stdout can expose private conversations or identifiers through console output, process supervisors, centralized logs, or shared hosting environments.
The keyword-response example activates on the Chinese term 帮助 and returns a Chinese response, which imposes a specific language behavior without any opt-in or note that the example is locale-specific. This can violate language/locale policy when a skill implicitly assumes one language instead of offering a choice or documenting the constraint.
The client reads ONEBOT_TOKEN from the environment and automatically attaches it as a Bearer token to outbound requests. Although this is a normal implementation pattern, the file does not provide any user-facing notice that credentials are being read from environment variables and transmitted to the remote service.
This code accesses a sensitive credential source via an environment variable to authenticate WebSocket connections. While this is a normal implementation pattern, the file does not include any comment or docstring warning that credentials are consumed from the environment.
No suspicious patterns detected.