ENTROPÍA

I shared my xpub and a child private key: can they drain my wallet?

You thought sharing just the xpub was safe, but if a non-hardened child private key also leaked, whoever has both can derive every key in your wallet.

With your xpub and **a single non-hardened child private key**, anyone can reconstruct your extended private key and every key in the tree.

What you're exposing without realizing it

BIP-32's Security section says: "knowledge of a parent extended public key plus any non-hardened private key descending from it is equivalent to knowing the parent extended private key." That means if someone has your extended public key and also a single non-hardened child private key derived from it, they have the same thing as your extended private key.

From there they can derive every key in the tree, not just the child they already know. That's why hardened keys exist and why they're used at the account level: they break the path between the xpub and higher-level private keys.

Why a single child key is enough

Non-hardened derivation lets someone calculate a child public key from the xpub. If a child private key also leaks, that combination equals having the parent extended private key. It's not a bug; it's a mathematical property of normal derivation.

Hardened keys block that backward path, because deriving them requires the extended private key and cannot be computed from the xpub. That's why the account level usually uses hardened derivation.

What to do if you already shared your xpub

If you shared only the xpub and no child private key, the risk is lower: an xpub lets someone view addresses and balances, not spend funds. The problem appears when a non-hardened child private key leaks alongside that xpub.

If you believe both were shared, treat that xpub as compromised: stop using it to derive new accounts and consider moving funds to a new wallet with a new seed. You don't need more detail to understand that xpub no longer protects you.

What this doesn't give you: a procedure to take advantage of it

The framing here is what you're unknowingly exposing when you share an xpub, NEVER how to take advantage of it. We do not give steps or describe a procedure.

Source: BIP-32, seccion Security