firoorg / firo

The privacy-focused cryptocurrency
https://firo.org
MIT License
720 stars 354 forks source link

Spark diversifiers can be truncated if invalid #1370

Closed AaronFeickert closed 11 months ago

AaronFeickert commented 11 months ago

When diversifiers in Spark are decrypted, the plaintext data is truncated to fit a uint64_t. However, an adversary could have encrypted a value exceeding this (but not exceeding the AES block size), in which case any higher bits are discarded.

This should be modified. If the decrypted diversifier does not represent a valid 64-bit unsigned integer, it should be rejected as invalid.