T09 · Insecure Skill Coding Practices
- Location
setup.md:29- Finding
Wallet Private Key Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
setup.md:29-34;commands.md:269-280
Vulnerability Type: Private key exposure through process arguments and shell history
Risk Level: HighVulnerable Code
setup.md:29-34:markdown If they want to trade, guide them to set up their wallet themselves: 1. They run `polymarket wallet create` or `polymarket wallet import KEY` directly 2. Remind them about MATIC for gas on Polygon 3. They run `polymarket approve set` before first trade 4. Emphasize: the agent never handles private keys — wallet setup is done by the user directlycommands.md:269-280:markdown ## Wallet Management (USER-ONLY — agent must not run these) These commands handle private keys. The user must run them directly: ```bash polymarket wallet create # Generate new polymarket wallet create --force # Overwrite existing polymarket wallet import 0xKEY # Import existing polymarket wallet address # Print address polymarket wallet show # Full info (may reveal sensitive data) polymarket wallet reset # Delete config (prompts) polymarket wallet reset --force # Delete without prompttext ### Technical Analysis The documented wallet-import procedure places a private key directly in a command-line argument. Command arguments can be exposed through shell history, terminal session logging, process inspection facilities, endpoint monitoring products, audit logs, crash diagnostics, and copied command transcripts. Restricting execution to the user does not eliminate this vulnerability. The sensitive value is still supplied to the shell and operating system as plaintext. Depending on system configuration and timing, another local process or account may be able to inspect it while the command is running or retrieve it later from persistent history and logs. ### Attack Path 1. A user follows the documented `polymarket wallet import ...[truncated 1101 chars]- Remediation
View remediation
Remediation Suggestions
- Remove every example that places a private key directly in a command-line argument.
- Require an interactive wallet-import flow that reads the secret from a hidden terminal prompt.
- If supported by the CLI, accept the secret through a protected file descriptor or another mechanism that does not expose it in process arguments.
- Prefer hardware wallets or external signing mechanisms so raw private keys never enter the CLI environment.
- Explicitly warn users not to paste private keys into commands, scripts, environment variables, chat messages, or unencrypted files.
- Document secure permissions for any unavoidable temporary secret material and ensure it is deleted immediately after use.
- Advise users who previously followed the documented command to clear relevant history and logs and, because deletion may be incomplete, migrate assets to a newly generated wallet.
