T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/utils.js:93
- Finding
- WhatsApp Contact PII Exposed Through Standard Output<![CDATA[ ## Vulnerability Details **File Location**: `scripts/utils.js:93-108` **Vulnerability Type**: Sensitive data exposure through logs and command output **Risk Level**: Medium ### Vulnerable Code ```javascript function exportContacts() { try { const contactsPath = path.join(CREDS_PATH, 'contacts.json'); if (!fs.existsSync(contactsPath)) { console.log(JSON.stringify({ error: 'Contacts file not found' })); return; } const contacts = JSON.parse(fs.readFileSync(contactsPath, 'utf8')); const exported = Object.entries(contacts) .filter(([id]) => id.endsWith('@s.whatsapp.net')) .map(([id, c]) => ({ phone: id.replace('@s.whatsapp.net', ''), name: c.name || c.notify || null, isBusiness: c.isBusiness || false })); console.log(JSON.stringify({ total: exported.length, contacts: exported }, null, 2)); } catch (error) { console.log(JSON.stringify({ error: error.message })); } } ``` ### Technical Analysis The `export-contacts` command reads `contacts.json` from the OpenClaw WhatsApp credential-state directory and prints the entire contact list to standard output. The disclosed fields include telephone numbers, contact names, and business-account status. Although exporting contacts is an advertised feature, returning the complete dataset through standard output creates a secondary disclosure channel. Output from agent-executed commands may be incorporated into conversation history, execution traces, monitoring systems, CI logs, or other records with broader access and longer retention than the source credential directory. The implementation does not request explicit confirmation, support record selection, redact sensitive fields, or restrict the volume of personal data returned. ### Attack Path 1. The attacker or an untrusted workflow obtains the ability to invoke this skill in a context that can access the user's OpenClaw state directory. 2. The attacker invokes `node scr ...[truncated 1177 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require explicit user confirmation immediately before exporting contact data, including a clear description of the fields and number of records that will be exposed. 2. Avoid returning full contact records through standard output by default. Return only a count or a redacted preview unless the user explicitly requests the complete export. 3. Add filtering and field-selection options so callers can export only required records and attributes. 4. If a complete export is necessary, write it to an explicitly approved destination rather than an agent transcript. Create the file with restrictive permissions such as mode `0600`. 5. Do not log exported contact content. Ensure execution and telemetry systems redact phone numbers and names. 6. Validate that the resolved state and export paths are authorized for the active user and execution context. 7. Document the privacy implications and expected retention behavior of contact exports. ]]>
