T05 · Unauthorized Access and Privilege Escalation
- Location
assets/runtime/bridge.mjs:469- Finding
Unauthenticated Bridge Management API Exposes Secrets, Logs, Configuration, and Message-Sending Capabilities
- Content
View full analysis
{ try { res.json(readdirSync(LOG_DIR).filter(name => name.endsWith('.log')).sort()); } catch { res.json([]); } }); app.get('/logs/:filename', (req, res) => { const path = resolve(LOG_DIR, req.params.filename); if (!existsSync(path)) { res.status(404).send('not found'); return; } res.type('text/plain; charset=utf-8').send(readFileSync(path, 'utf-8')); }); app.get('/config', (_req, res) => { res.json(config); }); app.post('/config', (req, res) => { config = deepMerge(config, req.body || {}); saveConfig(config); res.json({ ok: true, config }); }); app.post('/send_qq', async (req, res) => { const { type, target, message } = req.body || {}; if (!type || !target || !message) { res.status(400).json({ error: 'need type, target, message' }); return; } try { const data = await sendQQMessage(type, target, message, true); res.json({ ok: true, data }); } catch (error) { res.status(502).json({ ok: false, error: error.message }); } }); app.listen(Number(config.bridge.httpPort || 3002), () => { console.log(`[bridge] HTTP listening on ${config.bridge.httpPort || 3002}`); }); ``` ### Technical Analysis The Express application does not authenticate or authorize any management endpoint. Because `app.listen()` does not specify a loopback address, Node.js ordinarily listens on all available interfaces. The exposed endpoints provide security-sensitive capabilities: - `/logs` and `/logs/:filename` disclose stored QQ conversations. - `/config` returns the complete runtime configuration, including the NapCat API bearer token and QQ identifiers. - `POST /config` permits arbitrary configuration changes. - `POST /send_qq` sends ...[truncated 1208 chars]- Remediation
View remediation
