T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- SKILL.md:92
- Finding
- Sensitive Credentials and Log Data Are Exposed to the Agent Context## Vulnerability Details **File Location**: `SKILL.md`, lines 92 and 101-107 **Vulnerability Type**: Excessive access to credential-bearing files and unsafe secret handling **Risk Level**: High ### Vulnerable Code ```bash cat ~/.openclaw/.api-keys.md | grep -E "sk-|nvapi-" grep -i "error\|fail\|unauthorized" /tmp/openclaw/*.log grep -c "error" /tmp/openclaw/openclaw-*.log grep -E "sk-[a-zA-Z0-9]+" /tmp/openclaw/*.log ``` ### Technical Analysis The skill explicitly reads a file named `.api-keys.md` and searches it for API-key prefixes. It also searches application logs for token-shaped strings and returns the matching lines. Because this is a prompt-only skill, command output is expected to enter the agent's execution context. A matching line can contain the complete credential rather than a redacted indicator. This violates least-privilege and secret-minimization principles: validating whether a key exists or whether file permissions are safe does not require disclosing the key value. Log matches may also include authentication tokens, request payloads, user data, error context, or other operationally sensitive information. The skill includes report history and notification features, creating a potential secondary disclosure route if raw command output is incorporated into persistent reports or messages. ### Attack Path 1. A user or automated schedule invokes the security-audit skill. 2. The skill reads `~/.openclaw/.api-keys.md`. 3. The `grep` command emits lines containing prefixes such as `sk-` or `nvapi-`, potentially revealing complete API keys. 4. The skill searches `/tmp/openclaw/*.log` for errors and token-shaped values. 5. Matching credentials and sensitive log lines enter the agent context. 6. The exposed values may subsequently be included in an audit report, retained report history, or configured notification channel. 7. Anyone with access to those contexts or reports could reuse a valid credenti ...[truncated 770 chars]
- Remediation
- ## Remediation Suggestions 1. Remove the command that reads the contents of `.api-keys.md`. 2. Audit only file metadata and permissions, for example: ```bash stat -c '%a %U %G %n' ~/.openclaw/.api-keys.md ``` 3. Determine whether credentials are configured without returning their values. Emit only a Boolean result, provider name, file path, and remediation status. 4. Perform secret detection through a local redaction routine that replaces values with a fixed marker or a short, non-reversible fingerprint. 5. Never include raw matching log lines in reports. Report the file name, line number, match category, and a fully redacted excerpt. 6. Require explicit user authorization before accessing credential stores or logs. 7. Apply restrictive permissions such as `0600` to credential files and audit-report files. 8. Sanitize all findings before saving report history or sending notifications. 9. If this skill has already been used, inspect generated reports and agent logs for exposed keys, delete unsafe copies, and rotate any credential that may have been disclosed.
