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

Fix: invalid consent strings missing legit interest section causes panic #39

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

sebmil-daily
Copy link
Contributor

@sebmil-daily sebmil-daily commented Nov 20, 2023

This PR contains 2 fixes:

  • The bytesRequired amount in parseBitField was incorrectly rounded down which could lead to out of bound issue
  • There was no test before reading at legitIntStart+16 which can create out of bound issues with invalid consent strings

It also adds 3 tests:

  • Validate the correct processing of bytesRequired in parseBitField
  • Proof of concept that allows the previously unfixed code to crash:
    • with a crafted consent string going through the initial parseRangeSection
    • with a crafted consent string going through the initial parseBitField

This PR contains 2 fixes:
* The `bytesRequired` amount in `parseBitField` was incorrectly rounded down which could lead to out of bound issue
* There was no test before reading at `legitIntStart+16` which can create out of bound issues with invalid consent strings

It also adds 3 tests:
* Validate the correct processing of `bytesRequired` in `parseBitField`
* Proof of concept that allows the previously unfixed code to crash:
    * with a crafted consent string going through the initial `parseRangeSection`
    * with a crafted consent string going through the initial `parseBitField`
Copy link
Collaborator

@hhhjort hhhjort left a comment

Choose a reason for hiding this comment

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

LGTM

@bsardo bsardo merged commit b00a67a into prebid:master Nov 28, 2023
@bsardo bsardo changed the title Fix: out of bounds crashes with invalid consent strings Fix: invalid consent strings missing legit interest section causes panic Nov 28, 2023
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.

3 participants