T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:143
- Finding
- Identity Private Keys May Be Stored in Plaintext<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 143-149 **Vulnerability Type**: Plaintext storage of sensitive cryptographic material **Risk Level**: High ### Vulnerable Code Snippet ```markdown ## Security **CRITICAL - Data Storage and Protection:** The directory `$HOME/.openclaw/billions` contains all sensitive identity data: - `kms.json` - **CRITICAL**: Contains private keys (encrypted if BILLIONS_NETWORK_MASTER_KMS_KEY is set, otherwise in plaintext) - `defaultDid.json` - DID identifiers and public keys ``` The environment variable controlling encryption is documented as optional: ```yaml metadata: { "category": "identity", "clawdbot": { "requires": { "bins": ["node"] }, "config": { "optionalEnv": ["BILLIONS_NETWORK_MASTER_KMS_KEY"] } } } ``` ### Technical Analysis The documented storage design allows identity private keys to be written to `$HOME/.openclaw/billions/kms.json` without encryption whenever `BILLIONS_NETWORK_MASTER_KMS_KEY` is not configured. Private keys are bearer-equivalent cryptographic secrets: possession permits an attacker to produce valid signatures and impersonate the associated decentralized identity. Encryption therefore fails open rather than failing closed. The document also does not specify restrictive file permissions, ownership checks, key rotation, or use of an operating-system secret store. ### Attack Path 1. An operator creates an identity without setting the optional `BILLIONS_NETWORK_MASTER_KMS_KEY` environment variable. 2. The implementation stores the generated private key in plaintext in `$HOME/.openclaw/billions/kms.json`. 3. A local process, another account with access, backup collector, diagnostic tool, or malware reads the file. 4. The attacker imports the recovered private key into another environment. 5. The attacker signs challenges and impersonates the agent's DID. ### Impact Assessment Successful exploitation can result in complete compromise of the affected decentralized id ...[truncated 332 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Make encrypted private-key storage mandatory and terminate identity creation if a secure encryption key is unavailable. - Store private keys in an operating-system keychain, hardware-backed keystore, or dedicated secrets manager where possible. - Enforce restrictive ownership and permissions on the storage directory and files, such as owner-only access. - Never log private keys or include them in diagnostic output. - Document key rotation and revocation procedures for suspected exposure. - Validate the protection and permissions of existing key stores before loading or using them. ]]>
