T05 · Unauthorized Access and Privilege Escalation
- Location
src/base/attachments.js:124- Finding
Unrestricted Local File Read and Upload to Feishu
- Content
View full analysis
Boolean(value.file_path || value.url), { message: 'upload_attachment requires file_path or url' } ), ``` The path is resolved and read without an approved-root restriction: ```js if (input.file_path) { const filePath = path.resolve(input.file_path); const stat = await fs.promises.stat(filePath).catch(() => null); if (!stat?.isFile()) { throw baseError('FILE_NOT_FOUND', `Local file not found: ${filePath}`, { file_path: input.file_path }); } const buffer = await fs.promises.readFile(filePath); return { buffer, filename: input.filename || path.basename(filePath), size: stat.size, mimeType: input.mime_type || inferMimeType(input.filename || filePath), source: { file_path: filePath }, }; } ``` The resulting contents are subsequently transmitted to Feishu: ```js uploadResponse = await client.drive.v1.file.uploadAll({ data: { file_name: filename, parent_type: 'bitable_file', parent_node: input.app_token, size: loaded.size, file: loaded.buffer, }, }); ``` ### Technical Analysis The attachment feature legitimately needs access to a user-selected file, and local-file upload is documented in `README.md`. However, the implementation accepts any path readable by the OpenClaw process. `path.resolve()` only converts the su ...[truncated 2180 chars]- Remediation
View remediation
