<p>From a technical perspective, that statement is wrong. Obtaining the xpub alone is merely exposing all public keys, both past and future. <em>However</em>, as stated <a href="https://bitcoin.stackexchange.com/a/107649/1137">here</a>, if an attacker could also obtain any single private key derived from that non-hardened path, they can obtain <em>all</em> other private keys associated with that xpub!</p>
<p>My guess however is that the quote actually means the possibility of a hacker swapping Gabriel's xpub with their own without anyone noticing for a while, thus getting paid in Gabriel's stead (as Juha also noted in their answer)</p>

CC BY-SA 4.0
2024-02-28T06:44:37.127Z
Thanks all! From a technical perspective, i also think this statement is wrong.
fa william
CC BY-SA 4.0
2024-02-28T02:15:35.853Z
2024-02-28T02:15:35.853Z
Tobias Kienzler
<p>For websites selling goods for bitcoin it is a common practice to use xPub to derive a new address for each customer. This has two benefits 1) using a fresh address protects the merchants privacy as tracking the funds is harder and 2) handling orders becomes much easier as each individual order has the bitcoin address as a unique identifier.</p>
<p>It is true that even if the xPub gets leaked, the hacker wont be able to use any of the funds. But he will be able to see past and future generated addresses and can monitor any and all traffic in the wallet.</p>
<p>If the website gets hacked there are ways for the hacker to steal bitcoin intended for the merchant. For example the hacker might change the website's xPub to his own, so all of the future transactions end up in the hackers wallet instead of the merchants. What the book is pointing out is that in a case of a hack, using the xPub it is impossible to steal any bitcoins that were sent before the hack.</p>

CC BY-SA 4.0
2024-02-28T02:17:29.387Z
I also think your last paragraph is a possible interpretation of the quote. Just a note though, an exposed xpub plus any single private key can be used to obtain all private keys of that xpub
Tobias Kienzler
CC BY-SA 4.0
2024-02-27T07:30:56.643Z
2024-02-27T07:30:56.643Z
Juha Siivikko
<p>In book titled &quot;Mastering bitcoin&quot; 3th edition, on page 114, there is a sentence as below.</p>
<p><em>Gabriel’s website does not contain any private keys and therefore any hack of it can only steal the funds Gabriel would have received in the future, not any funds he received in the past.</em></p>
<p>I think hacker can not steal the funds received in the past and the future.</p>
<p>thanks！</p>

<bip32-hd-wallets><xpub><website-integration><mastering-bitcoin>
How can a hacker steal the funds received in the future when there is only an xpub on the server?
fa william
# How can a hacker steal the funds received in the future when there is only an xpub on the server?

(Asked by: username_0 on 2024-02-27)

In book titled "Mastering bitcoin" 3th edition, on page 114, there is a sentence as below.

*Gabriel’s website does not contain any private keys and therefore any hack of it can only steal the funds Gabriel would have received in the future, not any funds he received in the past.*

I think hacker can not steal the funds received in the past and the future.

thanks！

**Tags:** bip32-hd-wallets, xpub, website-integration, mastering-bitcoin


---

## 2 answers

### Answer by username_2 on 2024-02-27. Score: 4 | Accepted answer

For websites selling goods for bitcoin it is a common practice to use xPub to derive a new address for each customer. This has two benefits 1) using a fresh address protects the merchants privacy as tracking the funds is harder and 2) handling orders becomes much easier as each individual order has the bitcoin address as a unique identifier.

It is true that even if the xPub gets leaked, the hacker wont be able to use any of the funds. But he will be able to see past and future generated addresses and can monitor any and all traffic in the wallet.

If the website gets hacked there are ways for the hacker to steal bitcoin intended for the merchant. For example the hacker might change the website's xPub to his own, so all of the future transactions end up in the hackers wallet instead of the merchants. What the book is pointing out is that in a case of a hack, using the xPub it is impossible to steal any bitcoins that were sent before the hack.

> **Comments:**
> **username_1**: I also think your last paragraph is a possible interpretation of the quote. Just a note though, an exposed xpub plus any single private key can be used to obtain all private keys of that xpub  

---

### Answer by username_1 on 2024-02-28. Score: 0

From a technical perspective, that statement is wrong. Obtaining the xpub alone is merely exposing all public keys, both past and future. *However*, as stated [here](https://bitcoin.stackexchange.com/a/107649/1137), if an attacker could also obtain any single private key derived from that non-hardened path, they can obtain *all* other private keys associated with that xpub!

My guess however is that the quote actually means the possibility of a hacker swapping Gabriel's xpub with their own without anyone noticing for a while, thus getting paid in Gabriel's stead (as username_2 also noted in their answer)

> **Comments:**
> **username_0**: Thanks all! From a technical perspective, i also think this statement is wrong.  

---

