T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/inspect_remote_access.sh:35
- Finding
- Sensitive OpenClaw Configuration and Pairing Data Are Printed Without Redaction<![CDATA[ ## Vulnerability Details **File Location**: `scripts/inspect_remote_access.sh:35-47` **Vulnerability Type**: Sensitive information exposure through diagnostic output **Risk Level**: Medium ### Vulnerable Code ```bash if [ -f "$CONFIG_PATH" ]; then echo "== OpenClaw config: $CONFIG_PATH ==" sed -n '1,220p' "$CONFIG_PATH" echo else echo "Config file not found: $CONFIG_PATH" echo fi if [ -f "$HOME/.openclaw/devices/pending.json" ]; then echo "== Pending pairing requests ==" cat "$HOME/.openclaw/devices/pending.json" echo fi ``` ### Technical Analysis The diagnostic script prints up to the first 220 lines of the complete OpenClaw configuration and emits the complete pending-device pairing file without filtering or redaction. The configuration writer stores the gateway authentication token under `gateway.auth.token`, so executing this inspector can expose that token. The configuration may also contain unrelated credentials or sensitive operational settings. Pending pairing records may reveal device metadata, request identifiers, or other information useful for targeting or approving remote clients. This is particularly risky when the script is invoked by an AI agent, CI system, remote support session, or automated diagnostic collector because standard output may be retained in conversation transcripts, job logs, terminal scrollback, or telemetry. No external exfiltration is implemented by the repository itself. Exploitation requires access to the generated output or a logging system that records it. ### Attack Path 1. A user or agent follows the documented workflow and runs `inspect_remote_access.sh`. 2. The script reads the OpenClaw configuration and pending pairing file. 3. It writes their contents to standard output without redacting tokens or other sensitive fields. 4. An AI transcript, CI log, support record, terminal logger, or another local observer captures the output. 5. An attacker with access to that output recovers the ...[truncated 755 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Replace raw `sed` output with structured JSON parsing that selects only fields necessary for diagnostics. - Recursively redact keys such as `token`, `secret`, `password`, `credential`, `apiKey`, `privateKey`, and similar variants. - Report pairing-request counts and non-sensitive status information instead of printing the entire file. - Require an explicit option such as `--show-sensitive` before displaying unredacted data, and present a clear warning. - Ensure normal diagnostic output is safe to retain in AI transcripts and CI logs. - Add tests using fixture configurations containing secrets to verify that no secret value appears in standard output. ]]>
