T09 · Insecure Skill Coding Practices
- Location
SKILL.md:99- Finding
Wallet Private Key Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:99-106; equivalent unsafe examples also appear inPLAYERS.md:33-44
Vulnerability Type: Private-key exposure through process arguments
Risk Level: Mediumbash # Bet HIGHER cast send 0xA3F09E6792351e95d1fd9d966447504B5668daF6 "betHigher()" \ --value 0.01ether --rpc-url https://mainnet.base.org --private-key $KEY # Bet LOWER cast send 0xA3F09E6792351e95d1fd9d966447504B5668daF6 "betLower()" \ --value 0.01ether --rpc-url https://mainnet.base.org --private-key $KEYTechnical Analysis
These instructions pass a raw wallet private key through the
--private-keycommand-line option. The shell expands$KEYbefore startingcast, causing the secret to become part of the process argument vector.Depending on operating-system access controls and execution environment, process arguments may be visible through process-monitoring utilities,
/procinterfaces, debugging tools, shell wrappers, audit systems, diagnostic telemetry, or command-execution logs. The same pattern appears inPLAYERS.md, where users are instructed to substituteYOUR_PRIVATE_KEYdirectly.Exploitation requires an attacker, monitoring component, or insufficiently isolated co-tenant to have access to the relevant process metadata. The project does not itself collect or transmit the private key, but its recommended invocation method unnecessarily exposes a high-value secret.
Attack Path
- A user exports the wallet private key as
$KEYand follows the documented command. - The shell expands
$KEYinto thecastprocess argument list. - A local process, privileged monitoring agent, CI logger, debugging utility, or compromised co-tenant captures the process arguments.
- The attacker extracts the private key.
- The attacker imports the key into another wallet or signer.
- The attacker signs arbitrary transactions and transfers any assets controlled by that extern ...[truncated 421 chars]
- A user exports the wallet private key as
- Remediation
View remediation
Remediation Suggestions
- Remove all examples that pass raw private keys through
--private-key. - Recommend an encrypted Foundry keystore and interactive password entry, for example through
cast wallet importand an account-based signing workflow. - Prefer a hardware wallet, isolated signing service, or wallet application that displays transaction destination, calldata, chain, and value before approval.
- In automated environments, use a dedicated low-value wallet and a secrets manager integrated with an isolated signer rather than placing the private key in environment variables or command arguments.
- Warn users never to paste private keys into shell commands, chat interfaces, agent prompts, logs, or Bankr requests.
- Update both
SKILL.mdandPLAYERS.mdso all signing examples follow the hardened workflow.
- Remove all examples that pass raw private keys through
