Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid PSBT? (bip143 sighash vulnerability; coldcard psbt root fingerprint and derivation prefix missing) #6270

Open
jlopp opened this issue Jun 25, 2020 · 5 comments
Labels
hw-coldcard topic-transactions 📑 related to logic in transaction.py

Comments

@jlopp
Copy link

jlopp commented Jun 25, 2020

Running Electrum master branch commit a95738f on Debian 10

Create a 2-of-3 p2sh-segwit wallet on testnet
First device: Trezor One at path m/49/1/3
Second device: pasted in Upub of Coldcard Mk3
Third device: pasted in Upub of Ledger Nano S

I created a transaction to sweep the wallet funds and send back to a new receive address. Plugged in the Trezor One and successfully signed. For second signature I want to sign airgapped via coldcard. So I choose "Export, for hardware device, include xpubs" and save the file to my MicroSD card which I then put in my coldcard.

Worth noting that my coldcard is set to testnet mode and has "Trust PSBT" enabled. When I try to sign, I see a generic error:

Failure
Invalid PSBT
psbt.py:1018

So I go back to Electrum and "Export, for hardware device, include xpubs" and copy to clipboard to get the following:

cHNidP8BAM4CAAAABKL4z24LxtkblKz1xz1awMl1KnmONA9aWfB54ZQedpC1AAAAAAD9////ovjPbgvG2RuUrPXHPVrAyXUqeY40D1pZ8HnhlB52kLUBAAAAAP3///+i+M9uC8bZG5Ss9cc9WsDJdSp5jjQPWlnweeGUHnaQtQIAAAAA/f///6L4z24LxtkblKz1xz1awMl1KnmONA9aWfB54ZQedpC1AwAAAAD9////AUQb5gUAAAAAF6kU+6rKXckeFXyXscQbOcYBiSYJnROHeBAbAE8BAkKJ7wAAAAAAAAAAALefp7Th7e8GjzqSJxTSeuY+/C8eN6FrV4jstLnaGTdbAhFFW5IPmVE4+BVmHuseCZsovMCPQOqYDjoD/4rQlUp8BHOrJK5PAQJCie8AAAAAAAAAAACV5vFb9dRX4abGXHGDUdlNBpNZ4vFg1b5jvrxst/gjxANsXb+Z66UBtNKKq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VMI/z51oDDk3WKgKp4FPaIQ3magAQEEIgAgtNw7e2OqOBNxKJBLzH0OfSfzhh5YIC2U6efwW2/c9ZgBBWlSIQIXLs/LmPtDhWCf27XOw3A9+XUhp7WcKZPCuZp5YbNKrSECu3gn8XUezFyeeARNsYT2FX46I0lVwJ6EG6HCYWeIuJMhA8uPpUlqAR25IWBeoSdBN5LuzdtaESb9IBySYdk/OsivU64iBgIXLs/LmPtDhWCf27XOw3A9+XUhp7WcKZPCuZp5YbNKrQx2vkcpAAAAAAMAAAAiBgK7eCfxdR7MXJ54BE2xhPYVfjojSVXAnoQbocJhZ4i4kxjf/Qc0MQAAAAEAAAADAAAAAAAAAAMAAAAiBgPLj6VJagEduSFgXqEnQTeS7s3bWhEm/SAckmHZPzrIrwxzqySuAAAAAAMAAAAAAQAiACCaB60qnRtaJa9CYDGMmu4x561FPpeV6C/8ZYIF2hbx0gEBaVIhArToUGbe3FFTvLd3DoTTrfSbcUnyds6y0ilMXXupd+OiIQLV94gO2FYJgXBy3vtG6N6+VXPIe00O1uSaChxRARxJOCEDLL38h63QKDtCHsWVQFYgtAtK2/LTdqMVoqemmcaeAdpTriICArToUGbe3FFTvLd3DoTTrfSbcUnyds6y0ilMXXupd+OiDHOrJK4AAAAABAAAACICAtX3iA7YVgmBcHLe+0bo3r5Vc8h7TQ7W5JoKHFEBHEk4DHa+RykAAAAABAAAACICAyy9/Iet0Cg7Qh7FlUBWILQLStvy03ajFaKnppnGngHaGN/9BzQxAAAAAQAAAAMAAAAAAAAABAAAAAA=

I then try to decode it via $ bitcoin-cli decodepsbt and get the following output:

error code: -22
error message:
TX decode failed PSBT is not sane.: iostream error
@jlopp
Copy link
Author

jlopp commented Jun 25, 2020

If it's failing at https://github.com/Coldcard/firmware/blob/master/shared/psbt.py#L1018

It seems the Coldcard isn't one of the xpubs involved in the PSBT, but it indicates the PSBT could be decoded
I think there might be two problems here:

  1. The Electrum export of the PSBT is not formatted properly
  2. The Electrum PSBT could be missing signer information the coldcard expects, thoug I have "trust PSBT" enabled to hopefully mitigate such problems

@SomberNight
Copy link
Member

I think there might be two problems here:

yes indeed.

  1. The Electrum export of the PSBT is not formatted properly

Unfortunately Electrum PSBTs are currently not compatbile with Bitcoin Core, due to us already having a mitigation for the bip143 sighash issue (CVE-2020-14199), see #6257
This will get resolved with bitcoin/bitcoin#19215

  1. The Electrum PSBT could be missing signer information the coldcard expects, thoug I have "trust PSBT" enabled to hopefully mitigate such problems

Yes, we are missing info because we only have the xpub for the coldcard cosigner, see
#5969 (comment)

@SomberNight SomberNight changed the title Invalid PSBT? Invalid PSBT? (bip143 sighash vulnerability; coldcard psbt root fingerprint and derivation prefix missing) Jun 25, 2020
@SomberNight SomberNight added hw-coldcard topic-transactions 📑 related to logic in transaction.py labels Jun 25, 2020
@SomberNight
Copy link
Member

SomberNight commented Jun 25, 2020

we are missing info because we only have the xpub for the coldcard cosigner

I think in practice, atm, coldcard as part of a multisig might only work if the wallet file was created while the coldcard was usb connected (i.e. not just added as an xpub) - although I can never remember exactly what those on-device settings do (e.g. "trust psbt").

To allow fully airgapped use, we need a way to communicate the missing info packed with or into the xpub.
e.g. #5715 (comment)
I think we might end up doing what's in that comment unless some standard emerges.

For now, if the user is technically inclined, they can feed the missing info using the Qt Console:
e.g.

wallet.get_keystores()[2].add_key_origin(derivation_prefix="m/48h/1h/0h/2h", root_fingerprint="deadbeef")

EDIT: apparently there might be a way to generate an electrum wallet file even for the multisig case on the coldcard device itself - in which case that might work as well.

@aaronisme
Copy link
Contributor

probably not quite related to this issue, but I think there should be some kind of "standard" for the xpub which including more info. currently, we are implementing the psbt multi-sign on Cobo Vault. but currently, the only way to do multo-sign with ColdCard is to generate the wallet file from ColdCard(ColdCard do need the xpub info to do verification)

@lucasmoten
Copy link

I'm able to successfully cal bitcoin-cli decodepsbt on the base64 with Bitcoin v0.20.1

The original error for Invalid PSBT reported by the coldcard firmware, seems to imply that of the xpubs data in the export, none of it matches the coldcard. https://github.com/Coldcard/firmware/blob/2020-06-13T1928-v3.1.5/shared/psbt.py#L1018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hw-coldcard topic-transactions 📑 related to logic in transaction.py
Projects
None yet
Development

No branches or pull requests

4 participants