Back to skill

Security audit

nansen-wallet-keychain-migration

Security checks for vulnerabilities and agentic risk

Overview

ClawScan rates this wallet migration skill suspicious because its steps do not clearly carry out the stated migration and include risky handling and cleanup of wallet credentials.

Consider avoiding installation until the migration steps and credential handling are clarified. In particular, do not share a wallet password in chat or source a credential file as shell code, and ensure any cleanup happens only after a successful migration and verification. The scan is partial: it inspected the listed Markdown component, but two local references were unresolved, so the evidence is incomplete.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (19)

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The supplied command performs wallet creation, which is materially different from migrating an existing wallet's password storage. It neither targets an existing wallet nor shows any transfer to keychain-backed storage or removal of insecure stored credentials.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The snippet could serve as a post-migration verification step, but it does not itself implement the declared migration. Unsetting an environment variable only removes it from the current shell environment; it does not change persistent credential storage. The export output is discarded, so the snippet does not visibly disclose or transmit the revealed wallet data.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
82% confidence
Finding

The supplied code only invokes a password-forgetting command. It shows no transfer to, or setup of, keychain-backed storage. Forgetting an insecurely stored password could support migration, but the supplied chunk does not demonstrate the declared migration workflow. The command's internal implementation is not provided.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 32)May include surrounding context.

md
- User mentions they stored their password in `~/.nansen/.env`, a `.env` file, or `memory.md`
- User gets the stderr warning: `⚠ Password loaded from insecure .credentials file`
- User asks to "secure my wallet" or "migrate to keychain"
- User created a wallet before the keychain update was released

## Detect current state

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 41)May include surrounding context.

bash
# 1. Where is the password stored? Offline, decrypts nothing, prints no secrets
nansen auth status --pretty     # → x402.password.source: "env" | "keychain" | "file" | null

# 2. Full setup check — flags the insecure .credentials file with a fix
nansen doctor --offline

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 46)May include surrounding context.

2. Full setup check — flags the insecure .credentials file with a fix

nansen doctor --offline

3. Legacy pattern doctor does not cover: password written to ~/.nansen/.env

ls -la ~/.nansen/.env 2>/dev/null && echo "FOUND: ~/.nansen/.env (insecure)"

text

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 47)May include surrounding context.

nansen doctor --offline

3. Legacy pattern doctor does not cover: password written to ~/.nansen/.env

ls -la ~/.nansen/.env 2>/dev/null && echo "FOUND: ~/.nansen/.env (insecure)"

text

Interpret `x402.password.source`:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 47)May include surrounding context.

nansen doctor --offline

3. Legacy pattern doctor does not cover: password written to ~/.nansen/.env

ls -la ~/.nansen/.env 2>/dev/null && echo "FOUND: ~/.nansen/.env (insecure)"

text

Interpret `x402.password.source`:

Credential Access

High
Category
Privilege Escalation
Confidence
94% confidence
Finding

The surrounding step asks the human to supply or confirm their wallet password through the agent conversation. This can expose the password to conversation retention and downstream logging, contradicting the skill's own prohibition on storing passwords in conversation history.

Content

Scanner excerpt · SKILL.md (reported line 68)May include surrounding context.

md
> "Your wallet password is currently stored in ~/.nansen/.env, which is insecure.
> I can migrate it to your OS keychain. Please confirm the password you used when
> creating the wallet, or I can read it from ~/.nansen/.env if you authorize it."

**Step 2 — Migrate:**

Credential Access

High
Category
Privilege Escalation
Confidence
99% confidence
Finding

Sourcing a .env file executes it as shell code rather than reading only the wallet password. If an attacker can modify or substitute that file, migration executes arbitrary commands with the agent's privileges; permission to read the password does not authorize executing file contents.

Content

Scanner excerpt · SKILL.md (reported line 76)May include surrounding context.

var is available to the node process:

bash
source ~/.nansen/.env 2>/dev/null && nansen wallet secure

Step 3 — Verify the password actually decrypts the wallet:

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 82)May include surrounding context.

Step 3 — Verify the password actually decrypts the wallet:

bash
# Unset env var to prove keychain works, then run a decrypting export with
# all output discarded — the exit code alone is the signal, so no key
# material can land in a transcript or log
unset NANSEN_WALLET_PASSWORD

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 157)May include surrounding context.

Unset env var to prove keychain works

unset NANSEN_WALLET_PASSWORD

This MUST exit 0 — it proves the keychain password decrypts the wallet.

Output is discarded on purpose: the exit code alone is the signal.

if nansen wallet export default --reveal > /dev/null 2>&1; then echo "decryption OK"; else echo "decryption FAILED"; fi

text

Credential Access

High
Category
Privilege Escalation
Confidence
88% confidence
Finding

Removing obsolete plaintext credentials is appropriate, but the provided cleanup deletes the entire .env file without an enforced successful-migration condition. The verification command returns success after either echo branch, so naïve sequential execution can delete the remaining password after a failed migration or remove unrelated configuration.

Content

Scanner excerpt · SKILL.md (reported line 96)May include surrounding context.

Step 4 — Clean up the insecure file:

bash
rm -f ~/.nansen/.env

Path B: Password in .credentials file (auto-saved fallback)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
88% confidence
Finding

The deletion is narrowly targeted and serves a legitimate cleanup purpose, but the workflow does not mechanically gate it on successful migration. Deleting the entire file after failed verification can lose a recoverable password, and the file may also contain unrelated settings.

Content

Scanner excerpt · SKILL.md (reported line 96)May include surrounding context.

Step 4 — Clean up the insecure file:

bash
rm -f ~/.nansen/.env

Path B: Password in .credentials file (auto-saved fallback)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 120)May include surrounding context.

Path C: Password only in NANSEN_WALLET_PASSWORD env var

bash
# Persist the env var password to keychain
nansen wallet secure

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 154)May include surrounding context.

the keychain password can actually decrypt the wallet:

bash
# Unset env var to prove keychain works
unset NANSEN_WALLET_PASSWORD

# This MUST exit 0 — it proves the keychain password decrypts the wallet.

Credential Access

High
Category
Privilege Escalation
Confidence
99% confidence
Finding

This rule repeats the instruction to execute the credential file using source. Suppressing password output does not prevent arbitrary code in that file from executing or transmitting credentials elsewhere.

Content

Scanner excerpt · SKILL.md (reported line 192)May include surrounding context.

md
- **NEVER store the password** in files, memory, logs, or conversation history
- **NEVER use `--human` flag** — interactive prompts break agents
- If the human authorizes reading `~/.nansen/.env`, read it in the same command
  (`source ~/.nansen/.env && nansen wallet secure`) — do not echo or log the value
- **ALWAYS verify after migration** with `nansen wallet export default --reveal > /dev/null 2>&1` (branch on the exit code; never let the output print) — `wallet show` does NOT prove the password works (it never loads the password)

File System Enumeration

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.

Content

Scanner excerpt · SKILL.md (reported line 47)May include surrounding context.

nansen doctor --offline

3. Legacy pattern doctor does not cover: password written to ~/.nansen/.env

ls -la ~/.nansen/.env 2>/dev/null && echo "FOUND: ~/.nansen/.env (insecure)"

text

Interpret `x402.password.source`:

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 62)May include surrounding context.

md
### Path A: Password in `~/.nansen/.env` (old skill pattern)

The previous wallet skill told agents to write the password to `~/.nansen/.env`.

**Step 1 — Ask the human for their password:**