T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
Nostr Private Key Exposed Through Chat and Process Arguments
- Content
View full analysis
Keys** (or your Nostr key manager). **Tell your bot:** "Here's my RUNSTR nsec: nsec1..." Your bot uses the nsec to decrypt your encrypted fitness backup from Nostr. The nsec is never stored, logged, or transmitted — it's used only for the decryption step in your current session. ``` ```bash content=$(nak req -k 30078 -a $hex_pk -t d=runstr-workout-backup -l 1 \ wss://relay.damus.io wss://nos.lol | jq -r '.content') # Decrypt (NIP-44 self-decryption: user to own pubkey) decrypted=$(echo "$content" | nak encrypt --sec $hex_sk $hex_pk --decrypt) ``` ```javascript // /tmp/decrypt-runstr.mjs — run with: node /tmp/decrypt-runstr.mjs '' import { gunzipSync } from 'zlib'; import NDK, { NDKPrivateKeySigner } from '@nostr-dev-kit/ndk'; const signer = new NDKPrivateKeySigner(process.argv[2]); const user = await signer.user(); const decrypted = await signer.decrypt(user, process.argv[3]); try { console.log(gunzipSync(Buffer.from(decrypted, 'base64')).toString()); } catch { console.log(decrypted); } ``` ### Technical Analysis The skill directs the user to disclose a complete Nostr private key directly to the agent. This places the credential in the conversation context, where it may be retained in session history, telemetry, diagnostics, or platform logs. The decoded key is subsequently expanded into a shell command and, in the Node.js fallback, supplied explicitly through `process.argv`. Command-line arguments can be visible to local process-inspection tools and may be captured by shell history, process accounting, monitoring software, crash reports, or diagnostic ...[truncated 1597 chars]- Remediation
View remediation
