Back to skill

Security audit

Feishu Repair

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly purpose-aligned, but needs Review because it automatically changes OpenClaw/Feishu settings, restarts a service, sends messages broadly, and handles sensitive values through unsafe shell commands.

Install only if you are comfortable with an agent reading OpenClaw Feishu credentials and backups, changing Feishu allowlists, restarting the OpenClaw Gateway, and sending verification messages to every configured Feishu group/user. Prefer a revised version that uses native HTTP/process APIs instead of shell-interpolated curl/openclaw commands and adds dry-run plus explicit confirmation before changes, restarts, or broadcasts.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/diagnose.js:194
Finding

Shell Command Injection Through Feishu User Allowlist Values

Content
View full analysis
/dev/null`, { encoding: 'utf8' } ); ``` ### Technical Analysis The `allowFrom` array originates from `~/.openclaw/openclaw.json` or automatically discovered backup files. Although `JSON.stringify()` produces valid JSON, it does not escape values for safe insertion into a POSIX shell command. The JSON string is placed inside single quotes and passed to `execSync()`, which invokes a shell. An allowlist entry containing a single quote can terminate the quoted argument and introduce shell syntax. For example, a malicious value shaped like `' ; ; #` can cause the shell to execute the inserted command when the repair path calls `fixAllowFrom()`. The issue is reachable when the diagnostic logic identifies an `allowFrom` problem and automatically invokes the repair function. ### Attack Path 1. An attacker or compromised local process gains the ability to modify `~/.openclaw/openclaw.json` or one of the discovered `openclaw.json.bak*` files. 2. The attacker inserts shell metacharacters and a single quote into an `allowFrom` entry. 3. The user invokes `scripts/diagnose.js`. 4. The diagnostic check detects a missing or invalid `allowFrom` configuration. 5. `fixAllowFrom()` serializes the attacker-controlled array and interpolates it into a shell command. 6. `execSync()` passes the constructed string to the shell. 7. The injected command executes with the privileges of the user running the skill. ### Impact Assessment Successful exploitation provides arbitrary command execution as the agent user. The attacker could read or modify files available to that user, access OpenClaw and Feishu credentials, alter agent configuration, send ...[truncated 224 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/diagnose.js:211
Finding

Shell Command Injection Through Feishu Group Allowlist Values

Content
View full analysis
/dev/null`, { encoding: 'utf8' } ); ``` ### Technical Analysis The `groupAllowFrom` values are loaded from the current OpenClaw configuration or backup files and inserted directly into a command string executed by a shell. `JSON.stringify()` is a JSON encoder, not a shell-argument encoder. It does not prevent a single quote in a group identifier from closing the command’s quoted argument. Additional shell operators can therefore be interpreted as commands rather than as part of the configuration value. The vulnerable function is automatically called when the diagnostic process finds a `groupAllowFrom` issue. ### Attack Path 1. An attacker places a crafted group identifier in the current OpenClaw configuration or an eligible backup. 2. The crafted value contains a single quote followed by shell syntax. 3. The repair script is run and detects a group allowlist issue. 4. `fixGroupAllowFrom()` serializes the malicious value. 5. The serialized value is concatenated into the `openclaw config set` shell command. 6. `execSync()` executes the injected shell syntax under the agent user’s account. ### Impact Assessment The vulnerability permits arbitrary user-level command execution. An attacker could compromise local OpenClaw data, extract Feishu application credentials, modify configurations, manipulate files and services accessible to the user, or perform actions through credentials held by the agent. The vulnerability does not directly cross into root privileges, but its practical scope may be substantial if the agent user has access to sensitive services or files. ]]>
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/diagnose.js:256
Finding

Shell Command Injection Through Feishu Application Credentials

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/diagnose.js:285
Finding

Shell Command Injection Through Feishu Message Target Identifiers

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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

The documented purpose is framed as repair and diagnosis, but the behavior includes materially broader and more sensitive actions: reading local configs and backups for credentials, restarting a live system service, calling external Feishu APIs, and broadcasting messages to all chats and users. That mismatch undermines informed consent and can lead operators to authorize disruptive actions and credential handling they did not expect.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill describes behavior that clearly requires shell and environment access, including service management and local configuration inspection, but it does not declare any explicit tool scope or permission boundary. This makes the privilege expectations opaque and can cause the skill to run with broader access than users realize, increasing the risk of unintended system modification or secret exposure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill states that it will automatically restore configuration, force-restart the gateway, and send verification messages to every group chat and user, but it does not provide adequate warnings about operational impact, downtime, or unintended mass messaging. In a production messaging environment, these actions can disrupt service, create noisy or embarrassing broadcasts, and affect many recipients at once.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

该技能的 stated purpose 聚焦于飞书群聊/会话诊断和权限配置修复,但代码使用 systemctl 检查并重启用户级服务,获得了对本地服务生命周期的控制能力。虽然部分场景可用于修复,但这种能力本身比“飞书修复”目标更广,且 manifest 未明确披露此类主机级运维控制。

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script automatically restarts the openclaw-gateway service as part of repair flow. A restart is an operationally disruptive action that can interrupt service, affect active sessions, and produce denial-of-service conditions if triggered at the wrong time or repeatedly. For a tool described as diagnosis/repair, this is still risky because it performs state-changing service control without explicit approval at execution time.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script uses stored app credentials to obtain a Feishu tenant token and then sends external API requests and messages without a clear upfront warning or consent. This can expose sensitive operational behavior over the network, create unauthorized outbound communications, and risks credential misuse if command construction or logs are mishandled. Because the skill is expected to run locally with access to secrets, automatic external transmission is especially sensitive.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
94% confidence
Finding

This code transmits app_id and app_secret to Feishu's token endpoint by constructing a shell command containing the secret values. Even though the destination is the expected service, embedding secrets in a command string increases exposure through process listings, shell history/debugging, crash logs, or accidental error output. In a local agent skill with filesystem access to backups, this materially raises secret-handling risk.

Content

Scanner excerpt · scripts/diagnose.js (reported line 257)May include surrounding context.

js
function getTenantAccessToken(appId, appSecret) {
  try {
    const output = execSync(
      `curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
        -H "Content-Type: application/json" \
        -d '{"app_id":"${appId}","app_secret":"${appSecret}"}'`,
      { encoding: 'utf8', timeout: 10000 }

External Transmission

Medium
Category
Data Exfiltration
Confidence
93% confidence
Finding

This code sends outbound Feishu messages using a bearer token and target identifiers, causing external transmission to configured recipients. In context, the transmission is intentional, but it is still a true security-relevant behavior because it can contact all configured users/groups automatically and may leak operational timing or trigger business actions without consent. The risk is amplified by using shell-interpolated command strings for network operations.

Content

Scanner excerpt · scripts/diagnose.js (reported line 286)May include surrounding context.

js
const content = JSON.stringify({ text: text.replace('{time}', now) });
    
    const output = execSync(
      `curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=${receiveIdType}" \
        -H "Authorization: Bearer ${token}" \
        -H "Content-Type: application/json" \
        -d '{"receive_id":"${targetId}","msg_type":"text","content":${JSON.stringify(content)}}'`,

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script automatically sends verification messages to every configured Feishu group and user after a repair. That is an externally visible side effect beyond passive diagnosis, and it can disclose operational activity, spam chats, or trigger unintended workflows without explicit operator approval. In a diagnostic skill, automatic outbound messaging materially increases risk because it affects third-party recipients and uses stored credentials.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The main flow performs automatic configuration changes and may restart the gateway whenever certain issues are detected, without an upfront confirmation step. This creates a risk of unintended state changes, downtime, and difficult-to-audit modifications, especially if backup-derived values are stale or incorrect. In an agent skill context, silent auto-remediation is more dangerous because users may expect diagnosis, not mutation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest description is written entirely in Chinese and presents the skill's behavior in a single fixed language, with no indication that users can opt into another language or locale. Under the stated policy, fixed language behavior without user choice or documented regional justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The natural-language metadata and invocation keyword are presented only in Chinese, with no indication that users may choose another language or locale. Under the stated policy, forcing a specific language without opt-in can be a locale-policy violation unless clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code hard-codes zh-CN locale and Asia/Shanghai timezone for generated timestamps, and later uses zh-CN again for report output formatting. This imposes a specific language/locale behavior without opt-in, which matches the policy category for locale constraints.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

User-facing console output and formatting are written in Chinese with no mechanism to choose another language. This is a natural-language policy concern because the script enforces a specific language rather than offering a language choice or documenting a necessary regional restriction.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/diagnose.js:92