Skip to content
GitHubRSS

Uncovering Exposed Private Keys Across the Nostr Network

Your Nostr identity is a key pair. The npub is public — share it everywhere. The nsec is private — leak it and anyone can impersonate you. There is no password reset, no support ticket, no recovery. The nsec is the account.

So what happens when private keys end up published in plaintext on the very network they grant access to?

We set out to answer this question using BigBrotr’s event archive — over 41 million events collected from 1,085 relays across clearnet, Tor, and I2P networks over 48 hours of continuous synchronization.

We searched every archived event — both the content field and tags — for strings matching the nsec1 Bech32 prefix. Each match was extracted via regex and validated by attempting to derive a public key from it using the secp256k1 curve.

MetricCount
Events containing nsec117,956
Unique nsec strings found16,941
Valid private keys16,599
Invalid (truncated or fake)342

16,599 valid Nostr private keys, published in plaintext, recoverable by anyone with access to a relay archive. But that number is misleading.

Anyone can publish a private key — including bots that mass-produce throwaway accounts. A single bot, which we call “Mr.nsec,” accounts for 15,285 of those 16,599 keys (92%). It creates throwaway accounts named Mr.{nsec} with the bio "Just your average nostr enjoyer" — each publishing a single profile event exposing a different private key, each from a unique throwaway pubkey that is never used again.

By key count, the bot dominates the dataset. But the accounts whose keys it republishes have almost no followers. By social impact, the bot is irrelevant.

The real question is not how many keys are exposed but how many real identities are at risk.

We applied successive filters to narrow down to the accounts that actually matter:

From raw key count to real impact

FilterKeys%
nsec1 strings found16,941100%
Valid private keys16,59998.0%
With at least 1 follower4632.7%
Real identity at risk860.5%
Still active (last 90 days)400.24%
No signs of compromise380.22%

A “real identity at risk” is defined as: at least 10 followers, a profile with a name, at least 10 events published, and the nsec was not published by the account itself (excluding intentional sharing and self-leaks). Of those 86, we checked which ones were still active and manually inspected each profile for signs of unauthorized use.

38 accounts are actively using a compromised key with no visible signs of awareness. They collectively have over 21,000 followers. Two additional accounts show clear signs of unauthorized use (profile defaced, spam content).

Excluding the bot, 1,314 organically leaked keys remain. Two questions matter: who published them, and how.

AuthorshipKeys% of keysFollowers exposed% of followers
Self-leak74256.5%26,92429.6%
Third-party57243.5%63,94570.4%

The split is nearly even by key count — 56% self-leak, 44% third-party. But the follower distribution is heavily skewed: third-party leaks account for 70% of all follower exposure, because they disproportionately target accounts with social presence. Self-leaks are mostly users pasting their nsec into a profile field, confusing it with their npub — typically new accounts with few followers.

By key count vs by follower exposure

By follower exposure — the metric that actually matters — profile-field leaks dominate at 74%. The real damage is done by users who accidentally pasted their nsec into a profile field. Smaller categories include nsec strings in contact list relay fields, bare nsec posts, and AI agents publishing credentials in operational logs.

How many leaked keys have social presence?

Section titled “How many leaked keys have social presence?”

When we exclude bot-generated keys, 35% of organically leaked keys belong to accounts with at least one follower:

Follower distribution — all keys vs non-bot keys

Removing the bot reveals the underlying trend of organic key exposure:

Monthly timeline of leak events with bot excluded

The bot operated in a single burst. The organic rate is steady and ongoing — a persistent UX problem, not a one-time attack. As long as clients allow users to paste nsec strings into profile fields without warning, new keys will continue to be exposed.

How many relays serve each leaked key?

CDF of relay spread by follower band

The median leaked key is available on just 1 relay. But accounts with more followers tend to see their leak events on more relays — up to 30+ for the most popular ones. This is expected: popular accounts’ events are replicated more widely in general, not just leak events. Regardless of the cause, the practical implication is the same: for accounts with wide relay distribution, deleting the event from one relay is insufficient. Key rotation is the only reliable remediation.

Of the 86 real identities with exposed keys, 40 have posted in the last 90 days. We manually inspected each profile to determine whether the account showed signs of compromise (spam, defaced profile, incoherent content) or appeared to be used normally.

Tier 1 at-risk identities: followers vs events, active vs inactive

38 accounts show no signs of compromise — they appear to be used normally by the original owner, who likely does not know their private key is publicly available. Two accounts show clear signs of unauthorized use.

FollowersEventsLeak dateLast activeStatus
18,9005,2882024-12-272026-03-15compromised
13,6571,5252023-11-182026-02-10compromised
3,9954,4852023-08-242026-03-15no signs
2,5433,1952024-11-182026-03-16no signs
1,8871022023-12-012026-01-24no signs
1,80016,0502023-12-112026-03-15no signs
1,3375252024-04-122026-03-15no signs
1,29514,0692023-12-052026-03-16no signs
1,0348,9492024-11-032026-03-16no signs
1,0062,3492023-09-172026-03-16no signs

The remaining 30 accounts (12–851 followers) all show no signs of compromise.

We deployed an nsec-leak-checker — a Nostr DVM (Data Vending Machine) that lets you check if your private key has been found in public events. Send a Kind 5300 event signed with your keys (with a p tag pointing to the DVM’s pubkey), and it responds with a NIP-44 encrypted message that only you can read.

This isn’t a protocol vulnerability — Nostr’s key-based identity model is sound. The leaks are user errors, client oversights, and AI agent carelessness.

Clients should reject nsec strings in profile fields before signing the event. A regex check on Kind 0 content before broadcast would prevent the most damaging leak category entirely.

Relay operators could reject events containing valid nsec strings. This is more aggressive and has trade-offs (false positives on educational content, shared accounts), but it would neutralize the bot completely.

AI agent developers should sanitize logs before publishing them as events. Private keys and credentials have no place in broadcast messages.

Users should understand the difference: npub is your address, nsec is your password. If you’ve ever pasted an nsec into a profile field, generate a new key pair immediately.

This analysis covers 1,085 of 2,009 known relays over approximately 48 hours of synchronization. The actual number of exposed keys across the full network is likely higher. We search only for the literal string nsec1 — keys in hexadecimal format or obfuscated in any way are not detected. Follower counts reflect the current state of the network, not the state at the time of the leak. Account lifespan calculations are based on the earliest and latest events in our archive, which may not correspond to the account’s true creation date. The self-leak exclusion filter is conservative: it removes all keys published by the account itself, including accidental self-leaks by users who are genuine victims of UX confusion.

All data was collected by BigBrotr’s Synchronizer service, archiving events from 1,085 relays using cursor-based pagination with binary-split windowing. nsec validation was performed using the nostr-sdk Python library. Follower counts were computed from the latest Kind 3 (contact list) event per pubkey. Profile data was extracted from the latest Kind 0 event. Recent activity was defined as any event published in the last 90 days. The 40 active at-risk accounts were manually inspected via their public profiles.

The full dataset is available for researchers upon request.