T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/OpenClawGameBridge.js:34- Finding
Unauthenticated Network-Accessible WebSocket Control Plane
- Content
View full analysis
{ try { const msg = JSON.parse(data); console.log('[Bridge] 收到消息:', msg.type, JSON.stringify(msg).substring(0, 200)); this.handleMessage(msg, ws); } catch (error) { console.error('[Bridge] 消息解析错误:', error); } }); ``` ```javascript // 发送控制指令到游戏客户端 onBridgeSendCommand(ws, msg) { const playerUid = msg.playerUid; const command = msg.command; if (!playerUid || !command) { console.log(`[Bridge] sendCommand 缺少参数: playerUid=${playerUid}, command=`, command); return; } const targetWs = this.clients.get(playerUid); if (!targetWs || targetWs.readyState !== WebSocket.OPEN) { console.log(`[Bridge] sendCommand 玩家不在线: ${playerUid}`); return; } // 包装成 ai_control 消息发给游戏客户端 targetWs.send(JSON.stringify({ type: 'ai_control', playerUid: playerUid, command: command })); console.log(`[Bridge] ✅ 发送指令到 ${playerUid}:`, JSON.stringify(command)); } ``` ```javascript onClientRegister(msg, ws) { // 处理空的playerUid let playerUid = msg.playerUid; if (!playerUid || playerUid === '') { playerUid = 'player_001'; console.log(`[Bridge] ⚠️ 玩家ID为空,已自动设置为: player_001`); } this.clients.set(playerUid, ws); console.log(`[Bridge] ⭐ 客户端注册: playerUid=${playerUid}, ws=${ws.readyState}`); console.log(`[Bridge] 当前保存的客户端:`, Array.from(this.clients.keys())); ``` ### Technical Analysis The WebSocket server is created wit ...[truncated 3120 chars]- Remediation
View remediation
