Back to skill

Security audit

飞书群学习分析

Security checks for vulnerabilities and agentic risk

Overview

This skill is meant to analyze Feishu group messages, but it embeds reusable Feishu credentials, ignores the documented chat configuration, and reads fixed private group IDs.

Review this carefully before installing. Do not run it with real Feishu access unless the app secret has been rotated, credentials are supplied through a secure user-controlled mechanism, monitored chats are explicitly configured and authorized, and local retention of raw messages or summaries is understood and acceptable.

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

T09 · Insecure Skill Coding Practices

Error
Location
group_learning.py:6
Finding
Hardcoded Feishu Application Credentials## Vulnerability Details **File Locations**: - `group_learning.py:6-7` - `group_learning.py:15-18` - `analyze.sh:3-5` **Vulnerability Type**: Hardcoded reusable credentials **Risk Level**: High ### Vulnerable Code `group_learning.py:6-7`: ```python APP_ID = "cli_a92b19fbc278dbd6" APP_SECRET = "WFsYhmcEZnRjL4c1ClotIeHhoq5568Sp" ``` `group_learning.py:15-18`: ```python def get_token(): url = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" resp = requests.post(url, json={"app_id": APP_ID, "app_secret": APP_SECRET}) return resp.json().get("tenant_access_token") ``` `analyze.sh:3-5`: ```bash 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":"cli_a92b19fbc278dbd6","app_secret":"WFsYhmcEZnRjL4c1ClotIeHhoq5568Sp"}' | python3 -c "import sys,json; print(json.load(sys.stdin).get('tenant_access_token',''))") ``` ### Technical Analysis A reusable Feishu application ID and secret are embedded directly in two distributable source files. Anyone who can download the Skill, inspect a deployed copy, access source-control history, or read a backup can recover the credential without executing the Skill. Sending credentials to Feishu's official authentication endpoint is required to obtain a tenant access token. Embedding a fixed secret in the package is not required and violates least-privilege and secret-management principles. The documented configuration mechanism is not used to obtain credentials. The retrieved tenant token is subsequently placed in an authorization header and used to query Feishu messages: ```python headers = {"Authorization": f"Bearer {token}"} ``` The precise authorization scope cannot be determined from the reviewed files because Feishu application permissions are configured externally. Exploitation is therefore limited by the permissions grante ...[truncated 1318 chars]
Remediation
## Remediation Suggestions 1. Revoke and rotate the exposed Feishu application secret immediately. Removing it from the current files is insufficient because copies and source history may retain it. 2. Remove credentials from both `group_learning.py` and `analyze.sh`, including repository history and release artifacts where feasible. 3. Load credentials from environment variables or an OpenClaw-supported secret store: ```python APP_ID = os.environ.get("FEISHU_APP_ID") APP_SECRET = os.environ.get("FEISHU_APP_SECRET") if not APP_ID or not APP_SECRET: raise RuntimeError("Feishu credentials are not configured") ``` 4. Pass secrets to scheduled executions through a protected runtime environment rather than command-line arguments, where they may be exposed through process listings. 5. Restrict secret-file permissions to the account running the Skill, such as mode `0600`. 6. Grant the Feishu application only the minimum message-reading permissions required for explicitly configured groups. Remove unrelated write and administrative scopes. 7. Implement short request timeouts, status checks, and safe error handling without logging credentials or bearer tokens. 8. Add automated secret scanning to development and release workflows.

T09 · Insecure Skill Coding Practices

Warning
Location
analyze.sh:18
Finding
Feishu Group Messages Stored in Predictable Shared Temporary Files## Vulnerability Details **File Location**: `analyze.sh:18-20`, read again at `analyze.sh:25-27` **Vulnerability Type**: Insecure temporary-file handling **Risk Level**: Medium ### Vulnerable Code `analyze.sh:18-20`: ```bash curl -s "https://open.feishu.cn/open-apis/im/v1/messages?container_id=$ID&container_id_type=chat&page_size=50" \ -H "Authorization: Bearer $TOKEN" > /tmp/chat_${ID##*_}.json ``` `analyze.sh:25-27`: ```python with open('/tmp/chat_${ID##*_}.json', 'r') as f: data = json.load(f) ``` ### Technical Analysis The script stores complete Feishu API responses under deterministic names in the globally shared `/tmp` directory. The filenames are derived from chat identifiers that are themselves hardcoded in the package. The script does not use exclusive file creation, set a restrictive `umask`, validate that the destination is a regular file, protect against symbolic links, or delete the files after analysis. Consequently, raw message responses can remain on disk after execution. Under a common default `umask` of `022`, newly created files may be readable by other local users. Pre-creating a symbolic link at the predictable path can also cause shell redirection to target another file writable by the Skill's operating-system account. Modern operating-system protections may block some cross-user symbolic-link attacks in sticky directories, but the code does not enforce or verify those protections and remains unsafe on systems where they are absent or disabled. Persisting the raw API response is not necessary for the declared keyword-analysis functionality; the response can be streamed directly to the parser or stored in a securely created private temporary file. ### Attack Path **Confidentiality path:** 1. A local attacker identifies the deterministic filename from the published chat ID. 2. The user executes `analyze.sh`. 3. The script writes the complete API response to the pred ...[truncated 1162 chars]
Remediation
## Remediation Suggestions Prefer avoiding disk persistence entirely by streaming the API response to the Python analyzer. If a temporary file is necessary: 1. Apply a restrictive creation mask. 2. Create a unique file atomically with `mktemp`. 3. Verify successful creation and command execution. 4. Register cleanup before writing sensitive data. 5. Quote every path expansion. Example: ```bash umask 077 tmp_file=$(mktemp "${TMPDIR:-/tmp}/feishu-chat.XXXXXX") || exit 1 trap 'rm -f -- "$tmp_file"' EXIT HUP INT TERM curl --fail --silent --show-error \ -H "Authorization: Bearer $TOKEN" \ "$url" > "$tmp_file" || exit 1 python3 analyzer.py "$tmp_file" ``` Additionally, use an application-private runtime directory with mode `0700` where available, minimize the response fields requested from Feishu, and ensure raw chat content is never retained longer than required.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (22)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The second mismatch describes undeclared Feishu API access, hardcoded credentials, and fixed chat IDs while overstating features like scheduling, recommendations, and multi-group support. This is dangerous because it combines privacy-invasive access with deceptive documentation, increasing the chance that users deploy the skill without realizing it reads specific groups or embeds reusable secrets.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The second mismatch describes undeclared Feishu API access, hardcoded credentials, and fixed chat IDs while overstating features like scheduling, recommendations, and multi-group support. This is dangerous because it combines privacy-invasive access with deceptive documentation, increasing the chance that users deploy the skill without realizing it reads specific groups or embeds reusable secrets.

External Script Fetching

High
Category
Supply Chain
Content
#!/bin/bash

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":"cli_a92b19fbc278dbd6","app_secret":"WFsYhmcEZnRjL4c1ClotIeHhoq5568Sp"}' | python3 -c "import sys,json; print(json.load(sys.stdin).get('tenant_access_token',''))")
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The README explicitly describes automatic monitoring and analysis of Feishu group messages, but it provides no notice about consent, privacy expectations, retention, or handling of potentially sensitive chat content. In a messaging-monitoring skill, omission of these safeguards can lead to unauthorized collection or processing of personal or confidential data, increasing privacy and compliance risk.

Lp3

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding
The skill documentation declares no explicit tool scope or permissions while the referenced behavior requires sensitive capabilities such as shell execution, file access, and network access. In an agent ecosystem, missing scope declarations undermine informed consent and policy enforcement, making it easier for the skill to access data or external services beyond what a user expects.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
A skill that monitors and analyzes group messages processes potentially sensitive communications, so failing to warn users materially increases the risk of non-consensual surveillance or policy violations. In this context, the absence of disclosure is more dangerous because the skill targets chat groups and runs on a schedule, which can normalize continuous collection of private discussions.

External Transmission

Medium
Category
Data Exfiltration
Content
#!/bin/bash

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":"cli_a92b19fbc278dbd6","app_secret":"WFsYhmcEZnRjL4c1ClotIeHhoq5568Sp"}' | python3 -c "import sys,json; print(json.load(sys.stdin).get('tenant_access_token',''))")
Confidence
88% confidence
Finding
This script transmits authentication data to an external service and then uses the resulting token to access remote chat content. In this skill context, external transmission is materially sensitive because it involves private group-message analysis and embedded credentials, so misuse or interception could expose organizational conversations and API access.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The script uses embedded Feishu application credentials to obtain an access token for external API access without any disclosure or consent flow. Hard-coded secrets in a distributed skill are especially dangerous because anyone with the file can extract and abuse them to access Feishu resources or impersonate the application.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The script retrieves potentially sensitive chat data from Feishu and writes raw API responses into /tmp, a shared temporary location that may be readable by other local users or processes depending on system configuration. In the context of a group-message analysis skill, this increases confidentiality risk because private conversations are being stored on disk without notice, minimization, or secure file handling.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The manifest describes automatic analysis of group messages to extract learning points and generate evolution suggestions. In code, the analysis is limited to matching predefined keywords and printing coarse labels; there is no logic that produces concrete learning points or any '进化建议' recommendations.

Intent-Code Divergence

Medium
Confidence
98% confidence
Finding
The final status line explicitly tells the operator that the report was saved to a memory system. However, the script only prints to stdout and writes temporary fetched message JSON files; there is no code that stores the generated report in any memory or persistence layer.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The file contains hardcoded Feishu APP_ID and APP_SECRET, allowing anyone with source access to reuse the credentials to obtain access tokens against the Feishu tenant API. This can enable unauthorized access to tenant-scoped resources and is especially dangerous because the skill is explicitly designed to monitor multiple group chats containing private communications.

External Transmission

Medium
Category
Data Exfiltration
Content
def get_token():
    url = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal"
    resp = requests.post(url, json={"app_id": APP_ID, "app_secret": APP_SECRET})
    return resp.json().get("tenant_access_token")

def extract_text(content):
Confidence
90% confidence
Finding
This line performs an external network request containing authentication secrets to Feishu. External transmission is expected for this integration, but it is still security-relevant because it sends sensitive credentials over the network and, combined with hardcoded secrets, increases the blast radius if the code is exposed or execution is redirected through an untrusted environment.

Description-Behavior Mismatch

Medium
Confidence
94% confidence
Finding
The manifest says the skill extracts keywords and generates learning/evolution suggestions. In code, `analyze_messages` only checks whether hardcoded keywords appear in concatenated message text and appends matching labels to `insights`; `recommendations` is initialized but never populated or used. This is a semantic mismatch between the claimed analysis capability and the implemented behavior.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The script stores analyzed chat summaries in a predictable local memory path without warning users about retention. Even though it stores summaries rather than raw messages, the saved insights can still reveal sensitive group activity, interests, or operational issues to other local users or later processes.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The package description is written as a Chinese-only skill behavior statement: "自动分析飞书群消息,提取学习点和进化建议." This indicates a language/locale constraint without any indication that users can choose another language or that the restriction is explicitly justified as region-specific.

Natural-Language Policy Violations

Low
Confidence
89% confidence
Finding
The natural-language instructions and usage documentation are entirely in Chinese, which can amount to forcing a specific language without offering the user an alternative or opt-in. The file does not indicate that the skill is intentionally region-specific or provide any language-selection guidance.

Natural-Language Policy Violations

Low
Confidence
77% confidence
Finding
The natural-language description and usage guidance are presented in Chinese only, with no indication that the skill is intended exclusively for Chinese-speaking users or any option for another language. This can violate a language/locale policy when a skill implicitly forces one language without user opt-in or justification.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
Multiple echo and print statements present all user-facing output in Chinese only. This imposes a fixed language/locale on users without any visible option to select another language or indication that the skill is region-specific.

Description-Behavior Mismatch

Low
Confidence
87% confidence
Finding
The manifest advertises multi-group monitoring as a supported capability, which implies a configurable or general mechanism. The code instead embeds exactly two fixed group IDs and names, so the behavior is narrower than the description suggests.

Natural-Language Policy Violations

Low
Confidence
88% confidence
Finding
The script's generated report strings and saved entry text are hard-coded in Chinese, which imposes a specific language on users regardless of preference. There is no option to select another language and no documented justification that the skill is intended only for a Chinese-speaking context.

Description-Behavior Mismatch

Low
Confidence
87% confidence
Finding
The skill silently persists derived chat-analysis data to a local memory file, which expands the data lifecycle beyond the stated message analysis function. This creates privacy and retention risk because potentially sensitive group-derived insights are stored on disk without disclosure, retention limits, or access controls.

Static analysis

No suspicious patterns detected.