T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/ercdata-cli.py:304
- Finding
- Wallet Private Key Exposed Through Process Command-Line Arguments## Vulnerability Details **File Location**: `scripts/ercdata-cli.py:304`; usage examples in `SKILL.md:15-32` **Vulnerability Type**: Sensitive credential exposure through process arguments **Risk Level**: High ### Vulnerable Code The CLI accepts a wallet private key directly as an argument: ```python parser.add_argument("--key", default=PRIVATE_KEY, help="Private key") ``` The documented commands encourage users to pass the environment variable through that argument: ```bash uv run {baseDir}/scripts/ercdata-cli.py store \ --type AI_AGENT_MEMORY \ --data "memory hash: abc123" \ --metadata '{"agent":"MyBot","ts":"2026-01-31"}' \ --key $ERCDATA_KEY --contract $ERCDATA_CONTRACT ``` ### Technical Analysis When `$ERCDATA_KEY` is expanded as the value of `--key`, the actual wallet private key becomes part of the Python process argument vector. Command-line arguments can be captured by process inspection utilities, process-monitoring services, audit systems, CI telemetry, diagnostic tools, command wrappers, or improperly configured logs. Although environment variables also require careful handling, expanding the variable into a command-line argument unnecessarily increases exposure. The affected credential is a signing key for a potentially funded Base wallet and is therefore equivalent to full control of that wallet. ### Attack Path 1. A user follows the documented Quick Start command and supplies `--key $ERCDATA_KEY`. 2. The shell expands `$ERCDATA_KEY` to the plaintext private key before starting the CLI. 3. The plaintext key appears in the process argument vector. 4. A local user, monitoring agent, CI logger, diagnostic collector, or other process with access to process metadata records the arguments. 5. The observer imports the captured private key into another wallet or signing tool. 6. The attacker signs arbitrary transactions as the affected account, independently of the ERCData CLI. Exploi ...[truncated 826 chars]
- Remediation
- ## Remediation Suggestions - Remove the `--key` command-line option so private keys cannot be supplied through the process argument vector. - Read the key from a narrowly scoped environment variable only when no safer signer is available. - Prefer a protected credential file with restrictive permissions, an operating-system keyring, a hardware wallet, or an external signing service. - If interactive use is required, accept the key through a non-echoing prompt or protected standard input rather than a command-line argument. - Update every example in `SKILL.md` to omit `--key $ERCDATA_KEY`. - Use a dedicated, minimally funded wallet with only the contract roles necessary for the intended command. - Ensure application, CI, shell, and monitoring logs redact wallet keys and other signing material. - Avoid retaining private-key strings longer than necessary in application memory.
