T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/onebot-action.js:39- Finding
Arbitrary Local File Disclosure Through Configurable WebSocket Endpoint
- Content
View full analysis
[key=value ...]'); console.error('Special: key=@/path/to/file reads file content as value'); ``` ```js // Read from file: key=@/path/to/file if (val.startsWith('@/')) { const fs = require('fs'); val = fs.readFileSync(val.slice(1), 'utf8').trim(); } ``` ```js function callOneBot(action, params) { return new Promise((resolve, reject) => { const WebSocket = require('ws'); const echo = `${action}_${Date.now()}`; const url = WS_TOKEN ? `${WS_URL}?access_token=${encodeURIComponent(WS_TOKEN)}` : WS_URL; const ws = new WebSocket(url); const timeout = setTimeout(() => { ws.close(); reject(new Error(`Timeout waiting for response to ${action}`)); }, 15000); ws.on('open', () => { const payload = { action, params, echo }; ws.send(JSON.stringify(payload)); }); ``` ### Technical Analysis The argument parser treats any value beginning with `@/` as an absolute local file path and reads the file synchronously. The implementation applies no path allowlist, canonical-path validation, file-type restriction, size limit, or permission boundary beyond the operating-system privileges of the Node.js process. The resulting file contents are inserted into the `params` object and transmitted as JSON through a WebSocket connection. Because `ONEBOT_WS_URL` can override the destination, an invocation can combine arbitrary local-file reading with transmission to a remote, caller-selected WebSocket server. This behavior exceeds the documented group-administration purpose. `SKILL.md` does not describ ...[truncated 1288 chars]- Remediation
View remediation
