T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:23
- Finding
- Raw Wallet Private Key Exposed to an Unverifiable Command-Line Executable## Vulnerability Details **File Location**: `SKILL.md`, lines 23-26 **Vulnerability Type**: Sensitive credential exposure through process environment **Risk Level**: High ### Vulnerable Code ```bash export POLYMARKET_API_KEY="your-key" export POLYMARKET_PRIVATE_KEY="your-wallet-key" mia-polymarket analyze --market "tech-ai" mia-polymarket trade --market-id "xxx" --position "yes" --amount 10 ``` ### Technical Analysis The setup instructions require users to export a raw wallet private key into an environment variable before executing `mia-polymarket`. Environment variables are ambient credentials inherited by child processes, so the invoked executable receives unrestricted access to `POLYMARKET_PRIVATE_KEY`. The audited package contains no implementation of `mia-polymarket`, installation instructions, pinned package version, integrity hash, trusted source, or mechanism for validating the executable selected through the user's command search path. Consequently, users cannot audit how the private key is stored, used, or transmitted. A malicious, substituted, or compromised executable with the expected name could read and disclose the key. The documented portfolio limit, stop-loss, and reporting controls are descriptive only. No code in the project enforces these controls or restricts the transactions that can be signed using the exposed key. ### Attack Path 1. A user installs or otherwise obtains an untrusted executable named `mia-polymarket`, or an attacker places a spoofed executable earlier in the user's command search path. 2. Following `SKILL.md`, the user exports the API key and raw wallet private key into the shell environment. 3. The user invokes `mia-polymarket analyze` or `mia-polymarket trade`. 4. The operating system passes the exported credentials to the selected executable as part of its inherited environment. 5. The executable reads `POLYMARKET_PRIVATE_KEY` and may transmit it to an attacker or use it t ...[truncated 873 chars]
- Remediation
- ## Remediation Suggestions - Do not require users to expose raw wallet private keys through environment variables. - Use a hardware wallet, isolated signing service, operating-system credential store, or wallet provider that supports scoped transaction signing. - Require explicit user confirmation that displays the destination contract, market, position, amount, token allowance, fees, and maximum loss before signing. - Use a dedicated low-value trading wallet with minimal balances and narrowly scoped token approvals. - Publish the complete auditable implementation of `mia-polymarket`, including its credential-handling and transaction-signing logic. - Provide a trusted installation source, cryptographic checksums or signatures, and pinned versions. Instruct users to validate the resolved executable path and integrity before supplying credentials. - Enforce portfolio limits, daily loss limits, stop-loss behavior, market allowlists, and transaction-value caps in code rather than relying on documentation. - Ensure secrets are never logged, included in error reports, passed as command-line arguments, or transmitted to analytics and telemetry services. - Support credential revocation and document an incident-response procedure for rotating the API key, revoking token approvals, and moving assets if a wallet key is exposed.
