Back to skill

Security audit

飞书开放平台 API

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent for Feishu API automation, but it needs Review because its helper code and examples disable TLS verification while handling Feishu credentials, tokens, uploads, deletions, and permission changes.

Review before installing or using. The Feishu API scope is expected, but the included code should not be used as-is: remove all ssl._create_unverified_context() usage, keep certificate verification enabled, restrict helper calls to trusted Feishu HTTPS endpoints, and require explicit confirmation before batch deletes, file uploads, moves, or collaborator permission changes.

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

Error
Location
scripts/feishu_utils.py:12
Finding
TLS Certificate Verification Disabled for Credential-Bearing Feishu API Requests## Vulnerability Details **File Locations**: - `scripts/feishu_utils.py:12-29` - `SKILL.md:41-60` - `references/oauth.md:41-54` - `references/drive.md:126-127` **Vulnerability Type**: CWE-295 — Improper Certificate Validation **Risk Level**: High ### Vulnerable Code `scripts/feishu_utils.py:12-29`: ```python def get_access_token(app_id, app_secret): url = 'https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal' data = json.dumps({'app_id': app_id, 'app_secret': app_secret}).encode() req = urllib.request.Request(url, data=data, method='POST') req.add_header('Content-Type', 'application/json') ctx = ssl._create_unverified_context() with urllib.request.urlopen(req, context=ctx, timeout=10) as r: resp = json.loads(r.read()) return resp.get('tenant_access_token', '') def call_api(url, method, token, payload=None): ctx = ssl._create_unverified_context() data = json.dumps(payload, ensure_ascii=False).encode() if payload else None req = urllib.request.Request(url, data=data, method=method) req.add_header('Authorization', f'Bearer {token}') req.add_header('Content-Type', 'application/json') with urllib.request.urlopen(req, context=ctx, timeout=30) as r: return json.loads(r.read()) ``` `SKILL.md:41-60`: ```python def get_app_access_token(app_id, app_secret): url = 'https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal' data = json.dumps({'app_id': app_id, 'app_secret': app_secret}).encode() req = urllib.request.Request(url, data=data, method='POST') req.add_header('Content-Type', 'application/json') ctx = ssl._create_unverified_context() with urllib.request.urlopen(req, context=ctx, timeout=10) as r: return json.loads(r.read()).get('tenant_access_token') def call_feishu_api(url, method, token, payload=None): ctx = ssl._create_unverified_context() da ...[truncated 4573 chars]
Remediation
## Remediation Suggestions 1. Remove every use of `ssl._create_unverified_context()` from executable code and documentation. 2. Use Python's default verified TLS behavior: ```python with urllib.request.urlopen(req, timeout=10) as response: result = json.loads(response.read()) ``` 3. If an explicit context is required, create a verified default context: ```python ctx = ssl.create_default_context() with urllib.request.urlopen(req, context=ctx, timeout=10) as response: result = json.loads(response.read()) ``` 4. Do not add a production configuration option that permits certificate verification to be disabled. 5. Restrict API URLs to the expected HTTPS origin, such as `https://open.feishu.cn`, before attaching bearer tokens. This is particularly important for the generic `call_api` function, which accepts a caller-supplied URL. 6. Validate API responses and fail closed on TLS, HTTP, JSON, and Feishu API errors. 7. Update every example in `SKILL.md`, `references/oauth.md`, and `references/drive.md` so users do not copy insecure TLS handling into production code. 8. Rotate the Feishu application secret and revoke active access and refresh tokens if the affected code has been used over an untrusted or intercepted network. 9. Review application scopes and retain only those required for the intended operation, especially Drive write access, permission administration, and Bitable deletion.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (15)

Tool Parameter Abuse

High
Category
Tool Misuse
Content
### 移除协作者

```
DELETE /drive/v1/permissions/{file_token}/members?type={type}&member_id={member_id}&member_type={member_type}
```

### 列出协作者
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Intent-Code Divergence

High
Confidence
99% confidence
Finding
The example code explicitly creates an unverified SSL context and uses it for the OAuth token exchange, disabling TLS certificate validation. In an OAuth flow this can enable man-in-the-middle interception or spoofing of the token endpoint, exposing authorization codes, app credentials, access tokens, and refresh tokens; this is especially dangerous because the document is teaching a security-sensitive authentication pattern and elsewhere claims HTTPS as a requirement.

Missing User Warnings

High
Confidence
99% confidence
Finding
This finding is substantively the same issue as SDI-4: the sample token exchange disables TLS certificate verification with no warning to readers. Because this skill is about Feishu API and OAuth user authorization, developers are likely to copy this snippet directly into real integrations, making credential and token theft via MITM materially plausible.

Missing User Warnings

High
Confidence
99% confidence
Finding
TLS certificate verification is explicitly disabled via ssl._create_unverified_context() when requesting the Feishu tenant access token. This allows a machine-in-the-middle attacker to intercept or spoof the Feishu API endpoint, steal app credentials and access tokens, and tamper with API responses; in this skill context, that can lead to unauthorized batch writes, deletions, and permission changes in Feishu resources.

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill clearly includes code and guidance for outbound network access to Feishu APIs, but it does not declare any explicit tool scope or permissions boundary. In an agent environment, missing scope declarations weakens least-privilege controls and can allow network-capable behavior to be invoked without transparent governance or review.

Intent-Code Divergence

Medium
Confidence
99% confidence
Finding
The sample code disables TLS certificate validation with ssl._create_unverified_context() while sending app credentials and bearer tokens to remote endpoints. This enables man-in-the-middle interception or tampering of authentication traffic, directly undermining the skill's data safety guidance and exposing tokens, secrets, and API responses.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The skill provides ready-to-use examples for bulk deletion and permission modification but gives no instruction to require explicit user confirmation, preview affected objects, or verify authorization before execution. In an agentic context, this increases the risk of accidental destructive actions or abusive privilege changes being carried out at scale.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
This markdown file describes a batch-delete records operation, including the exact endpoint and payload, but provides no warning that the action removes data and may be irreversible. Under the markdown-specific warning criterion, destructive behavior that can affect user data should be accompanied by an explicit caution.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
This file describes adding/removing collaborators, moving files, copying files, and uploading local files to a remote Drive service, all of which can affect access control, data location, or data disclosure. The markdown presents these operations as raw API usage examples but does not include any warning about permission changes, accidental data exposure, or confirming the target file/folder before execution.

Intent-Code Divergence

Medium
Confidence
98% confidence
Finding
The upload example explicitly disables TLS certificate verification via ssl._create_unverified_context(), which allows man-in-the-middle interception or modification of OAuth bearer tokens and uploaded file contents. In a skill intended to interact with Feishu Drive, this is especially dangerous because it normalizes insecure transport for authentication and document upload operations.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The top-level docstring at L02 states '批量写入飞书多维表格记录', which conveys a narrow purpose of batch-writing records. However, the module implements `batch_delete_records` and `add_permission`, which perform destructive deletion and permission changes beyond batch writing.

Missing User Warnings

Medium
Confidence
86% confidence
Finding
The function accesses appId and appSecret from /root/.openclaw/openclaw.json, which is credential material. While there is a short internal docstring, there is no visible user-facing warning, prompt, or broader description informing users that secrets will be loaded from a root-scoped config file.

Description-Behavior Mismatch

Medium
Confidence
91% confidence
Finding
The skill context includes Feishu API operations broadly, but this file's own documentation presents it as a utility for batch writing records. In practice, the code also exposes batch deletion of Bitable records and Drive permission assignment, which are materially different operations from writing records.

Intent-Code Divergence

Low
Confidence
88% confidence
Finding
L022 将“不得硬编码 app_id、app_secret、access_token”作为重要准则,但 L030 的示例直接硬编码了凭据文件绝对路径 `/root/.openclaw/openclaw.json`。这不等同于硬编码密钥本身,但与文档宣称应从配置或环境灵活读取的意图存在明显偏离。

Natural-Language Policy Violations

Low
Confidence
84% confidence
Finding
The entire skill reference is written in Chinese and does not indicate that language selection is optional or that the document is intended only for a Chinese-language or region-specific audience. Under the stated policy, forcing a specific language without user opt-in can be a natural-language policy violation.

Static analysis

No suspicious patterns detected.