T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:35
- Finding
- Wallet Private Key Exposed Through Console Logging<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 35–40 **Vulnerability Type**: Sensitive information exposure through logging **Risk Level**: High ### Vulnerable Code ```typescript import { generatePrivateKey } from "viem/accounts"; const privateKey = generatePrivateKey(); console.log("Private key:", privateKey); ``` ### Technical Analysis The documented wallet-generation procedure writes the complete Ethereum private key to standard output. Private keys are bearer credentials: possession of the key grants control over the associated wallet without any additional authentication. Standard output may be retained in terminal history, CI/CD logs, agent execution transcripts, remote development sessions, shell recordings, monitoring systems, or screen-sharing captures. This instruction also directly conflicts with the document's later warning never to expose private keys in logs. ### Attack Path 1. A user or automated agent follows the documented wallet-generation procedure. 2. The generated private key is printed to standard output. 3. The output is captured by an execution transcript, CI logger, terminal recorder, remote session, or another process with access to the logs. 4. An unauthorized party retrieves the exposed key. 5. The party imports the key into an Ethereum-compatible wallet. 6. The party signs arbitrary transactions, transfers wallet funds, and may transfer or otherwise control the ERC-8004 identity associated with the wallet. ### Impact Assessment An attacker who obtains the logged private key receives the same blockchain authority as the legitimate wallet owner. The attacker can spend all assets controlled by the key, authorize transactions, manipulate registrations available to the wallet, and take control of the associated on-chain identity. Blockchain transactions are generally irreversible, so recovery may be impossible after funds or identity assets are transferred. ]]>
- Remediation
- <![CDATA[ ## Remediation Suggestions - Remove the `console.log` statement and never emit private keys through standard output, application logs, exceptions, telemetry, or debugging tools. - Generate and store the key directly in a dedicated secret manager, hardware-backed keystore, encrypted wallet, or permission-restricted environment file. - If a local secret file is necessary, create it with restrictive permissions such as owner read/write only and ensure it is excluded from version control. - Avoid generating wallet credentials in CI/CD jobs or agent environments that automatically retain execution output. - Add secret-scanning controls for repositories, build logs, and execution transcripts. - Explicitly instruct users to rotate the wallet immediately if its private key has ever appeared in captured output. - Prefer a documented workflow that displays only the derived public wallet address. ]]>
