T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:189
- Finding
- Plaintext Private-Key Storage in a Predictable Wallet File<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:189-215` **Vulnerability Type**: Plaintext credential storage **Risk Level**: High ### Vulnerable Code ```markdown ### Environment Variables (.env) ```bash # RPC Providers (Optional - defaults to public) RPC_BASE=https://mainnet.base.org RPC_SOLANA=https://api.mainnet-beta.solana.com # Wallet (Managed by OpenClaw) WALLET_PATH=/path/to/custom/wallet.json # Default chain DEFAULT_CHAIN=base # Debug mode DEBUG=false ``` ### Wallet Setup Ensure wallet exists at: ``` ~/.openclaw/workspace/setup_wallet_dir_new/wallets/agent_wallet.json ``` **Format:** ```json { "privateKey": "0xYOUR_PRIVATE_KEY_HERE" } ``` ``` ### Technical Analysis The documented wallet design directs users to store a raw private key in an unencrypted JSON file at a predictable location. The instructions do not require restrictive file permissions, encryption at rest, a managed secret store, hardware-backed signing, or separation between wallet credentials and the agent workspace. A process or user capable of reading the workspace or home directory could copy the private key and import it into another wallet. Possession of the key would allow transactions to be signed independently of the Jubilee tooling, bypassing any application-level restrictions such as preserving principal or donating only yield. The artifact contains documentation only, so this audit does not establish that a real private key is currently present. The vulnerability lies in the insecure credential-storage practice prescribed by the Skill. ### Attack Path 1. A user follows the wallet setup instructions and writes a funded wallet's raw private key to the documented JSON file. 2. An attacker obtains local read access through another process, an exposed workspace, an insecure backup, overly broad file permissions, or an accidental repository commit. 3. The attacker reads `agent_wallet.json` and extracts the `privateKey` value. 4. The attacker imports the ...[truncated 666 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace raw-key JSON storage with a hardware wallet, managed signer, operating-system keychain, encrypted keystore, or dedicated secrets-management service. 2. Require transaction signing through an interface that never returns or exposes the private key to the agent workspace. 3. If a local encrypted keystore is unavoidable, use a strong key-derivation function and obtain its passphrase from a separate protected channel. 4. Require owner-only filesystem permissions, such as `0600` for the keystore and `0700` for its directory. 5. Store wallet material outside repositories and general-purpose workspaces, and provide explicit ignore rules for wallet and environment files. 6. Use a limited-balance operational wallet or constrained smart-account policy rather than giving unattended automation control of the primary treasury. 7. Document key rotation and emergency revocation procedures, including immediate migration of assets if local credential exposure is suspected. ]]>
