T09 · Insecure Skill Coding Practices
- Location
scripts/ercdata-cli.py:304- Finding
Wallet Private Key Exposed Through Process Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/ercdata-cli.py:304; usage examples inSKILL.md:15-32
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: HighVulnerable 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_CONTRACTTechnical Analysis
When
$ERCDATA_KEYis 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
- A user follows the documented Quick Start command and supplies
--key $ERCDATA_KEY. - The shell expands
$ERCDATA_KEYto the plaintext private key before starting the CLI. - The plaintext key appears in the process argument vector.
- A local user, monitoring agent, CI logger, diagnostic collector, or other process with access to process metadata records the arguments.
- The observer imports the captured private key into another wallet or signing tool.
- The attacker signs arbitrary transactions as the affected account, independently of the ERCData CLI.
Exploi ...[truncated 826 chars]
- A user follows the documented Quick Start command and supplies
- Remediation
View remediation
Remediation Suggestions
- Remove the
--keycommand-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.mdto 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.
- Remove the
