T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:150
- Finding
- Unencrypted Private Keys Stored in a Predictable Local File<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 150-160 **Vulnerability Type**: Plaintext storage of cryptographic secrets **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 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 identity private keys are stored unencrypted in `$HOME/.openclaw/billions/kms.json`. This is a predictable filesystem location, and the documentation does not specify encryption at rest, restrictive file permissions, operating-system keychain integration, process isolation, or any other access-control mechanism. A private key is the root authentication secret for the associated decentralized identity. Any local process or user that can read `kms.json` can copy the key and perform cryptographic operations outside the intended Skill workflow. The restrictions against manually reading or manipulating the directory are agent instructions rather than enforceable security controls and therefore do not protect the file from other processes or a compromised account. ### Attack Path 1. The Skill creates or imports an identity. 2. Its private key is written unencrypted to `$HOME/.openclaw/billions/kms.json`. 3. Another local process, compromised Skill, malicious dependency, backup reader, or user with access to the account reads the predictable file. 4. The attacker extracts the private key. 5. The attacker imports the key into another tool or environment. 6. The attacker signs challenges and impersonates the affected agent identity without using the legitimate Skill. ### Impa ...[truncated 584 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not store raw private keys in plaintext JSON files. - Integrate with an operating-system credential manager, hardware-backed key store, hardware security module, or encrypted keystore. - If filesystem storage is unavoidable, encrypt every private key using a user-supplied secret and a modern authenticated-encryption scheme. - Create the storage directory with permissions limited to the owning user and create secret files with mode `0600`. - Verify ownership and permissions before every key operation and refuse to continue if they are unsafe. - Ensure backups, logs, diagnostics, and error reports exclude private-key material. - Minimize the duration for which decrypted keys remain in process memory and clear sensitive buffers when feasible. - Provide documented key rotation and revocation procedures for suspected compromise. - Add automated tests that verify private keys are never persisted in plaintext. ]]>
