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

CROSS broken sigs validate #1995

Open
baentsch opened this issue Nov 19, 2024 · 5 comments
Open

CROSS broken sigs validate #1995

baentsch opened this issue Nov 19, 2024 · 5 comments

Comments

@baentsch
Copy link
Member

I’ve run the suggested test by @baentsch and noticed that the CROSS signature scheme seems to fail in some cases, passing the verification of modified signatures.

Tagging @rtjk.

Originally posted by @bhess in #1919 (comment)

@rtjk
Copy link
Contributor

rtjk commented Nov 19, 2024

Thank you @baentsch @bhess. I'm looking into this. Am I understanding correctly: if a single byte of a valid signature is changed, CROSS may still accept the modified signature as valid in certain cases?

@bhess
Copy link
Member

bhess commented Nov 19, 2024

Hi @rtjk, this is correct, the issue occurred when incrementing a single random byte of the signature.

@bhess bhess mentioned this issue Nov 19, 2024
8 tasks
@rtjk
Copy link
Contributor

rtjk commented Nov 19, 2024

The arrays that store nodes for the merkle tree and seed tree are fixed in size to a certain upper bound. However, they often end up with a bunch of empty (zero-padded) bytes at the end. It appears these zeros aren't checked during verification, so tampering with them results in a (wrongly) valid signature. Adding a check for these bytes should be straightforward, I’ll discuss this with the team and prepare a PR. Kudos to the liboqs test framework for catching this! By the way, this issue is somewhat related to #1958.

@baentsch
Copy link
Member Author

Kudos to the liboqs test framework for catching this!

I'm afraid that wasn't so good -- but rather my stupid review question followed by diligent trialing by @bhess. I'd suggest you chime in to #1999 to help turn this into something really reliable.

@alexrow
Copy link

alexrow commented Nov 20, 2024

I can confirm what @rtjk said before: the mismatches are arising from the fact that a specific technique (seed trees and Merkle trees) allow to save some signature size but, in turn have a variable length signature. The savings in signature size
are there even when considering the largest possible among the variable lenghts.

To avoid the pains of handling an actual variable-length specification from an engineering standpoint (this is especially troublesome in hardware), in CROSS we're allocating the maximum signature size and zero-padding the unused bytes. We did not check that the padding bytes are actually set to zero (as they are not used in the signature verification process, but, it's a good idea to check them anyway (strictly speaking, it's an EUF-CMA violation, although I cannot see how an attacker can profit from this on the spot).

Thank you very much for the catch @baentsch @bhess !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

4 participants