Back to skill

Security audit

Kim Msg Skill

Security checks for vulnerabilities and agentic risk

Overview

This skill appears intended to send Kim messages, but it handles messaging credentials in ways users should review before installation.

Install only if you are comfortable with this skill sending your message text to Kim and using Kim credentials from KIM_* environment variables or the documented local credential files. Prefer tightly scoped Kim credentials, protect those files, avoid putting highly sensitive content in messages, and be aware that tokens/secrets may appear in URL logs or local process arguments during sending.

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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/message.js:90
Finding
Kim application secret transmitted in a URL query string## Vulnerability Details **File Location**: `scripts/message.js:90-93` **Vulnerability Type**: Sensitive information in URL query strings (CWE-598) **Risk Level**: Medium **Vulnerable Code**: ```javascript async function getAccessToken(appKey, secretKey) { const params = new URLSearchParams({ appKey, secretKey }); const url = `${BASE_URL}/token/get?${params}`; const raw = await httpsGet(url); ``` ### Technical Analysis The application key and secret key are encoded directly into the token endpoint URL. TLS protects the request while it is in transit, but it does not prevent the complete URL from being recorded by the destination server, reverse proxies, API gateways, network-observability systems, or error-reporting infrastructure. Query parameters are commonly included in access logs and tracing metadata. Consequently, a system that legitimately records request URLs may inadvertently retain the Kim secret key. This creates an additional credential disclosure surface beyond the local credential files and environment variables. ### Attack Path 1. A legitimate user invokes `scripts/message.js` or `scripts/send.sh`. 2. The script constructs a request URL containing both `appKey` and `secretKey`. 3. A gateway, reverse proxy, application server, tracing system, or monitoring platform records the request URL. 4. An attacker or unauthorized operator obtains read access to those logs or traces. 5. The attacker extracts the application credentials from the `appKey` and `secretKey` query parameters. 6. The attacker requests an access token from the Kim token endpoint and uses the resulting authorization within the permissions assigned to the compromised Kim application. ### Impact Assessment Successful exploitation discloses the Kim application credentials. An attacker may authenticate as the configured application and exercise its authorized Kim API capabilities, including sending messages to users within the appl ...[truncated 267 chars]
Remediation
## Remediation Suggestions - Prefer an API mechanism that places credentials in an authorization header or HTTPS POST body rather than in the URL. - If the Kim API mandates query-string authentication, configure every involved gateway, proxy, server, tracing service, and monitoring system to redact the `appKey` and `secretKey` parameters. - Disable unnecessary URL logging for the token endpoint and restrict access to unavoidable logs according to least privilege. - Set short retention periods for logs that could contain authentication material. - Use narrowly scoped application credentials and rotate the current secret after deploying the hardened implementation. - Ensure errors expose only HTTP status information or sanitized response data and never include the complete token endpoint URL.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/webhook.sh:82
Finding
Webhook token exposed in a URL and process command-line argument## Vulnerability Details **File Location**: `scripts/webhook.sh:82-86` **Vulnerability Type**: Sensitive information in URL query strings and process arguments (CWE-598) **Risk Level**: Medium **Vulnerable Code**: ```bash URL="https://kim-robot.kwaitalk.com/api/robot/send?key=$API_TOKEN" RESPONSE=$(curl -s -X POST "$URL" \ -H "Content-Type: application/json" \ -d "$BODY") ``` ### Technical Analysis The Kim webhook token is embedded in the URL as the `key` query parameter. The expanded URL is then supplied to `curl` as a command-line argument. While HTTPS encrypts network traffic, it does not protect the token from local process inspection or from request-URL logging by remote infrastructure. Depending on operating-system process visibility and host configuration, another local account or monitoring agent may be able to inspect the `curl` command line while the process is running. The URL may also be retained by the destination service, reverse proxies, API gateways, tracing platforms, or diagnostic tooling. ### Attack Path 1. A legitimate user invokes `scripts/webhook.sh`. 2. The script expands `API_TOKEN` into the complete webhook URL. 3. The complete token-bearing URL is passed to the `curl` process. 4. An attacker with sufficient local process-inspection access observes the command line while `curl` is running, or obtains a request URL from infrastructure logs. 5. The attacker extracts the value of the `key` query parameter. 6. The attacker submits requests to the Kim webhook endpoint using the stolen token. 7. Messages are delivered to the Kim destination associated with the compromised webhook. ### Impact Assessment A stolen webhook token allows unauthorized message submission to the associated Kim conversation for as long as the token remains valid. This can support message spoofing, phishing, alert manipulation, spam, or disruption of operational notification channels. The token does not directly p ...[truncated 132 chars]
Remediation
## Remediation Suggestions - Use an authorization header or request body for the webhook token if the Kim API supports either mechanism. - If the API requires the token in the query string, avoid exposing the complete URL in process arguments. Use a client implementation that constructs and submits the request internally rather than passing the expanded token-bearing URL to an external process. - Configure server, proxy, gateway, tracing, and monitoring systems to redact the `key` parameter. - Restrict local process visibility and access to telemetry collected from the host. - Apply least privilege to the webhook destination and rotate the webhook token after remediation. - Establish short log-retention periods and remove historical records containing the token-bearing URL where feasible.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (14)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
主要不匹配点在于功能范围。描述明确声称支持“Webhook(群聊)和消息号(指定用户)两种方式”,而提供的代码仅解析 `-u/--user` 和 `-m/--message` 参数,只实现了基于用户名的 Kim 开放平台消息发送。代码调用的是 `/openapi/v2/message/send` 和 `/openapi/v2/message/batch/send`,两者都是用户消息接口;所谓 batch 也只是把单个用户名包装进 `usernames: [targetUser]`,并非 webhook 或群聊能力。另一方面,描述提到的“内置智能密钥加载和 fallback 机制”与代码相符:代码优先使用环境变量,在失败或缺失时回退到多个本地密钥文件路径。因此这是一个部分匹配但存在重要能力夸大/遗漏实现的情况,应判定为 mismatch。

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
代码行为与描述部分匹配:它确实发送 Kim 消息、使用 Webhook 接口、并具备环境变量优先加本地密钥文件回退的密钥加载机制。但描述宣称还支持“消息号(指定用户)”这一第二种发送方式,而该代码中没有任何对应实现:没有消息号凭据加载、没有指定用户参数、没有面向用户消息发送的 API 调用,只有固定的 webhook 机器人 URL(kim-robot.kwaitalk.com/api/robot/send?key=...)。因此描述夸大了实际能力,属于描述与行为不一致。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
> 💡 **提示:**
> - 脚本内置智能密钥加载,优先使用环境变量,自动 fallback 到密钥文件
> - 密钥文件权限建议设置为 `600`:`chmod 600 ~/.openclaw/.secrets`
> - 触发 fallback 时会输出警告,但不会暴露文件路径

## 📖 使用方法
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
> 💡 **提示:**
> - 脚本内置智能密钥加载,优先使用环境变量,自动 fallback 到密钥文件
> - 密钥文件权限建议设置为 `600`:`chmod 600 ~/.openclaw/.secrets`
> - 触发 fallback 时会输出警告,但不会暴露文件路径

## 📖 使用方法
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Lp3

Medium
Category
MCP Least Privilege
Confidence
82% confidence
Finding
The skill documentation describes executable shell and environment-variable based behavior, but it does not declare any tool scope such as permissions or allowed-tools. In an agent environment, this can cause the skill to run with broader-than-expected shell/env access, increasing the risk of unintended command execution or secret access beyond what users understand from the manifest.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
```

> 💡 **提示:**
> - 密钥文件权限建议设置为 `600`(仅所有者可读写):`chmod 600 ~/.openclaw/.secrets`
> - 触发 fallback 时,脚本会输出警告提示,但不会暴露密钥文件路径
> - 推荐本地开发使用密钥文件,CI/CD 使用环境变量
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The script silently falls back from environment variables to reading secrets from common local files, which can cause the process to use credentials the operator did not intend to authorize for this run. In an agent/skill context, that broadens secret access beyond explicit inputs and can lead to unintended credential use, cross-context secret exposure, or sending messages under the wrong account without clear user consent.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The script reads application credentials from local secret files and later exports them into environment variables for a child process. While the code handles missing credentials gracefully, it does not include any user-facing disclosure or warning that sensitive secrets will be read from disk and injected into the process environment.

External Transmission

Medium
Category
Data Exfiltration
Content
# 发送请求
URL="https://kim-robot.kwaitalk.com/api/robot/send?key=$API_TOKEN"
RESPONSE=$(curl -s -X POST "$URL" \
  -H "Content-Type: application/json" \
  -d "$BODY")
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
87% confidence
Finding
This shell script sends the provided message content to an external webhook endpoint via curl. While the script's purpose is to send webhook messages, the file does not include a clear user-facing warning that the supplied content will be transmitted to a remote service, which is relevant when message content may contain sensitive data.

Natural-Language Policy Violations

Low
Confidence
98% confidence
Finding
The script's help text, logs, and error guidance are written entirely in Chinese, effectively imposing a specific language on all users. Under the stated policy, locale-specific behavior should either be opt-in or clearly documented as a justified regional constraint.

Natural-Language Policy Violations

Low
Confidence
84% confidence
Finding
The script's descriptive comments and runtime error/help messages are written in Chinese only, with no indication that another language is available. This can violate a language/locale policy when a skill imposes a single language without user opt-in or documented justification.

Context-Inappropriate Capability

Low
Confidence
80% confidence
Finding
The manifest describes a Kim instant-message sending skill for webhook and message-account delivery, but this file also scans multiple local filesystem paths for secrets and extracts tokens from them. While credential use is expected for sending messages, local file access for secret discovery is an extra capability not explicitly justified by the stated purpose in the manifest.

Missing User Warnings

Low
Confidence
80% confidence
Finding
The script reads a secret token from several local files and environment variables, which is sensitive credential access. Although the comments describe the loading behavior for maintainers, there is no user-facing disclosure in the runtime usage/help output warning that the script will access credential material from disk.

Static analysis

No suspicious patterns detected.