Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

xmr: payment ID computation fix #426

Merged
merged 1 commit into from
Nov 28, 2018

Conversation

ph4r05
Copy link
Contributor

@ph4r05 ph4r05 commented Nov 27, 2018

Typo in tail differentiating tag caused invalid short payment id encryption. was 0x8B, should have been 0x8D.

Correct computation:

enc_payment_id = payment_id ^ cn_fast_hash(derivation + b'\x8D')

Tail tag 0x8D was mistyped as 0x8B which yields a different hash which is used for XOR.
No funds are lost, but payment ID is incorrect which can cause payment linking problems when using exchanges / markets.

Recipient of the message can recompute the payment ID:

derivation = 8 * view_key_private * tx_key_public
correct_payment_id = enc_payment_id ^ cn_fast_hash(derivation + b'\x8D')

OR from the wrongly decrypted plain payment id:

correct_payment_id = wrongly_decrypted_payment_id ^ cn_fast_hash(derivation + b'\x8D') ^ cn_fast_hash(derivation + b'\x8B')

Demonstration code that decodes payment ID correctly, takes transaction ID and secret view key:

https://gist.github.com/ph4r05/b95c085b101cd9c9ba5dad104dfab007

The PR will be added to the Monero-wallet-cli which will check for firmware version and block transactions with short payment IDs if the firmware version is <=2.0.9. Stay tuned.

Sources:

@ph4r05
Copy link
Contributor Author

ph4r05 commented Nov 27, 2018

Tests fixed too, pls re-run Travis

@ph4r05
Copy link
Contributor Author

ph4r05 commented Nov 29, 2018

Mitigation implemented in monero-project/monero#4839

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants