Wallet created in testnet available in listwalletdir, bitcoin-qt -> open wallet and can be loaded in mainnet #22792

issue ghost openend this issue on August 24, 2021
  1. ghost commented at 4:46 pm on August 24, 2021: none

    Expected behavior

    Wallet created in testnet should neither be available in listwalletdir nor allowed to be loaded in mainnet,regtest,signet etc. And in general we should not be able to open wallets of other chains/network mode.

    Actual behavior

    Wallet created in regtest, testnet etc. are available in listwalletdir, bitcoin-qt -> open wallet and testnet wallet can be loaded in mainnet

    To reproduce

    1. Run bitcoind -testnet=1 and create a wallet T1

    2. Run bitcoind -regtest=1 and create a wallet R1

    3. Run bitcoind and create a wallet M1

    4. Run bitcoind -datadir=/home/satoshi (Assuming user ‘satoshi’, OS: Ubuntu, real datadir: /home/satoshi/.bitcoin, if trying on Windows root directory can be used in -datadir. Example: “C:”)

    5. Check wallets with listwalletdir

    6. Try to load regtest and testnet wallets in mainnet. R1 will give the following error as expected:

      0error code: -4
      1error message:
      2Wallet loading failed. Wallet files should not be reused across chains.
      

      T1 will give error mentioned in https://github.com/bitcoin-core/gui/issues/369 so I tried unloading this wallet and load. This works although we should not be able to load wallets created in other chain/network mode. I have not tried experimenting more however more things may be possible.

      0$ bitcoin-cli -datadir=/home/satoshi unloadwallet ".bitcoin/testnet3/wallets/T1"
      1{
      2  "warning": ""
      3}
      4$ ./bitcoin-cli -datadir=/home/satoshi loadwallet ".bitcoin/testnet3/wallets/T1"
      5{
      6  "name": ".bitcoin/testnet3/wallets/T1",
      7  "warning": ""
      8}
      

    System information

    Tried with Master Branch and PR#18554 Branch on Pop!_OS

    This issue can result in vulnerabilities if ignored and things are not kept separate IMO. One interesting vulnerability that I remember: https://shiftcrypto.ch/blog/coldcard-isolation-bypass/

  2. unknown added the label Bug on Aug 24, 2021
  3. ghost commented at 6:47 am on August 25, 2021: none
    Just realized there is already a similar issue open since 2019: https://github.com/bitcoin/bitcoin/issues/16107
  4. fanquake closed this on Aug 25, 2021

  5. DrahtBot locked this on Aug 25, 2022


ghost

Labels
Bug


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me