T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/feishu_file_sender.py:154- Finding
Unrestricted Local File Exfiltration to a Caller-Controlled Feishu Recipient
- Content
View full analysis
argparse.Namespace: parser = argparse.ArgumentParser(description="Upload file to Feishu and send") parser.add_argument("--file", required=True, help="Local file path") parser.add_argument("--receive-id", default=None, help="chat_id or open_id") parser.add_argument( "--receive-id-type", default=None, help="chat_id / open_id / user_id (auto-detect if omitted)", ) parser.add_argument( "--file-type", default="stream", help="file_type for upload, default stream", ) return parser.parse_args() def main() -> None: args = parse_args() file_path = Path(args.file) if not file_path.exists(): raise FileNotFoundError(f"File not found: {file_path}") config = load_openclaw_config() agent_id = resolve_agent_id(config) app_id, app_secret = resolve_feishu_account(config, agent_id) receive_id = resolve_receive_id(args.receive_id) receive_id_type = infer_receive_id_type(receive_id, args.receive_id_type) token = get_tenant_access_token(app_id, app_secret) file_key = upload_file(token, file_path, args.file_type) result = send_file_message(token, receive_id, receive_id_type, file_key) print("Send success:", result) ``` ### Technical Analysis The script accepts an arbitrary local path through `--file` and an arbitrary Feishu destination through `--receive-id`. It only verifies that the selected path exists. It does not verify that the path: - Is a regular file. - Is contained within the active agent workspace. - Belongs to a dedicated generated-output directory. - Is not a symbolic link escaping an approved directory. - Represents a file generated during the current task. The recipient is likewise n ...[truncated 1811 chars]- Remediation
View remediation
