T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- agent-client/register-bot.js:30
- Finding
- Third-Party Moltbook API Credential Transmitted to a Project-Controlled Service<![CDATA[ ## Vulnerability Details **File Location**: `agent-client/register-bot.js:30-52` **Vulnerability Type**: Third-party credential disclosure and excessive privilege collection **Risk Level**: Critical ### Vulnerable Code ```javascript async function registerBot(botName, operatorName, moltbookApiKey) { return new Promise((resolve, reject) => { const data = JSON.stringify({ botName, operatorName, moltbookApiKey }); const url = new URL(`${API_BASE}/api/auth/register-bot`); const options = { hostname: url.hostname, port: 443, path: url.pathname, method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data), }, }; const req = https.request(options, (res) => { let body = ''; res.on('data', (chunk) => body += chunk); res.on('end', () => { try { resolve(JSON.parse(body)); } catch (e) { reject(new Error(`Invalid response: ${body}`)); } }); }); req.on('error', reject); req.write(data); req.end(); }); } ``` ### Technical Analysis The registration client accepts a reusable Moltbook API key and serializes the full credential into a request sent to the project-controlled ClawArcade API. The credential is therefore disclosed to infrastructure outside Moltbook's trust boundary. This behavior is not necessary for the current registration implementation. The corresponding legacy endpoint states that it no longer requires Moltbook API keys and directs users to a post-based challenge flow in `api-worker/src/index.js:466-479`. A challenge-response process can prove account control without granting ClawArcade possession of a reusable third-party bearer credential. The script also asks users to provide the key as a command-line argument. Command-line arguments may be exposed through shell history, process inspection, terminal logs, CI logs, or monitoring softw ...[truncated 1141 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove the legacy API-key submission workflow and stop accepting Moltbook keys at ClawArcade endpoints. 2. Use the already implemented post-based challenge flow: - Generate a short-lived, single-use challenge. - Require the user to publish or sign the challenge through Moltbook. - Verify the challenge through a public or narrowly scoped API. - Invalidate the challenge immediately after successful verification. 3. If direct verification is unavoidable, have the local client call Moltbook itself and submit only a purpose-bound proof to ClawArcade. 4. Never accept sensitive credentials through command-line arguments. Use protected standard input or an operating-system credential store when a local secret is required. 5. Revoke and rotate all Moltbook keys previously submitted through this workflow. 6. Review API, proxy, analytics, and application logs for historical credential retention and securely delete any captured keys. 7. Add automated tests that reject request bodies containing Moltbook bearer credentials. ]]>
