Use constant-time comparison for OMAPI authentication signature#8
Open
kodareef5 wants to merge 2 commits intoisc-projects:masterfrom
Open
Use constant-time comparison for OMAPI authentication signature#8kodareef5 wants to merge 2 commits intoisc-projects:masterfrom
kodareef5 wants to merge 2 commits intoisc-projects:masterfrom
Conversation
1. common/tree.c: Change new_len from signed int to unsigned int and add UINT_MAX/2 check before doubling. Signed int overflow in the doubling loop is undefined behavior that could cause infinite loop. 2. common/parse.c: Check universe_max > INT_MAX/2 before doubling the option space array. 3. omapip/alloc.c: Check count * sizeof(omapi_addr_t) + sizeof(list) does not overflow size_t before allocation. 4. omapip/array.c: Check (max + delta) * sizeof(char *) does not overflow size_t before array growth allocation. 5. common/options.c:3664: Check length * 4 + 3 does not overflow unsigned int in FQDN option buffer allocation. 6. common/options.c:2738: Check num_opts * 2 does not overflow int in server ORO buffer allocation.
The OMAPI protocol verifies HMAC-MD5 authentication signatures using memcmp(), which returns early on the first byte mismatch. This leaks timing information about how many bytes of the signature are correct, enabling a timing side-channel attack against the OMAPI management interface. Replace with a constant-time XOR accumulation loop that examines all bytes regardless of match position.
Contributor
|
Please use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
omapip/protocol.cline 716 verifies OMAPI HMAC-MD5 authentication signatures usingmemcmp(), which returns early on the first byte mismatch. This leaks timing information about how many bytes of the signature are correct.Replace with a constant-time XOR accumulation loop that examines all bytes regardless of match position. The
volatilequalifier prevents compiler optimization from reintroducing early exit.Builds clean with
-Wall -Werror.