T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:166
- Finding
- Unencrypted Private-Key Storage in a Predictable Local Directory<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 166-176 **Vulnerability Type**: Plaintext storage of cryptographic key material **Risk Level**: High ### Vulnerable Code Snippet ```markdown The directory `$HOME/.openclaw/billions` contains all sensitive identity data: - `kms.json` - **CRITICAL**: Contains unencrypted private keys - `defaultDid.json` - DID identifiers and public keys - `challenges.json` - Authentication challenges history - `credentials.json` - Verifiable credentials - `identities.json` - Identity metadata - `profiles.json` - Profile data ``` ### Technical Analysis The Skill explicitly documents that private keys are stored unencrypted in `$HOME/.openclaw/billions/kms.json`. A private key is the root credential for the associated decentralized identity. Plaintext storage means that confidentiality depends solely on the local filesystem's access controls. Any process, user, malicious dependency, backup service, or compromised agent operating with permission to read the account's home directory could extract the key without defeating encryption. The predictable storage path also makes the credential easy to locate after obtaining local read access. The artifact does not include the implementation that creates this file, so its file permissions and other compensating controls cannot be verified. ### Attack Path 1. An attacker obtains code execution or filesystem read access under the account running the Skill. This could occur through an unrelated local compromise or a malicious package executed in the same account. 2. The attacker reads `$HOME/.openclaw/billions/kms.json`. 3. The attacker extracts the unencrypted private key. 4. The attacker imports the key into compatible identity software. 5. The attacker signs challenges or other supported messages while impersonating the agent's DID. 6. If services trust that DID, the attacker accesses resources or credentials gra ...[truncated 566 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Store private keys in an operating-system keychain, hardware-backed keystore, hardware security module, or dedicated secrets manager. 2. If file-based storage is unavoidable, encrypt private keys at rest with a key that is not stored beside the ciphertext. 3. Restrict the identity directory to the owning account and private-key files to owner-only access, such as directory mode `0700` and file mode `0600`. 4. Avoid accepting private keys through command-line arguments because command histories and process listings may expose them. Use protected standard input or a secure secret-provider integration. 5. Prevent keys from entering logs, backups, diagnostic archives, or version control. 6. Define key rotation and revocation procedures and rotate any key suspected of exposure. 7. Add implementation-level tests that reject insecure permissions and verify encryption at rest. ]]>
