cryptoadvance / specter-diy

DIY airgapped hardware wallet that uses QR codes for communication with the host
MIT License
441 stars 73 forks source link

Annoying attack on segwit transactions #63

Open stepansnigirev opened 4 years ago

stepansnigirev commented 4 years ago

Attack: https://blog.trezor.io/details-of-firmware-updates-for-trezor-one-version-1-9-1-and-trezor-model-t-version-2-3-1-1eba8f60f2dd

We need to either show fee:unknown if non_witness_utxo is not present in PSBT, or store tx history and show a warning if we see the same txid with a different amount.

If non_witness_utxo is present we need to check it and optionally convert it to witness_utxo for signing.

PSBT implementation was ignoring non_witness_utxo because we didn't support legacy transactions. Now we need to add support for them and also properly sign witness transactions when non_witness_utxo is provided.