T01 · Skill Instruction Hijacking
- Location
- src/daemon/server.ts:282
- Finding
- Untrusted P2P Message Content Is Forwarded Directly into OpenClaw Agent Events<![CDATA[ ## Vulnerability Details **File Location**: `src/daemon/server.ts:282-316` **Vulnerability Type**: Remote instruction injection through trusted Agent events **Risk Level**: High ### Vulnerable Code ```ts private triggerOpenclawWake(message: Message): void { try { const { spawnSync } = require('child_process'); // Determine priority based on message content const isUrgent = message.content.startsWith('URGENT:') || message.content.startsWith('ALERT:') || message.content.startsWith('CRITICAL:'); const mode = isUrgent ? 'now' : 'next-heartbeat'; // Format message for openclaw const fromDisplay = message.fromNick ? `${message.from}(${message.fromNick})` : message.from; const wakeMessage = `ClawChat from ${fromDisplay}: ${message.content}`; // Spawn openclaw system event command // Use spawnSync with timeout to avoid blocking const result = spawnSync( 'openclaw', ['system', 'event', '--text', wakeMessage, '--mode', mode], { timeout: 5000, stdio: 'ignore' } ); if (result.error) { console.error( '[openclaw-event] Failed to trigger system event:', result.error.message ); } } catch (error) { console.error('[openclaw-event] Error triggering system event:', error); } } ``` ### Technical Analysis The body and displayed sender of a network message are incorporated verbatim into an OpenClaw system event. Although `spawnSync` uses an argument array and therefore avoids conventional shell metacharacter injection, the content crosses a more important Agent trust boundary: remote peer-controlled text is submitted as an event that may be interpreted as instructions by the Agent. The sender can also select immediate processing by starting the message with `URGENT:`, `ALERT:`, or `CRITICAL:`. There is no structured separation between trusted event metadata and untrusted message data, ...[truncated 1580 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Set `openclawWake` to `false` by default and require an explicit opt-in. 2. Require a non-wildcard sender allowlist before wake integration can be enabled. 3. Submit a structured event containing separate fields for sender, message ID, urgency, and untrusted body. 4. Add an explicit instruction to the Agent-side integration that the body is untrusted data and must never override policies or authorize tool use. 5. Require user confirmation before processing messages that request privileged or externally visible actions. 6. Do not let an untrusted prefix alone select immediate execution. Apply local, sender-specific rate limits and priority policies. 7. Limit message size and rate to prevent wake-event flooding. 8. Consider forwarding only a notification containing the sender and message ID; retrieve and display the body in a restricted workflow after validation. ]]>
