T09 · Insecure Skill Coding Practices
Error
- Location
- auth.md:128
- Finding
- Wallet private key exposed through command-line arguments<![CDATA[ ## Vulnerability Details **File Location**: `auth.md:86,128`; `smart-contracts.md:164-169,196-201,224-228`; `examples.md:130-135,173-177` **Vulnerability Type**: Sensitive credential exposure through process arguments **Risk Level**: High ### Vulnerable Code `auth.md:86` ```bash WALLET=$(cast wallet address --private-key "$DECK0_PRIVATE_KEY" | tr '[:upper:]' '[:lower:]') ``` `auth.md:126-128` ```bash local signature signature="$(cast wallet sign --private-key "$DECK0_PRIVATE_KEY" "$payload")" ``` `smart-contracts.md:164-169` ```bash # Fallback signing: require DECK0_PRIVATE_KEY so unset env fails fast : "${DECK0_PRIVATE_KEY:?DECK0_PRIVATE_KEY must be set for fallback signing}" # Requires: auth helpers from auth.md (sign_request, make_authenticated_request, etc.) WALLET=$(cast wallet address --private-key "$DECK0_PRIVATE_KEY" | tr '[:upper:]' '[:lower:]') ``` `smart-contracts.md:196-201` ```bash tx_hash="$(cast send "$contract" \ "mintPacks(address,uint256,uint256,uint256,bytes,bytes32)" \ "$WALLET" "$quantity" "$price_in_native" "$expiration" "$sig" "$nonce" \ --value "$value" \ --private-key "$DECK0_PRIVATE_KEY" \ --rpc-url "$rpc_url" \ --json | jq -r '.transactionHash')" ``` `smart-contracts.md:224-228` ```bash tx_hash="$(cast send "$contract" \ "openPacks(uint256[])" \ "$pack_ids" \ --private-key "$DECK0_PRIVATE_KEY" \ --rpc-url "$rpc_url" \ --json | jq -r '.transactionHash')" ``` `examples.md:130-135` ```bash cast send "0x1a2b3c4d5e6f7890abcdef1234567890abcdef12" \ "mintPacks(address,uint256,uint256,uint256,bytes,bytes32)" \ "$WALLET" 2 813008130081300813 1706200120 "0x1234567890abcdef..." "0xabcdef1234567890..." \ --value "$VALUE" \ --private-key "$DECK0_PRIVATE_KEY" \ --rpc-url "https://rpc.apechain.com" ``` `examples.md:173-177` ```bash cast send "0x1a2b3c4d5e6f7890abcdef1234567890abcdef12" \ "openPacks(uint256[])" \ "[42,43,44]" \ --private-key "$DECK0_PRIVATE_KEY" \ --rpc-url "https://rp ...[truncated 2492 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove all uses of `--private-key "$DECK0_PRIVATE_KEY"` from documented commands. 2. Prefer the runtime-provided wallet or Base wallet signer, as already described by the Skill. 3. For local fallback signing, use an encrypted Foundry keystore or a hardware wallet rather than a raw environment variable. 4. Require explicit user confirmation that displays the chain ID, verified contract address, recipient, quantity, payment value, and estimated gas before submitting a transaction. 5. Ensure shell tracing is disabled around signing operations and never enable `set -x` while secrets are accessible. 6. Avoid placing raw keys in environment variables where practical; environment data can also be exposed by diagnostics and child processes. 7. Use a dedicated low-value wallet with only the funds and permissions required for the requested transaction. 8. Document a key-rotation and incident-response procedure for users who may already have executed the affected examples. ]]>
