Manifest header wrong comparation between two unsigned values#10
Open
KameleonSec wants to merge 1 commit intoAzure:masterfrom
Open
Manifest header wrong comparation between two unsigned values#10KameleonSec wants to merge 1 commit intoAzure:masterfrom
KameleonSec wants to merge 1 commit intoAzure:masterfrom
Conversation
This is a vulnerability in the manifest_flash.c header parse calculations. Corrupted manifest header results in DOS or much severe implications that might result with a possible RCE. E.g. Manifest header with length=0 cause the code to read the whole flash until crash. After updating a manifest with such malformed header, the system could be bricked. Thus fix the comparation between two unsigned values for detecting a negative value.
chweimer
requested changes
Dec 14, 2021
Contributor
chweimer
left a comment
There was a problem hiding this comment.
There are a few comments on this change:
- When adding/changing code, please be sure to maintain formatting consistency with the existing code. In this particular case, there should be a space following the cast.
- It seems like it would be a better solution here to add an explicit check for the header->length field to ensure it is at least sizeof (struct manifest_header) bytes. If that check is added, there is no problem with the sig_length check as it is currently.
- Code in this repo follows TDD, so this change needs an associated unit test (maybe multiple) in manifest_flash_test exposing this problem, and proving the fix is good.
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.
This is a vulnerability in the manifest_flash.c header parse calculations.
Corrupted manifest header results in DOS or much severe implications that might end with a possible RCE.
E.g. Manifest header with length=0 cause the code to read the whole flash until crash. After updating a manifest with such malformed header, the system could be bricked.
Thus fix the comparation between two unsigned values for detecting a negative value.