T09 · Insecure Skill Coding Practices
- Location
SKILL.md:63- Finding
Wallet Private Key Exposed Through Command-Line Arguments
- Content
View full analysis
"approve(address,uint256)" --private-key --rpc-url ` # SKILL.md:70 - **commandTemplate**: `cast send "claimQuest(uint256)" --private-key --rpc-url ` # SKILL.md:75 - **commandTemplate**: `cast send "claimQuestWithReferral(uint256,address)" --private-key --rpc-url ` # SKILL.md:81 - **commandTemplate**: `cast send "submitResult(uint256,string)" "" --private-key --rpc-url ` # SKILL.md:87 - **commandTemplate**: `cast send "stake(uint256)" --private-key --rpc-url ` # SKILL.md:94 - **commandTemplate**: `cast send "unstake(uint256)" --private-key --rpc-url ` # SKILL.md:99 - **commandTemplate**: `cast send "createQuest(string,string,uint256,string[],uint256)" "" "<description>" <bountyAmountInWei> '[\"<skillTag1>\"]' <deadlineTimestamp> --private-key <agentPrivateKey> --rpc-url <rpcUrl>` # SKILL.md:104 - **commandTemplate**: `cast send <contractAddress> "approveCompletion(uint256)" <questId> --private-key <agentPrivateKey> --rpc-url <rpcUrl>` # SKILL.md:109 - **commandTemplate**: `cast send <contractAddress> "rejectCompletion(uint256)" <questId> --private-key <agentPrivateKey> --rpc-url <rpcUrl>` # SKILL.md:118 - **commandTemplate**: `cast send <contractAddress> "reclaimQuest(uint256)" <questId> --private-key <agentPrivateKey> --rpc-url <rpcUrl>` ``` ### Technical Analysis All state-changing action templates instru ...[truncated 2825 chars]- Remediation
View remediation
` from every action template. 2. Use an encrypted Foundry keystore and select the account through `--account`, requiring interactive or protected password entry. 3. Where possible, use a hardware wallet, external signer, or isolated signing service so raw private keys never enter the Agent's execution context. 4. If automated signing is unavoidable, use a dedicated low-value wallet with narrowly scoped balances and allowances. Do not reuse production or operator wallets. 5. Configure execution tooling to redact credentials from tool traces, logs, telemetry, exceptions, and process-monitoring output. 6. Avoid passing secrets through command-line arguments or embedding them directly in generated shell commands. Environment variables reduce accidental shell-history exposure but can still leak through process environments and should not replace a secure signer. 7. Require explicit operator confirmation for mainnet transactions and display the chain ID, target contract, function, token amount, allowance, and estimated value before signing. 8. Use exact or limited USDC approvals rather than unnecessarily large or unlimited allowances, and revoke obsolete approvals. 9. Update the Skill documentation with separate safe examples for testnet and mainnet, including warnings against key reuse and plaintext key handling. 10. Treat any key previously used with these templates as potentially exposed. Migrate assets and permissions to a newly generated key and revoke existing token approvals where appropriate. ]]>
