Back to skill

Security audit

飞书自动化工具

Security checks for vulnerabilities and agentic risk

Overview

This Feishu automation skill is coherent, but it needs Review because it covers powerful workplace actions without enough guardrails around tokens, deletion, approvals, and scheduled automation.

Install only if you are comfortable giving the agent access to a Feishu app with carefully limited scopes. Before using it for production workflows, remove token-printing examples, require explicit confirmation for deletes and approval decisions, validate target record/event/task IDs, and keep scheduled automations narrowly scoped and auditable.

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
references/details.md:65
Finding

Feishu Tenant Access Token Exposed Through Standard Output

Content
View full analysis

Vulnerability Details

File Location: references/details.md, line 65
Vulnerability Type: Sensitive bearer-token disclosure through logging
Risk Level: Medium

Vulnerable Code

python
# Usage example
app_id = "cli_xxxxxxxxxxxxxxxx"
app_secret = "your_app_secret"
token = get_tenant_token(app_id, app_secret)
print(f"Tenant Token: {token}")

Technical Analysis

The example prints the complete Feishu tenant access token to standard output. Tenant access tokens are bearer credentials: possession is sufficient to authenticate API requests, subject to the permissions granted to the associated Feishu application.

If this example is executed in a terminal-recorded environment, CI/CD job, notebook, shared console, process supervisor, or centralized logging system, the token can be retained and exposed to users or services that do not otherwise have access to the application's credentials.

Although the token is time-limited, its disclosure creates a usable window for unauthorized API access. The surrounding authentication request to the official https://open.feishu.cn endpoint is necessary for the declared functionality; the vulnerability is the subsequent plaintext output of the returned token.

Attack Path

  1. An operator follows and executes the documented authentication example.
  2. A valid tenant access token is printed in full to standard output.
  3. The output is captured by terminal history, CI logs, notebook output, monitoring software, or centralized log storage.
  4. An unauthorized person or compromised service reads the retained token.
  5. The attacker places the token in an Authorization: Bearer ... header and calls Feishu APIs before it expires.
  6. Feishu accepts requests within the scopes granted to the application.

Impact Assessment

A disclosed token may permit unauthorized actions across the application's granted scopes. Depending on tenant configuration, these could ...[truncated 595 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the statement that prints the complete token:

    python
    token = get_tenant_token(app_id, app_secret)
    print("Tenant token obtained successfully")
    
  2. If diagnostic identification is necessary, display only a non-reusable, masked fragment:

    python
    print(f"Tenant token obtained: {token[:4]}...{token[-4:]}")
    
  3. Prohibit authentication tokens, application secrets, and authorization headers from application and HTTP debug logs.

  4. Add redaction filters for fields such as tenant_access_token, app_secret, and Authorization before logs are emitted or forwarded.

  5. Restrict access to CI output, notebooks, terminal recordings, and centralized logs; configure short retention periods where authentication workflows are executed.

  6. Apply least privilege by granting only the specific Feishu scopes required for each automation scenario rather than the complete permission list.

  7. If a real token has already appeared in logs, remove the retained output, investigate access to those logs, and revoke or rotate the associated application credentials where exposure cannot be confidently contained.

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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (19)

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 · references/details.md (reported line 39)May include surrounding context.

| 通讯录权限 | contact:user.base:readonly | 读取用户基础信息 | | 通讯录权限 | contact:user.id:readonly | 读取用户ID |

1.3 获取Tenant Access Token

python
import requests

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill hard-codes '中文输出', overriding the assistant's response language regardless of the user's preference. While not directly enabling code execution or data exfiltration, this is still a prompt-safety issue because it reduces user control and can cause the agent to ignore explicit user language requirements or downstream system expectations.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · references/details.md (reported line 53)May include surrounding context.

md
"app_secret": app_secret
    }
    
    response = requests.post(url, headers=headers, json=payload)
    result = response.json()
    
    if result.get("code") == 0:

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · references/details.md (reported line 322)May include surrounding context.

md
"app_secret": app_secret
    }
    
    response = requests.post(url, headers=headers, json=payload)
    result = response.json()
    
    if result.get("code") == 0:

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · references/details.md (reported line 384)May include surrounding context.

md
"app_secret": app_secret
    }
    
    response = requests.post(url, headers=headers, json=payload)
    result = response.json()
    
    if result.get("code") == 0:

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · references/details.md (reported line 436)May include surrounding context.

md
"app_secret": app_secret
    }
    
    response = requests.post(url, headers=headers, json=payload)
    result = response.json()
    
    if result.get("code") == 0:

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · references/details.md (reported line 525)May include surrounding context.

md
"app_secret": app_secret
    }
    
    response = requests.post(url, headers=headers, json=payload)
    result = response.json()
    
    if result.get("code") == 0:

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · references/details.md (reported line 569)May include surrounding context.

md
"app_secret": app_secret
    }
    
    response = requests.post(url, headers=headers, json=payload)
    result = response.json()
    
    if result.get("code") == 0:

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · references/details.md (reported line 585)May include surrounding context.

md
"app_secret": app_secret
    }
    
    response = requests.post(url, headers=headers, json=payload)
    result = response.json()
    
    if result.get("code") == 0:

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · references/details.md (reported line 601)May include surrounding context.

md
"app_secret": app_secret
    }
    
    response = requests.post(url, headers=headers, json=payload)
    result = response.json()
    
    if result.get("code") == 0:

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · references/details.md (reported line 101)May include surrounding context.

md
"app_id": self.app_id,
            "app_secret": self.app_secret
        }
        response = requests.post(url, json=payload)
        result = response.json()
        
        if result.get("code") == 0:

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · references/details.md (reported line 136)May include surrounding context.

md
"content": json.dumps({"text": content})
    }
    
    response = requests.post(url, headers=headers, params=params, json=payload)
    return response.json()

# 使用示例

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · references/details.md (reported line 169)May include surrounding context.

md
"content": json.dumps({"text": content})
    }
    
    response = requests.post(url, headers=headers, params=params, json=payload)
    return response.json()

# 使用示例

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · references/details.md (reported line 258)May include surrounding context.

md
"content": json.dumps({"text": content})
    }
    
    response = requests.post(url, headers=headers, params=params, json=payload)
    return response.json()

# 使用示例

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · references/details.md (reported line 338)May include surrounding context.

md
"fields": fields_data
    }
    
    response = requests.put(url, headers=headers, json=payload)
    return response.json()

# 创建记录示例

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The guide documents a batch deletion capability for Bitable records with no mention of confirmation, dry-run behavior, backup expectations, or access restrictions. In an automation skill, this materially increases the chance of accidental or over-broad destructive actions that can remove production data at scale.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The documented calendar deletion API removes scheduling data, but the guide does not warn users that the operation is destructive or suggest validation of the target event. In a scheduling automation context, a mistaken event_id or automation bug could silently delete important meetings.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This file is largely written in Chinese, but the policy rule applies to natural-language content that forces a specific language or locale without user opt-in. The payload explicitly fixes the message content to zh_cn, which can violate language/locale choice expectations when used in broader contexts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The event payload fixes the timezone to Asia/Shanghai, which imposes a locale-specific behavior on all users. The policy allows locale constraints only when users can choose them or when the restriction is clearly documented and justified as region-specific.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.