T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:183
- Finding
- Plaintext Persistence of Wallet Encryption Password## Vulnerability Details **File Location**: `SKILL.md`, lines 183–186 **Vulnerability Type**: Plaintext storage and persistent exposure of sensitive credentials **Risk Level**: High **Complete Code Snippet**: ```markdown | `NANSEN_WALLET_PASSWORD` | **Required for `trade execute`.** Wallet encryption password — persisted in `~/.nansen/.env`. Source before executing: `source ~/.nansen/.env && nansen trade execute ...` | | `NANSEN_API_KEY` | API key (also set via `nansen login`) | > **Agents:** Never hold a wallet password only in session memory. If `NANSEN_WALLET_PASSWORD` is not in `~/.nansen/.env`, follow the setup flow in the nansen-wallet-manager skill Password Policy to generate and persist one before proceeding. ``` ### Technical Analysis The Skill explicitly instructs agents to persist a wallet encryption password in `~/.nansen/.env` and source that file before executing trades. A dotenv file is ordinarily plaintext and does not provide protection equivalent to an operating-system credential store or dedicated secret manager. Persistent storage is not the minimum privilege necessary to decrypt a wallet for one authorized transaction. Sourcing the file also exports its variables into the shell environment, making the password available to the invoked CLI and potentially to inherited subprocesses, diagnostic output, crash reporting, or other processes able to inspect the user's environment. The instruction increases both the lifetime and exposure surface of a credential protecting assets and irreversible transaction capabilities. No evidence in the audited file confirms deliberate transmission of the wallet password to an unrelated network service. The confirmed issue is insecure local persistence and environment exposure. ### Attack Path 1. A user or agent follows the Skill instruction and stores `NANSEN_WALLET_PASSWORD` in `~/.nansen/.env`. 2. The file remains on disk beyond the trading session. 3. A malicious pro ...[truncated 1007 chars]
- Remediation
- ## Remediation Suggestions - Do not require agents to persist wallet passwords in plaintext dotenv files. - Store the credential in an operating-system keychain, hardware-backed credential store, or dedicated secret manager with explicit access controls and audit logging. - Prefer an interactive, non-echoing password prompt for each signing operation when persistent storage is unnecessary. - Pass the credential only to the exact process that needs it, and avoid exporting it broadly through `source`. - If file-based storage must remain as a compatibility fallback: - Enforce owner-only permissions such as mode `0600`. - Verify file ownership before reading it. - Keep wallet credentials in a dedicated file rather than a general-purpose environment file. - Exclude the file from source control, logs, telemetry, backups, and synchronization tools. - Document secure deletion and password-rotation procedures. - Prefer hardware-wallet or external-signer support so the CLI does not need a reusable wallet-decryption password. - Clear temporary environment variables immediately after use and ensure subprocesses do not inherit them unnecessarily.
