T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:15
- Finding
- Secret Scanning Command Exposes Credential Values in Output<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 15-18 **Vulnerability Type**: Sensitive data exposure through unredacted command output **Risk Level**: Medium ### Vulnerable Code ```bash # Scan for common secret patterns grep -rn --include='*.md' --include='*.json' --include='*.js' --include='*.py' --include='*.sh' \ -E '(api[_-]?key|secret|password|token|private[_-]?key)\s*[:=]\s*["\047][A-Za-z0-9+/=]{20,}' \ ~/.openclaw/workspace/ 2>/dev/null | grep -v node_modules ``` ### Technical Analysis The command recursively searches the workspace for credential-like values and emits each complete matching line. Although the stated purpose is secret detection, the implementation does not redact the detected value or limit output to filenames and line numbers. Consequently, API keys, passwords, tokens, or private-key material matching the regular expression can be copied into terminal output, agent context, execution logs, transcripts, or monitoring systems. Redirecting standard error does not protect the sensitive standard output. ### Attack Path 1. A workspace file contains a real credential in a format matched by the regular expression. 2. A user or agent follows the skill and executes the documented secret scan. 3. `grep` emits the entire source line, including the credential value. 4. The output is retained in terminal history, an agent transcript, an audit log, or another system processing command output. 5. Any party able to access that output can recover and use the exposed credential within its existing authorization scope. No automatic external transmission of the scan output is present in the reviewed file. Exploitation therefore depends on another party gaining access to the resulting output or logs. ### Impact Assessment Successful exploitation may disclose any workspace credential that matches the expression. The privileges obtained are those associated with the exposed cr ...[truncated 199 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not print complete matching lines or credential values. - Report only the affected filename, line number, and credential type. - If a short preview is necessary, replace the detected value with a fixed redaction marker such as `[REDACTED]`. - Ensure scan results are not automatically included in agent prompts, telemetry, or persistent logs. - Prefer a dedicated secret-scanning tool that supports verified patterns and redacted output. - Treat any credential already displayed by this command as potentially compromised and rotate it. - Restrict the scan to user-approved workspace paths and exclude generated files, dependency trees, and log directories. ]]>
