Back to skill

Security audit

feishu-api-cache-fix

Security checks for vulnerabilities and agentic risk

Overview

The skill appears intended to reduce Feishu API usage, but it asks users to run a root-level script that permanently patches an installed OpenClaw source file with limited safety checks.

Install only if you are comfortable with a third-party script modifying your system-wide OpenClaw installation as root. Review the script first, confirm the target OpenClaw version and path, keep a separate backup, and prefer an official OpenClaw update or versioned patch if available.

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

T09 · Insecure Skill Coding Practices

Warning
Location
fix_feishu_cache.sh:5
Finding
Privileged and Unsafe Replacement of Globally Installed OpenClaw Source Code<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:21` and `fix_feishu_cache.sh:5-9` **Vulnerability Type**: Unsafe privileged file replacement **Risk Level**: Medium The documentation instructs the user to execute the entire bundled script with `sudo`: ```bash # 1.sudo bash fix_feishu_cache.sh ``` The privileged script then backs up and directly overwrites a source file in the global OpenClaw installation: ```bash PROBE_FILE="/usr/local/lib/node_modules/openclaw/extensions/feishu/src/probe.ts" # 备份原文件 cp "$PROBE_FILE" "${PROBE_FILE}.bak" # 创建带缓存的版本 cat > "$PROBE_FILE" << 'EOF' ``` ### Technical Analysis Executing the complete script with `sudo` grants every command in the script unrestricted root privileges, although the legitimate task only requires narrowly scoped permission to update one installed file. The replacement operation is not implemented defensively: - The script does not use `set -euo pipefail`, so it may continue after a failed backup. - It does not verify that the target exists, is a regular file, and is not a symbolic link. - It does not check whether the installed OpenClaw version is compatible with the replacement source. - It overwrites any existing `.bak` file, potentially destroying the last usable backup. - It writes directly to the destination rather than validating a temporary file and atomically installing it. - It does not validate the resulting TypeScript file before reporting success. - It asks the user to trust and run the entire package script as root rather than applying only the necessary operation with elevated privileges. No evidence was found that the current script intentionally executes an external payload, exfiltrates information, establishes persistence, or contains hidden malicious behavior. The vulnerability arises from excessive privilege and unsafe file replacement practices. ### Attack Path 1. A user follows the instruction in `SKILL.md:21` and runs the bundled shell script with `sudo`. 2. ...[truncated 1695 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Enable strict shell failure handling at the beginning of the script: ```bash set -euo pipefail ``` 2. Do not instruct users to execute the entire script with `sudo`. Perform preparation and validation as an unprivileged user, then elevate only the final narrowly scoped installation command. 3. Validate the canonical destination before modification: - Confirm that the expected OpenClaw installation and version are present. - Require the target to be a regular file. - Reject symbolic links and unexpected ownership or permissions. - Resolve and verify the canonical path remains under the intended OpenClaw installation directory. 4. Create a non-clobbering backup with restrictive permissions and a unique timestamp or use `cp --backup=numbered`. Abort immediately if backup creation fails. 5. Write the replacement to a securely created temporary file rather than directly redirecting into the installed file: ```bash temp_file="$(mktemp)" trap 'rm -f "$temp_file"' EXIT ``` 6. Validate the generated source before installation using the applicable TypeScript compiler, formatter, or OpenClaw test command. 7. Install the validated file atomically with appropriate ownership and permissions, for example by using a narrowly scoped privileged `install` or `mv` operation. 8. Verify the installed OpenClaw version or the expected hash/content of the original `probe.ts` before applying the change. Abort on unsupported versions rather than replacing unknown source code. 9. Report success only after backup, validation, installation, and post-installation verification all complete successfully. 10. Prefer distributing a reviewed version-specific patch and applying it through the application's supported extension, update, or package-management mechanism instead of replacing globally installed source code. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (5)

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill instructs users to run a sudo-enabled shell script that modifies the system, but it provides no explanation of what the script changes, no warning about privileged execution, and no guidance to inspect the script before running it. In a skill distribution context, this creates a social-engineering path for arbitrary privileged code execution if the bundled script is malicious, tampered with, or overly broad.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
```bash
 运行修复脚本
# 1.sudo bash fix_feishu_cache.sh

# 2. 重启OpenClaw
# 点击菜单栏OpenClaw图标 → Restart
Confidence
98% confidence
Finding
The markdown explicitly tells the user to run `sudo bash fix_feishu_cache.sh`, which grants the script full root privileges. Because the skill content does not justify the need for elevation or constrain the script's behavior, any unsafe or hidden command in that script would execute with complete system access, making this especially dangerous in a third-party skill package.

Intent-Code Divergence

Medium
Confidence
91% confidence
Finding
The script presents itself as a simple cache-fix helper, but it actually replaces an installed source file under /usr/local/lib/node_modules in place. That mismatch is security-relevant because it causes code tampering in a system-managed package, making review, rollback, and integrity tracking harder than the description suggests.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The script overwrites a file in a global installation path without an explicit warning, review step, or user confirmation. In a skill context, this is more dangerous because it modifies runtime behavior of installed software outside normal package-management controls, which can introduce persistence, break updates, or hide unexpected logic changes.

Missing User Warnings

Low
Confidence
76% confidence
Finding
The generated TypeScript code handles appId and appSecret credentials and performs logic based on their presence, but the shell script does not warn users that it is patching credential-related probe behavior. For safety-sensitive changes involving credential paths, some disclosure is expected so users understand the impact of the patch.