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

Out-of-bounds memory read in 192 branch when N=24 #24

Open
wants to merge 2 commits into
base: 192
Choose a base branch
from

Conversation

alexloney
Copy link

When a keypair is generated with N=24 (e.g. LMS_SHA256_N24_H15/LMOTS_SHA256_N24_W4), the public key generated is of size 4 + (8 + 16 + 24) = 52 bytes.

When the function hss_validate_signature_init() begins, it moves the signature pointer up 4 bytes then attempts a memcpy which copies 8 + 16 + 32 = 56 bytes, the signature is currently pointing to 52 - 4 = 48 bytes of memory. This causes an out-of-bounds memory read of 56 - 48 = 8 bytes.

The 8 extra bytes that are read aren't actually used for anything (as far as I'm able to tell), so I don't think it would cause any functional issues to exist, but it is an out-of-bounds memory access which shouldn't occur.

This PR resolves this by using the actual value of n which was computed from the lm_ots_look_up_parameter_set() call to determine the size of data to copy with memcpy().

…y 8 bytes, by using the parameter N, we can correctly determine the length to copy from the public key value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant