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

consignment validation succeeds despite changed txid in bundle pubWitness #261

Closed
St333p opened this issue Jul 17, 2024 · 4 comments
Closed
Assignees
Labels
question Further information is requested *security* Issues affecting safety/security (include undefined behaviours)
Milestone

Comments

@St333p
Copy link
Contributor

St333p commented Jul 17, 2024

We are experiencing an issue on the latest master where a modified consignment (attack_bundles_pubWitness_data_txid.yaml in the zip) validates correctly even though it's modified from an otherwise valid consignment (consignment_A.yaml in the zip). The only change in the consignment is the txid of one of the pubWitnesses included in bundles, specifically the one referring to the last transaction in the history. Changing txids for transactions other than the last one correctly leads to a validation error, unless also the corresponding prevout is changed to the same txid, in which case validation succeeds (attack_bundles_pubWitness_data_txid_and_prevout.yaml in the zip).

I would expect validation code to check consistency between transaction data and txid and this indeed used to be the case at least until rgb-core tag v0.11.0-beta.6 (commit cb6892b6).

consignments.zip

@dr-orlovsky dr-orlovsky added this to the v0.11.0 milestone Jul 18, 2024
@dr-orlovsky dr-orlovsky added the bug Something isn't working label Jul 18, 2024
@dr-orlovsky dr-orlovsky self-assigned this Jul 18, 2024
@dr-orlovsky dr-orlovsky moved this to Ready in RGB release v0.11 Jul 18, 2024
@dr-orlovsky dr-orlovsky added question Further information is requested *security* Issues affecting safety/security (include undefined behaviours) and removed bug Something isn't working labels Jul 22, 2024
@dr-orlovsky
Copy link
Member

dr-orlovsky commented Jul 22, 2024

My initial take here is that changing txid affects nothing: txid is generated from the actual transaction data, and the changed value goes nowhere. But I will double-check

@dr-orlovsky
Copy link
Member

If you change a non-terminal id the situation is different though: the id is used spent transaction, and validation breaks.

Also, it is only a terminal transaction which is included in full in the consignment - and thus which txid is re-calculated. The rest of transactions rely on txid to extract them from the indexer (electrum, esplora), and changing them thus leads to validation failure.

Try to cut out that terminal transaction (replacing it with null) - the validation must fail in this case.

@dr-orlovsky
Copy link
Member

Yet still I believe validation much check this: #262

Please try that branch - it should now fail the validation

@St333p
Copy link
Contributor Author

St333p commented Jul 23, 2024

Closing as completed in #262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested *security* Issues affecting safety/security (include undefined behaviours)
Projects
Status: Done
Development

No branches or pull requests

2 participants