Back to skill

Security audit

onebot

Security checks for vulnerabilities and agentic risk

Overview

This skill is meant to send QQ messages through OneBot, but it uses shell-built HTTP commands with a hardcoded bearer token, weak confirmation controls, and unsafe handling of message/file content.

Review this skill carefully before installing. It is not inherently malicious, but only use it with a trusted local OneBot/NapCat endpoint, replace the hardcoded bearer value with secure runtime configuration, require explicit confirmation before sending, avoid sensitive messages or arbitrary local file paths, and do not execute generated shell commands unless inputs are safely escaped or passed through a non-shell HTTP client.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:34
Finding
Shell Command Injection Through Unsafely Interpolated User Input## Vulnerability Details **File Location**: `SKILL.md`, lines 34-37 **Vulnerability Type**: Shell command injection **Risk Level**: Critical ### Vulnerable Code ```sh curl -X POST http://{host}:{port}/{endpoint} \ -H "Content-Type: application/json" \ -H "Authorization: Bearer jqllxew" \ -d '{"user_id":"123456","message":"你好"}' ``` The same command-construction pattern is repeated in the examples at lines 48-52, 58-62, 73-77, and 82-86. ### Technical Analysis The skill directs the agent to construct a shell command using user-controlled recipient identifiers, message text, URLs, and local file paths. These values are placed inside a single-quoted shell argument. Ensuring that the resulting content is valid JSON is not equivalent to safely escaping it for a shell. If an input contains a single quote, it can terminate the `-d` argument. Subsequent shell metacharacters can then be interpreted as new commands. The skill states that it operates through local shell commands, so exploitation becomes possible whenever the generated command is executed by a shell. Host and port values should also be treated as untrusted unless they are obtained exclusively from a trusted configuration source. ### Attack Path 1. An attacker asks the agent to send a message containing a single quote followed by shell syntax. 2. The agent inserts the supplied message directly into the single-quoted `-d` argument. 3. The single quote closes the intended shell argument. 4. The shell parses the attacker's remaining input as shell operators and commands. 5. The injected command executes with the privileges of the process or account running the skill. ### Impact Assessment Successful exploitation can provide arbitrary command execution with the privileges of the local agent process. Depending on those privileges, an attacker could read local files, extract credentials, modify data, invoke unrelated network services, or install additi ...[truncated 106 chars]
Remediation
## Remediation Suggestions - Do not generate or execute concatenated shell command strings. - Use a dedicated HTTP library and serialize the request body with a standard JSON encoder. - If `curl` must be invoked, use a process API that accepts an argument array and does not invoke a shell. - Pass the serialized JSON body as one argument rather than embedding it into shell source text. - Strictly validate recipient IDs using an allowlist appropriate for OneBot identifiers. - Restrict endpoints to the explicitly supported private-message and group-message paths. - Validate host and port values against trusted configuration or a strict allowlist. - Validate CQ parameters, URL schemes, and local file paths before use. - Add tests covering single quotes, command substitutions, newlines, shell metacharacters, and malformed CQ content.

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:36
Finding
Hardcoded Bearer Credential Embedded in Skill Instructions## Vulnerability Details **File Location**: `SKILL.md`, line 36 **Vulnerability Type**: Hardcoded authentication credential **Risk Level**: High ### Vulnerable Code ```sh curl -X POST http://{host}:{port}/{endpoint} \ -H "Content-Type: application/json" \ -H "Authorization: Bearer jqllxew" \ -d '{"user_id":"123456","message":"你好"}' ``` The identical bearer value is also embedded at lines 51, 61, 76, and 85. ### Technical Analysis The skill uses the fixed value `jqllxew` as an authorization bearer token in every command example. This is inconsistent with the earlier `{token}` placeholder and can cause agents or users to copy and transmit the embedded value as if it were an operational credential. A bearer token grants access based on possession. It does not provide additional protection against a party that reads the skill package, generated commands, logs, terminal history, or process arguments. The audit evidence cannot establish whether this token is currently active, but embedding a concrete credential-like value is an unsafe secret-management practice and creates a direct credential-exposure risk. ### Attack Path 1. An attacker obtains access to the skill file, generated output, command logs, or shell history. 2. The attacker extracts the bearer value `jqllxew`. 3. The attacker identifies a OneBot service configured to accept that token. 4. The attacker submits authenticated OneBot API requests using the exposed value. 5. If the token is valid, the service processes unauthorized messaging operations under the associated bot identity. ### Impact Assessment If the embedded value is operational, an attacker may authenticate to the corresponding OneBot API and send unauthorized private or group messages within the bot account's available scope. This could enable impersonation, spam, social engineering, and disclosure of the credential to further parties. The exact privileges depend on the affected OneBo ...[truncated 35 chars]
Remediation
## Remediation Suggestions - Immediately determine whether `jqllxew` is or was an operational token. - Revoke and rotate the token if it may have been used. - Replace every concrete bearer value in the skill with a clearly non-secret placeholder such as `{token}`. - Retrieve credentials at runtime from an approved secret manager or protected environment variable. - Do not include bearer tokens in generated output, examples, logs, or error messages. - Avoid exposing credentials through command-line process arguments where other local users may inspect them. - Apply least privilege and token rotation to the OneBot service. - Scan repository history and related artifacts for additional copies of the credential.

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:34
Finding
Bearer Credentials and Message Content Transmitted Over Plaintext HTTP## Vulnerability Details **File Location**: `SKILL.md`, lines 34-37 **Vulnerability Type**: Cleartext transmission of sensitive information **Risk Level**: High ### Vulnerable Code ```sh curl -X POST http://{host}:{port}/{endpoint} \ -H "Content-Type: application/json" \ -H "Authorization: Bearer jqllxew" \ -d '{"user_id":"123456","message":"你好"}' ``` All messaging examples use the same `http://` transport. Line 92 also explicitly contemplates accessing a non-local NapCat service: ```text - 当napcat服务ip非本机访问时,通常需要校验请求头`Authorization: Bearer {token}`,需向用户询问,当以127.0.0.1访问时通常无需请求头校验 ``` ### Technical Analysis The examples transmit both bearer authorization data and private or group message content using unencrypted HTTP. HTTP does not provide confidentiality, server authentication, or transport integrity. Although plaintext HTTP may be constrained to a trusted loopback interface in some deployments, the skill also supports non-local service addresses. When used across a network, an intermediary can observe or modify requests. Because bearer authentication depends solely on token possession, an intercepted token can potentially be replayed directly. ### Attack Path 1. The agent connects to a non-loopback OneBot or NapCat service using an `http://` URL. 2. The bearer token and message body travel across the network without transport encryption. 3. A network observer or active intermediary captures or modifies the request. 4. The attacker reads sensitive message content and extracts the bearer token. 5. The attacker replays the token against the service or alters messages in transit. ### Impact Assessment A successful interception can disclose private or group message content, recipient identifiers, and authentication credentials. Token replay may allow unauthorized messaging within the token's permission scope. An active intermediary may also modify recipient or message data, causing the bot to deliver ...[truncated 160 chars]
Remediation
## Remediation Suggestions - Require HTTPS with certificate verification for every non-loopback connection. - Reject remote `http://` endpoints rather than merely warning the user. - Permit plaintext HTTP only for explicitly validated loopback addresses when the deployment model requires it. - Do not treat string forms that resemble loopback addresses as trusted without canonical IP validation. - Configure NapCat or a trusted reverse proxy with TLS and a valid certificate. - Keep authentication enabled even on local deployments unless access is securely isolated. - Store and retrieve the token through protected secret-management mechanisms. - Consider a protected Unix-domain socket for strictly local communication. - Document certificate validation, endpoint allowlisting, and secure token rotation requirements.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (4)

External Transmission

Medium
Category
Data Exfiltration
Content
# Skill: OneBot消息发送

## 依赖
- curl

## 触发时机
- 用户要求发送消息、通知、转告他人
Confidence
89% confidence
Finding
This skill is designed to invoke curl to send data to an HTTP API, which is a real external transmission capability. In context, that behavior is the intended function, but it still creates a genuine security boundary crossing: message contents, recipient IDs, and potentially bearer tokens are exposed to a local or remote service and could be intercepted, logged, or misrouted if configuration is unsafe.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The trigger phrases are broad enough to activate on ordinary requests like 'notify someone' or 'tell someone,' which can cause the agent to prepare and send outbound messages without a narrowly scoped, explicit messaging intent. In a skill that transmits content to a local HTTP API and may include authentication, overbroad activation increases the chance of unintended data disclosure or unauthorized message sending.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill instructs the agent to send message content and recipient identifiers over HTTP to the OneBot service but does not warn the user that this constitutes external transmission beyond the model boundary. Users may disclose sensitive message contents or identifiers without understanding they will be sent to another service, which is especially risky if the service is remote or monitored.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill supports CQ image/file payloads using external URLs or local file paths but does not warn that these values may expose local filesystem locations or cause the receiving service to fetch remote resources. This can leak sensitive path information, unintentionally transmit local files, or facilitate SSRF-like behavior depending on how the OneBot/NapCat backend handles file and URL inputs.

Static analysis

No suspicious patterns detected.