Back to skill

Security audit

Feishu Ingest

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its Feishu-to-knowledge-base purpose, but task-controlled inputs can redirect credentials or cause local files to be archived too broadly.

Install only in a controlled environment where payloads and apply contexts are trusted. Before use, bind GITEA_BOT_TOKEN to an administrator-configured Gitea origin, reject payload-selected repository URLs, restrict archived source paths to the prepare workspace, protect Feishu token cache permissions, and use least-privilege Feishu/Gitea credentials.

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
scripts/gitea_api.py:16
Finding

Payload-Controlled Gitea Endpoint Can Exfiltrate the Repository Bot Token

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/kb_writer.py:246
Finding

Untrusted Apply Context Can Cause Arbitrary Local Files to Be Uploaded to Gitea

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/feishu_platform.py:50
Finding

Feishu Tenant Access Token Is Cached in Plaintext Without Enforced File Permissions

Content
View full analysis
now_ts + 60: return token except Exception: pass data = http_json( "POST", f"{FEISHU_API_BASE}/auth/v3/tenant_access_token/internal", body={"app_id": app_id, "app_secret": app_secret}, timeout=30, ) if data.get("code") != 0: raise RuntimeError( f"获取飞书 tenant_access_token 失败:{data.get('msg') or data}" ) token = data.get("tenant_access_token") token_cache.write_text( json.dumps( { "token": token, "expire": now_ts + int(data.get("expire") or 7200), }, ensure_ascii=False, indent=2, ), encoding="utf-8", ) return token ``` ### Technical Analysis The tenant access token is writt ...[truncated 1727 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (25)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared purpose centers on Feishu data collection and ingestion into a research knowledge base. The supplied code chunk is a local utility for catalog management: it loads raw JSON, derives page types from paths, constructs normalized catalog entries, merges page metadata, enforces relation/path constraints, creates reciprocal graph relationships, and renders a markdown index. It does not interact with Feishu APIs, network resources, chat messages, external documents, or ingestion workflows. This is a materially different primary purpose, so the description does not accurately represent the code.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The code chunk does not perform any Feishu polling, message/resource downloading, document/wiki/sheet reading, content evaluation, or prepare/apply ingestion logic described in the skill purpose. Instead, it is a repository client for Gitea that reads and upserts files and updates catalog/index metadata in a KB repo. While writing to a KB could be part of a larger ingestion pipeline, this specific code's primary behavior is direct Gitea repository file management, which is a materially different and undeclared capability relative to the supplied description.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

This code chunk’s behavior does not match the declared end-to-end Feishu collection and KB-ingestion purpose. Instead, it is a generic helper module for extracting text previews from local files. While such a utility could support a larger ingestion pipeline by previewing downloaded attachments, the supplied chunk itself only performs local file parsing and formatting. It lacks any Feishu-specific access, message polling, doc/wiki/sheet/bitable reading through Feishu services, chat-segment evaluation, or prepare/apply ingestion workflow. Therefore this chunk is materially different from the declared primary purpose and should be flagged as a mismatch.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill describes capabilities that rely on environment variables, filesystem access, network calls, and repository writes, but it does not declare any explicit tool scope or permission boundaries. This creates an authorization ambiguity where an agent may invoke the skill without clear consent or least-privilege constraints, which is especially risky because the workflow reads chat history, downloads documents, and writes to a knowledge base.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest description is broad enough to encourage invocation in many contexts without clear trigger conditions, while the skill can scan chat history, download resources, and write to a KB. Overbroad invocation language increases the chance of accidental use on sensitive data sources or use without the user appreciating the privacy and write implications.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The description does not prominently warn that the skill will write generated content into a persistent Gitea knowledge base and archive source materials. In this context, silent persistence is dangerous because users may expect analysis only, while the skill actually performs durable repository mutations that can expose confidential chat-derived data to a broader audience.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
78% confidence
Finding

The operational instructions and content requirements are entirely in Chinese, and the skill does not mention any user language preference, opt-in, or locale limitation. This can amount to an implicit language policy constraint if the skill expects or forces operation in Chinese without user choice.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill is designed to scan Feishu group history and download message resources and documents, but the user-facing description lacks a strong privacy warning about this collection behavior. In a chat-ingestion context, that materially increases risk because it may process sensitive conversations, attachments, and linked documents beyond what a user expects from a generic 'ingest' skill.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest description grants a broadly capable ingestion workflow: polling chats, downloading resources, reading cloud documents, judging retention value, and writing into a KB, but it does not state any activation constraints, scope limits, or approval boundaries. In a skill that has access to Feishu content and a KB write path, vague triggering increases the risk of over-collection or unintended execution on sensitive conversations and documents.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This file uses Chinese-only natural-language messages such as the credential error at L069, and similar Chinese strings appear throughout the file. That imposes a specific language on users without opt-in or any documented justification for a Chinese-only locale.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code stores the Feishu tenant access token in a local JSON cache file under a path that may be shared or broadly readable, without setting restrictive permissions or documenting this persistence. If another local user, process, or skill can read that directory, the token could be reused to access Feishu data until expiry.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The function downloads message resources from Feishu and writes the returned bytes to a filesystem path, which is a safety-relevant file write. The code does not provide any confirmation, user-visible logging, or inline documentation explaining that external content will be saved locally.

Content

No source excerpt is available for this finding.

Tainted flow: 'data' from os.getenv (line 241, credential/environment) → pathlib.Path.write_bytes (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/feishu_platform.py (reported line 196)May include surrounding context.

python
data = api_bytes(payload, "GET", endpoint, query={"type": resource_type})
    target = Path(output_path)
    target.parent.mkdir(parents=True, exist_ok=True)
    target.write_bytes(data)
    return str(target)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

This code persists compiled message segments and referenced Feishu documents to the local work directory using write_text, and also downloads attachments earlier in the flow. There is no confirmation prompt, print/log disclosure, or inline warning to indicate that chat content and linked documents will be stored on disk, which is a privacy-relevant operation involving user data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The reset_work_root function unconditionally removes the resolved task work directory with shutil.rmtree when it exists. Although there is a basic path safety check, the operation is destructive and there is no user-facing notice, confirmation, or comment warning that prior locally stored ingestion artifacts will be deleted.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The manifest describes polling Feishu, reading source materials, judging preservation value, and ingesting into a Research KB through a prepare/apply workflow. This file directly creates or updates files in a Gitea repository, including catalog.json and index.md, which is a concrete repository mutation capability not mentioned in the manifest description of this skill file's behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The upsert_bytes method performs remote file creation or modification via a PUT request to the Gitea contents API, which can change repository state. In this file there is no confirmation prompt, logging/print statement, or explanatory comment/docstring disclosing that repository contents will be written when this method is invoked.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file hardcodes Chinese labels such as 相关概念, 相关资源, 相关代码页, and 相关页面, and later injects a Chinese section heading ## 关联页面 plus Chinese registration text for archived sources. This imposes a specific output language in generated content without offering a language choice or documenting a justified locale constraint.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This function writes generated content to repository paths via client.upsert_text for page files, catalog.json, and index.md, and also archives source files with client.upsert_bytes, but the file contains no confirmation prompt, user-facing log/print, or warning comment/docstring disclosing these side effects. Because these operations modify persisted knowledge-base content and store source artifacts, users may not be explicitly informed that data will be written and archived.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
61% confidence
Finding

The natural-language description is tightly bound to Feishu group messages and Feishu cloud documents, which can reflect a platform- or locale-specific constraint, but the manifest text does not state that this limitation is intentional or user-selected. Under the policy rule, locale or language constraints should be explicitly justified or offered as a choice when relevant.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
74% confidence
Finding

The manifest scope is centered on Feishu collection and KB ingestion workflow, but this file additionally pulls external SCM endpoint and bot credentials from environment variables. While possibly operationally useful, this credential-loading and repository-target discovery capability is not explicitly justified by the stated purpose and broadens the skill's operational reach.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The client reads sensitive configuration including GITEA_BOT_TOKEN from environment variables to authenticate API requests. This file does not include any user-facing warning, comment, or docstring indicating that credentials will be consumed from the environment.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The string literal returned for archive listings begins with Chinese text, which imposes a specific language in user-visible output. The file does not provide any user opt-in, locale selection, or documentation justifying a fixed Chinese locale.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The regexes in slugify, extract_keywords, and query_tokens explicitly support Chinese characters and Latin-alphanumeric tokens while excluding many other scripts, which can amount to an implicit language/locale constraint. There is no nearby natural-language documentation explaining this limitation, offering user choice, or justifying a region-specific scope.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The function creates parent directories and writes JSON content to an arbitrary path, which is a file-modifying operation. In this file there is no confirmation prompt, logging/print statement, or explanatory comment/docstring disclosing that the function will create directories and overwrite file contents.

Content

No source excerpt is available for this finding.