T09 · Insecure Skill Coding Practices
- Location
lark_mcp.py:10- Finding
Hardcoded Feishu Application Credentials Exposed in Source Code and Process Arguments
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This Feishu/Lark skill is broadly purpose-aligned, but it embeds app credentials and requests wide business-account access without adequate safeguards or disclosure.
Review carefully before installing. Do not use this version with real Feishu credentials until the embedded App Secret is removed and rotated, the token file handling is secured, dependency versions are pinned, and destructive or public actions require explicit confirmation.
lark_mcp.py:10Hardcoded Feishu Application Credentials Exposed in Source Code and Process Arguments
lark_mcp.py:13Plaintext Token Storage Without Enforced Restrictive File Permissions
SKILL.md:117Unpinned Global Installation of a Third-Party npm Package
The description substantially overstates the implemented functionality. While the wrapper can call arbitrary lark-mcp tools through a generic call path, the provided code chunk itself only demonstrates a small set of Feishu operations and does not evidence broad built-in support for all listed modules. The primary behavior is a technical API/CLI wrapper, not a full-featured beginner-friendly 'all capabilities' skill with guided flows and comprehensive module coverage. Additionally, the code hardcodes Feishu app credentials and persists user tokens locally, which is an implementation capability/sensitivity not declared in the description.
The skill explicitly centers around access tokens and earlier instructs users to store app_id, app_secret, and user_access_token in a predictable local file path under /workspace. In a multi-tool agent environment, predictable credential locations materially increase the risk of unauthorized credential access, token reuse, and broad compromise of messaging, documents, contacts, approvals, and other enterprise data.
| 凭证 | 有效期 | 获取方式 | 用途 |
|------|-------|---------|------|
| App Token(tenant_access_token)| 2小时,自动续期 | app_id + app_secret 自动换取 | 消息/日历/通讯录/审批/多维表格/云盘 |
| User Access Token | 2小时 | OAuth 用户授权 | 知识库/云文档搜索和读取 |
### 权限申请自查表(按功能)
The file contains hardcoded Feishu app credentials, which are secrets that can be extracted by anyone with access to the code or logs. Because the script actively transmits them to an external CLI for authenticated API access, compromise of the code directly enables unauthorized use of the associated Feishu application and its permissions.
Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.
"""通过 lark-mcp CLI 调飞书官方 MCP 工具(App Token)"""
if arguments is None:
arguments = {}
env = os.environ.copy()
env.pop("npm_config_prefix", None)
cmd = ["lark-mcp", "mcp",
"--app-id", APP_ID, "--app-secret", APP_SECRET,
The script loads a persistent user access token from a local file and uses it for authenticated API actions without any visible protection, encryption, or permission hardening. In the context of a broad Feishu automation skill that can read documents, search content, and send messages, token theft or misuse would provide direct access to user data and actions as that user.
直接调用飞书 Open API
:param method: GET/POST/PUT/DELETE
:param path: API 路径,如 /im/v1/messages
:param token: User Access Token(留空则用文件中的)
:param json_data: POST body dict
:param params: URL query params dict
"""
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
| 凭证类型 | 获取方式 | 有效期 | 用途 |
|---------|---------|--------|------|
| App Token(tenant_access_token)| 自动用 app_id + app_secret换取 | 2小时,自动续期 | 大多数 API |
| User Access Token | OAuth 用户授权流程 | 2小时,可刷新 | 知识库、云文档搜索 |
## 凭证与工具对照
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
## API 错误码
0 - 成功
99991663 - Access Token 无效或过期
99991400 - 参数错误
99991403 - 权限不足
99991140 - 接口调用频率超限
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
## API 错误码
0 - 成功
99991663 - Access Token 无效或过期
99991400 - 参数错误
99991403 - 权限不足
99991140 - 接口调用频率超限
The skill documents broad capabilities that include shell execution, file access, network access, and credential file handling, but it does not declare any explicit tool scope such as allowed-tools or permissions. In an agent environment, this omission increases the chance that the skill can invoke powerful primitives without transparent least-privilege boundaries, enabling unauthorized data access, modification, or transmission.
The trigger phrases are extremely broad, covering common user intents like sending messages, searching documents, and listing groups, without clear activation boundaries or confirmation requirements. In an agent setting, this can cause accidental invocation of sensitive read/write actions, especially for messaging, document access, and directory lookups.
The skill advertises write-capable and privacy-impacting operations such as sending messages, reading documents, accessing contacts, calendars, approvals, and drive content, but it does not provide user-facing warnings or consent guidance. This is dangerous because users or higher-level agents may trigger sensitive enterprise actions without realizing data will be modified or personal/corporate information accessed.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
codecurl -X POST 'https://open.feishu.cn/open-apis/authen/v1/oidc/access_token' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer USER_ACCESS_TOKEN' \
-d '{"grant_type": "authorization_code", "code": "获取的code"}'
The subprocess command explicitly sets "--language", "zh", which imposes a specific language setting. This is a natural-language policy concern because the script does not offer the user any locale choice or explain a justified region-specific requirement.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
cmd = ["lark-mcp", "mcp",
"--app-id", APP_ID, "--app-secret", APP_SECRET,
"--language", "zh", "--mode", "stdio"]
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env)
init = {"jsonrpc":"2.0","id":1,"method":"initialize",
"params":{"protocolVersion":"2024-11-05","capabilities":{},
The feishu_api wrapper performs outbound HTTP requests with an Authorization bearer token and is used for actions such as sending messages, searching documents, and reading document contents. While helper docstrings describe functionality, there is no explicit user-facing warning or confirmation that user content and identifiers may be transmitted to Feishu APIs.
The generic call command exposes arbitrary MCP tool invocation, bypassing the narrower, user-guided interface described by the skill. In this context, that broadens capability to any available Feishu-connected tool operation, increasing the risk of unauthorized data access or side-effecting actions beyond expected user intent.
This markdown file documents safety-relevant actions such as submitting an approval instance and performing approval operations including instance cancellation, but it does not warn users that these actions can change business workflow state or be difficult to undo. For markdown files, omissions of warnings about behaviors affecting user data or system/process integrity should be flagged.
This markdown file documents creating events and lists update/delete CRUD operations, which can affect user data and calendar integrity. The description contains no warning or caution about these state-changing actions, despite SQP-2 requiring user-facing disclosure for behaviors that may affect user data or system state.
This is a markdown file, so SQP-2 applies to omissions in user-facing safety disclosures. The file documents create, update, delete, and import capabilities for cloud documents, but provides no warning that these actions can alter or remove user data.
This markdown file lists file operations including delete alongside move, copy, and rename, but provides no warning that these actions can affect or remove user data. Under the markdown-specific SQP-2 criteria, skill descriptions should disclose behaviors that may impact user data or system integrity.
The documented scope grants the ability to view, comment, edit, and manage all files in cloud storage, which has significant privacy and integrity implications. The markdown does not warn users that enabling this scope allows access to all files, so it lacks the disclosure expected for sensitive data access.
This markdown file documents actions that can send messages, recall messages, manage groups, and upload files, all of which can affect user data, privacy, or communication integrity. The description provides direct invocation examples and capability listings but does not include any warning or disclosure about these potentially impactful behaviors.
This markdown file includes a direct example for writing cell values via sheets_v2_spreadsheets_values_put, which can alter user data in a spreadsheet. The description provides no caution, confirmation note, or warning about overwriting existing content.
The quick-start instructs users to print the contents of ~/.lark_tokens.json directly to the terminal, which can expose app credentials or tokens to shoulder-surfing, terminal logs, shell history capture, or recorded sessions. In a setup guide for a messaging/document platform skill, credential disclosure is especially risky because the same credentials may permit broad API access across chat, docs, drive, calendar, and directory features.
The example authentication request embeds app_secret inline without any warning about secret handling, encouraging users to place secrets directly in command lines where they may be stored in shell history, process listings, CI logs, or shared transcripts. Because this skill is intended for easy copy-paste use by beginners, the likelihood of unsafe secret handling is higher than in expert-only documentation.
Detected: suspicious.exposed_secret_literal