Back to skill

Security audit

飞书@机器人

Security checks for vulnerabilities and agentic risk

Overview

This Feishu bot skill is mostly purpose-aligned, but it tells users to handle app secrets, bearer tokens, chat history, and message sending through broad raw API examples without enough safety scoping.

Install only if you are comfortable with a skill that helps send Feishu group messages and inspect recent group message history for mentions. Use it only with approved chats, least-privilege Feishu app permissions, secure secret storage, and redacted logs; avoid putting real app_secret values or bearer tokens directly into shell commands.

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
SKILL.md:36
Finding
Credentials Exposed Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 36–44 **Vulnerability Type**: Credential exposure through process arguments **Risk Level**: Medium ### Vulnerable Code ```bash # 1. 获取 tenant_access_token TOKEN=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \ -H "Content-Type: application/json" \ -d '{"app_id":"YOUR_APP_ID","app_secret":"YOUR_APP_SECRET"}' | jq -r '.tenant_access_token') # 2. 获取群消息历史,提取 mentions curl -s "https://open.feishu.cn/open-apis/im/v1/messages?container_id_type=chat&container_id=CHAT_ID&page_size=50" \ -H "Authorization: Bearer $TOKEN" | \ jq '[.data.items[]? | select(.mentions != null and .mentions != []) | .mentions[]?] | unique_by(.id)' ``` ### Technical Analysis The documentation instructs users to pass the Feishu application secret directly in a `curl` request-body argument. It also expands the tenant access token into an HTTP-header argument. After shell expansion, both values can become part of the `curl` process argument vector. Depending on operating-system process visibility and security configuration, command-line arguments may be observable by other local users, privileged processes, process-monitoring agents, debugging tools, audit systems, or command wrappers. These values may also be copied into diagnostic logs if shell tracing or verbose command logging is enabled. The placeholders are not hardcoded credentials, but users following the example are expected to replace them with real credentials. The vulnerability therefore occurs when the documented command is used as intended. ### Attack Path 1. A user replaces `YOUR_APP_SECRET` and related placeholders with valid Feishu credentials. 2. The user executes the documented shell commands. 3. The shell places the application secret and expanded bearer token in the `curl` process arguments. 4. A local attacker, privileged monitoring component, or command-logging mechanism captures those arguments ...[truncated 1021 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Do not place application secrets or bearer tokens directly in command-line arguments. - Use a credential-aware Feishu SDK or another client that can receive secrets through protected in-memory configuration. - If `curl` must be used, provide sensitive request data through standard input or a temporary configuration file instead of the argument vector. - Create any temporary credential file with permissions restricted to the current user, such as mode `0600`, and securely remove it immediately after use. - Disable shell tracing before handling credentials and ensure process-monitoring or audit systems redact authorization headers and request bodies. - Store long-lived application secrets in an operating-system secret store or managed secrets service rather than source files, shell history, or project documentation. - Grant the Feishu application only the permissions required for message sending and mention processing. - Rotate the application secret and revoke or invalidate affected tokens if command arguments may already have been logged or observed. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (3)

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The skill instructs operators to obtain a tenant access token using app credentials and query group message history to extract mentions, but it provides no warning about the sensitivity of chat data, tokens, or access control requirements. This can lead users or downstream agents to access private conversation history and handle secrets insecurely, increasing the chance of privacy violations or credential exposure.

External Transmission

Medium
Category
Data Exfiltration
Content
```bash
# 1. 获取 tenant_access_token
TOKEN=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
  -H "Content-Type: application/json" \
  -d '{"app_id":"YOUR_APP_ID","app_secret":"YOUR_APP_SECRET"}' | jq -r '.tenant_access_token')
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
### 使用飞书 API 直接调用

```bash
curl -X POST "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=chat_id" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -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.

Static analysis

No suspicious patterns detected.