Back to skill

Security audit

飞书文档权限自动添加

Security checks for vulnerabilities and agentic risk

Overview

The skill is coherent for Feishu document permission automation, but it handles app secrets and full document-control grants in ways users should review carefully before installing.

Review before installing. Do not paste a real Feishu App Secret into chat; prefer preconfiguring it through a secure secret mechanism and restrict local config file permissions if file storage is unavoidable. Before any permission change, confirm the exact document, recipient open_id, and permission level, and use view or edit unless full_access is truly needed. Rotate the App Secret if it has already been exposed in chat or logs.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:196
Finding
Shell Command Injection Through Unvalidated User-Controlled Values<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:196-254` **Vulnerability Type**: Shell command injection in instruction-defined `exec` operations **Risk Level**: High ### Vulnerable Code ```bash curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \ -H "Content-Type: application/json" \ -d "{ \"app_id\": \"$APP_ID\", \"app_secret\": \"$APP_SECRET\" }" ``` ```bash curl -s -X POST "https://open.feishu.cn/open-apis/drive/v1/permissions/{FILE_TOKEN}/members/batch_create?type={DOC_TYPE}" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer {tenant_access_token}" \ -d "{ \"members\": [{ \"member_type\": \"openid\", \"member_id\": \"$OWNER_OPEN_ID\", \"perm\": \"full_access\" }] }" ``` The associated parsing instructions state that the document token is extracted from a document URL supplied by the user. The only documented processing is to select the final path segment and remove query-string or fragment suffixes. The Open ID validation described elsewhere only verifies that the value starts with `ou_`. ### Technical Analysis Although the repository contains instructions rather than an executable script, those instructions direct the Agent to construct shell commands and execute them through `exec`. Values originating from configuration, conversation context, or a user-supplied URL are interpolated into double-quoted shell strings without strict validation or shell-safe argument handling. Double quotes do not suppress command substitution such as `$(command)` or backtick substitution. A value that passes the weak `ou_` prefix check, such as one containing `ou_$(...)`, can therefore cause the shell to execute the embedded command. A crafted document token can create the same condition when inserted into the quoted URL. The implementation does not specify an anchored allowlist for document tokens, Open IDs, document types, application IDs, or secrets. ...[truncated 1428 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace shell-based `curl` execution with a structured HTTP client or trusted HTTP tool that accepts URL, headers, and JSON bodies as separate typed parameters. 2. If process execution is unavoidable, invoke the executable with an argument array and explicitly disable shell interpretation. 3. Apply anchored allowlists before using any value: - Open ID: `^ou_[A-Za-z0-9_-]+$` - File token: `^[A-Za-z0-9_-]+$` - App ID: `^cli_[A-Za-z0-9_-]+$` - Document type: accept only `bitable`, `docx`, `doc`, `sheet`, `folder`, `file`, or `wiki`. 4. Parse user URLs with a standards-compliant URL parser. Require HTTPS and validate the hostname against explicitly trusted Feishu domains before extracting a token. 5. Construct request bodies with a JSON serializer rather than string interpolation. 6. Reject control characters, quotes, whitespace, shell substitutions, and encoded forms that decode to disallowed characters. 7. Run the Agent with least operating-system privilege and prevent it from reading unrelated secrets where possible. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:489
Finding
Application Secret Is Collected Through the Conversation and Stored in Plaintext Configuration<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:489-505` **Vulnerability Type**: Insecure credential collection and storage guidance **Risk Level**: Medium ### Vulnerable Code ```text 📱 获取飞书应用凭证: 1. 打开浏览器,访问:https://open.feishu.cn/app 2. 登录你的飞书账号 3. 点击「创建企业自建应用」或选择已有应用 4. 在左侧菜单找到「凭证与基础信息」 5. 复制以下内容: - App ID(cli_ 开头的字符串) - App Secret(点击「查看」后显示) 请把 App ID 和 App Secret 发给我,格式如下: appId: cli_xxxxxxxx appSecret: xxxxxxxx ``` The Skill subsequently instructs the Agent to save configuration in `~/.openclaw/openclaw.json`. The documented configuration includes the secret directly: ```json { "channels": { "feishu": { "enabled": true, "appId": "cli_xxxxxxxx", "appSecret": "xxxxxxxx", "ownerOpenId": "ou_xxx" } } } ``` ### Technical Analysis The setup workflow explicitly asks the user to send a long-lived application secret through the conversational interface. This causes the unmasked secret to enter the Agent context and potentially conversation history, telemetry, debugging output, backups, or service logs. The later output-masking guidance does not protect the original user message containing the complete secret. Storing the same secret directly in a JSON configuration file further exposes it to processes and users that can read that file. The instructions do not require restrictive file permissions, encryption, an operating-system keychain, or a dedicated secret manager. ### Attack Path 1. A user follows the setup instructions and sends the Feishu App ID and complete App Secret in a chat message. 2. The secret becomes part of the conversation record and Agent processing context. 3. The Agent writes the secret into `~/.openclaw/openclaw.json`. 4. An actor with access to chat logs, telemetry, backups, the Agent context, or the local configuration file obtains the credential. 5. The actor submits the stolen App ID and App Secret to Feishu's tenant-token endpoint. 6. The resulting token can be used to ca ...[truncated 592 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Never request application secrets through conversational messages. 2. Provide a local, non-chat setup command that reads the secret without echoing it, or integrate with a dedicated secret-management facility. 3. Store the secret in an operating-system keychain, encrypted credential store, or deployment secret manager. 4. If file storage is unavoidable, separate the secret from general configuration and enforce owner-only permissions such as mode `0600`. 5. Ensure logs, traces, error messages, and telemetry redact secrets before persistence. 6. Document credential rotation and require users who previously submitted secrets through chat to rotate them. 7. Use narrowly scoped application permissions and separate credentials between development and production environments. ]]>

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:244
Finding
Automatic Grant of Full Document-Control Privileges Violates Least Privilege<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:244-267` **Vulnerability Type**: Excessive access grant to a configured or context-derived recipient **Risk Level**: Medium ### Vulnerable Code ```bash curl -s -X POST "https://open.feishu.cn/open-apis/drive/v1/permissions/{FILE_TOKEN}/members/batch_create?type={DOC_TYPE}" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer {tenant_access_token}" \ -d "{ \"members\": [{ \"member_type\": \"openid\", \"member_id\": \"$OWNER_OPEN_ID\", \"perm\": \"full_access\" }] }" ``` The Skill defines the consequences of this permission as follows: ```text full_access | 完整权限 | 可以编辑、管理权限、删除 | 文档所有者(推荐) ``` It also states that `full_access` is the default even though `view` and `edit` permission levels are available. ### Technical Analysis The workflow grants `full_access` automatically. According to the Skill's own documentation, this permits editing, permission management, and deletion. These capabilities exceed what is generally required merely to let a user open or edit a document. The recipient may come from persistent configuration or be extracted from conversation context. The instructions do not require strong binding between that Open ID and the authenticated requester, nor do they require confirmation of the normalized recipient and target document immediately before the privilege-changing API request. Consequently, a stale, incorrect, or attacker-influenced Open ID can receive document-administration capabilities. The default behavior violates least privilege because the narrower `view` and `edit` roles are already supported. ### Attack Path 1. An incorrect, stale, or attacker-influenced Open ID is placed in configuration or selected from conversation context. 2. A user asks the Agent to restore access to a document or supplies a document URL. 3. The Skill resolves the configured or extracted Open ID without a mandatory recipient confirmation. 4. T ...[truncated 828 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Default to `view` for access-only requests and `edit` for collaboration requests. 2. Require explicit, informed confirmation before granting `full_access`. 3. Display the normalized recipient Open ID, document identity, document type, and requested permission before performing the mutation. 4. Bind the recipient to a verified authenticated requester rather than extracting an identity from arbitrary conversational text. 5. Restrict automatic grants to documents created by the current trusted workflow or otherwise verify that the application is authorized to delegate access. 6. Validate the target document and tenant relationship before changing permissions. 7. Add an allowlist or policy layer defining which recipients may receive administrative privileges. 8. Record permission changes in a security audit log without exposing access tokens or application secrets. ]]>
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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (10)

Missing User Warnings

High
Confidence
98% confidence
Finding
The skill tells users to send the App Secret directly in conversation without a strong warning that it is a sensitive credential. Chat channels are commonly logged, retained, and visible to operators or other systems, so requesting secrets there materially increases the chance of credential compromise.

Ssd 3

High
Confidence
98% confidence
Finding
This section combines two risky behaviors: requesting sensitive application credentials in chat and writing them to local configuration. That broadens exposure from transient chat leakage to durable local compromise, enabling unauthorized use of the Feishu app if the endpoint, logs, or config file are accessed.

Credential Access

High
Category
Privilege Escalation
Content
|--------|---------|------|----------|----------|
| `10003` | app id or app secret is invalid | App ID 或 App Secret 错误 | 检查配置,确保复制正确 | 重新配置后重试 |
| `99991661` | 成员已存在 | 用户已有权限 | 视为成功,无需处理 | 直接返回成功 |
| `99991663` | Invalid access token | token 过期或无效 | 重新获取 tenant_access_token | 重新执行 2.2 |
| `99991664` | Permission denied | 应用没有权限 | 引导配置应用权限 | 跳转配置引导 C |
| `99991600` | token not found | 文档 token 不存在 | 检查 file_token 是否正确 | 确认后重试 |
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The README promotes automatically granting Feishu document permissions, including edit or full_access, but does not warn about the security implications of broadening access to newly created documents. In this skill context, the behavior directly changes access control on enterprise documents, so missing warnings and guardrails can lead to unintended privilege grants or data exposure.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The configuration section instructs users to store Feishu app credentials in a local JSON config without any warning that appSecret is sensitive or guidance on secure storage. If that file is exposed through backups, logs, screenshots, or weak filesystem permissions, an attacker could reuse the credentials to obtain Feishu access tokens and operate on documents via the app.

External Transmission

Medium
Category
Data Exfiltration
Content
## ⭐ Star History

[![Star History Chart](https://api.star-history.com/image?repos=sadjjk/openclaw-feishu-docs-perm-auto&type=date&legend=top-left)](https://www.star-history.com/?repos=sadjjk%2Fopenclaw-feishu-docs-perm-auto&type=date&legend=top-left)
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
feishu_app_scopes()

# 获取 tenant_access_token
exec('curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" ...')

# 添加权限
exec('curl -s -X POST "https://open.feishu.cn/open-apis/drive/v1/permissions/..." ...')
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
**请求**:

```bash
curl -s -X POST "https://open.feishu.cn/open-apis/drive/v1/permissions/{FILE_TOKEN}/members/batch_create?type={DOC_TYPE}" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer {tenant_access_token}" \
  -d "{
Confidence
60% 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
84% confidence
Finding
The skill recommends asking whether to write ownerOpenId into configuration, which persists an identifier tied to a user account. While less sensitive than an app secret, storing personal identifiers without clear notice, purpose limitation, or retention guidance creates privacy and unnecessary data persistence risks.

Context-Inappropriate Capability

Medium
Confidence
97% confidence
Finding
The skill explicitly instructs the agent to ask the user to paste Feishu App ID and App Secret into chat, then validate and persist them in a local config file. Collecting and storing long-lived application credentials is more sensitive than the stated task of adding document permissions, and creates unnecessary secret exposure through chat transcripts and filesystem persistence.

Static analysis

No suspicious patterns detected.