T09 · Insecure Skill Coding Practices
- Location
references/workflows.md:5- Finding
Unsafe Private-Key Handling Encourages Secrets in Source Code
- Content
View full analysis
Vulnerability Details
File Location:
references/workflows.md, lines 5-12
Vulnerability Type: Private key embedded directly in application source
Risk Level: HighComplete Vulnerable Code Snippet:
javascript You need an Ethereum wallet with: - A private key (for signing transactions) - BREAD tokens (from the raise or Uniswap) - ETH for gas (small amounts on Base) const account = privateKeyToAccount('0x...');Technical Analysis
The workflow passes a private-key literal directly to
privateKeyToAccount. Although the displayed value is a placeholder rather than an exposed credential, users are implicitly encouraged to replace it with a real signing key in the source file.Private keys embedded in source can be exposed through version-control history, shared files, IDE telemetry, build artifacts, terminal output, backups, prompt transcripts, or accidental publication. Unlike an ordinary password, possession of a blockchain private key generally gives the holder direct and irrevocable signing authority.
Attack Path
- A user copies the workflow and replaces
0x...with a real private key. - The resulting source file is committed, shared, logged, backed up, or submitted to an external service.
- An attacker obtains the file or its retained history.
- The attacker extracts the private key and imports it into a wallet.
- The attacker signs arbitrary transactions and transfers assets or consumes existing token allowances.
Impact Assessment
Successful exploitation compromises the entire wallet represented by the key. The attacker can exercise the same on-chain privileges as the wallet owner, including transferring ETH and tokens, interacting with contracts, approving spenders, and potentially controlling any protocols or administrative roles assigned to that address. The scope is not limited to Bread Protocol.
- A user copies the workflow and replaces
- Remediation
View remediation
Remediation Suggestions
- Do not place private keys directly in source code, examples, command-line arguments, logs, or prompts.
- Prefer a hardware wallet, managed signer, encrypted keystore, or dedicated secret-management service.
- If a local environment variable must be demonstrated, clearly state that it must never be committed or printed, and ensure the relevant environment file is excluded from version control.
- Use a dedicated low-value wallet with only the permissions and funds needed for the operation.
- Add explicit warnings that exposed keys must be considered permanently compromised and immediately rotated by transferring assets to a new wallet.
- Provide an example based on an injected signer rather than showing a private-key literal as the normal setup path.
