Skip to content

Conversation

@KameleonSec
Copy link
Contributor

@KameleonSec KameleonSec commented Sep 26, 2021

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.

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.
Copy link
Contributor

@chweimer chweimer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few comments on this change:

  1. 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.
  2. 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.
  3. 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.

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.

2 participants