Back to skill

Security audit

Feishu Owner Transfer Advanced

Security checks for vulnerabilities and agentic risk

Overview

The skill performs the advertised Feishu ownership-transfer task, but it can transfer broad sets of documents without default dry-run, confirmation, or consistent limits to AI-owned files.

Install only if you intend to let this skill use an authenticated lark-cli account to change Feishu document ownership. Prefer dry-run first, verify every target and source owner, avoid broad wiki/root transfers unless you have tenant authority, and do not rely on the documentation's human-owner skipping claim for all modes.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/transfer_owner.py:76
Finding
Ownership transfers do not consistently prevent reassignment of human-owned documents<![CDATA[ ## Vulnerability Details **File Locations**: - `scripts/transfer_owner.py:76-90` - `scripts/transfer_wiki.py:142-155` - Related declared behavior: `SKILL.md:14-20` **Vulnerability Type**: Missing source-owner authorization filtering **Risk Level**: Medium ### Vulnerable Code Single-token transfer mode in `scripts/transfer_owner.py:76-90`: ```python if args.token: parts = args.token.split(":", 1) file_type, token = parts[0], parts[1] info = get_file_info(file_type, token) owner = info.get("owner_id", "unknown") fname = info.get("name", file_type) print(f" 文件: {fname}") print(f" 类型: {file_type}") print(f" 当前所有者: {owner}") if not args.list: resp = transfer_owner(file_type, token, args.target, args.member_type) if resp.get("code") == 0: print(f" 转移成功 -> {args.target}") ``` Wiki transfer mode in `scripts/transfer_wiki.py:142-155`: ```python # 跳过已是目标所有者的 if current_owner == args.target: print(f"{indent} ✅ 已是目标所有者,跳过") skipped += 1 print() continue if args.list: print(f"{indent} [DRY-RUN] 将转移 -> {args.target}") transferred += 1 else: resp = transfer_owner(ftype, docs_token, args.target, args.member_type) if resp.get("code") == 0: print(f"{indent} ✅ 转移成功") transferred += 1 ``` ### Technical Analysis The Skill declares that it transfers documents created by an AI agent and automatically skips files already owned by humans. Root-directory batch mode implements a heuristic for this behavior by treating owner IDs beginning with `ou_` as human owners. That protection is not applied consistently: 1. In single-token mode, the script retrieves and displays the current owner but transfers the document without checking whether that owner is an AI identity, a permitted source owner, or a human. 2. In Wiki mode, the only ownership restriction is that a document already owned by the destination user is skipped. Any other accessible document is s ...[truncated 2959 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Require a verified source owner in every mutating mode** - Add a required `--source-owner` or `--ai-owner` parameter for single-token and Wiki transfers. - Abort the transfer if owner metadata is absent, unknown, or does not exactly match the expected source identity. - Do not rely solely on an owner-ID prefix to determine whether an account is human or automated. 2. **Apply one shared authorization policy** - Implement a central function such as: ```python def is_transfer_allowed(current_owner, target_owner, allowed_source_owner): if not current_owner: return False if current_owner == target_owner: return False return current_owner == allowed_source_owner ``` - Invoke this function from root batch, single-token, and Wiki workflows before every transfer. 3. **Fail closed when metadata lookup fails** - A missing owner must not be represented as `"unknown"` and then ignored. - Abort or skip when Feishu returns an error, incomplete metadata, or an unrecognized owner type. 4. **Require explicit authorization for human-owned content** - If transferring human-owned documents is a necessary advanced feature, require a conspicuous override such as `--include-human-owned`. - Combine that override with an exact source-owner allowlist and interactive confirmation. - Clearly state that the override exceeds the default AI-document scope. 5. **Make batch workflows safe by default** - Default Wiki and broad root scans to dry-run behavior. - Require a separate `--apply` flag to perform mutations. - Before applying changes, display the source owner, destination owner, document name, type, and total number of affected documents. - Require confirmation for interactive use and a separate explicit flag for non-interactive execution. 6. **Constrain destination identities** - Validate `--member-type` against a fixed allowlist supported by the transfer API. - Valida ...[truncated 706 chars]
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding
The skill advertises capabilities such as wiki-space scanning and dual invocation modes that are not actually implemented as described. This mismatch is dangerous because users and orchestration layers may trust the declared behavior and approve actions under false assumptions, increasing the chance of unintended bulk transfers or execution paths that have not been properly reviewed.

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill exposes shell-executable operational steps but does not declare any tool scope or permission boundaries. In an agent environment, missing explicit tool constraints can let the skill invoke command execution more broadly than users expect, which is risky because the documented commands perform ownership-changing actions against external systems.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The trigger phrases are broad enough to match ordinary conversation about documents, transfers, or ownership. In a skill system, that can cause accidental activation of a high-impact workflow that changes ownership of documents, especially when combined with batch modes.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill supports bulk ownership transfer but does not present a prominent warning about the scope and consequences of transferring many documents. That omission raises the risk of users invoking a destructive administrative action without understanding that it may affect all root Drive files or large wiki-linked content sets.

External Transmission

Medium
Category
Data Exfiltration
Content
"remove_old_owner": False,
    "cancel_notify": False
}
resp = requests.post(url, json=data, headers=headers)
print(resp.json())
```
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
cmd = ["lark-cli", "api", method, path]
    if data:
        cmd += ["--data", json.dumps(data)]
    result = subprocess.run(cmd, capture_output=True, text=True)
    try:
        return json.loads(result.stdout)
    except json.JSONDecodeError:
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
cmd = ["lark-cli", "api", method, path]
    if data:
        cmd += ["--data", json.dumps(data)]
    result = subprocess.run(cmd, capture_output=True, text=True)
    try:
        return json.loads(result.stdout)
    except json.JSONDecodeError:
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The module docstring is entirely in Chinese, and the CLI help/descriptions are also presented only in Chinese. This imposes a language choice on users without opt-in or an alternative locale, which matches the language/locale policy violation category.

Static analysis

No suspicious patterns detected.