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

ber.go: Protocol Validation and Defense #12

Merged

Conversation

jentfoo
Copy link

@jentfoo jentfoo commented Jul 24, 2023

This PR attempts to address possible panic conditions due to access outside of the bounds of the slice. There are specifically three changes:

  • A couple log messages are commented out due to them attempting to do an out of bounds view into the slice.
  • Existing protocol validation was fixed. There was an attempt to guard against these conditions, however in many cases there was an off by one error, or other conditions had not been considered.
  • A PR from the parent fork which attempts to bring in a protocol fix for lengths between 0x80 and 0xFF was also included as part of this: fix BER tag length check when length is between 0x80 and 0xFF mozilla-services/pkcs7#68

The logic for slice access has been reviewed carefully in an attempt to make sure we are defensive, but still allowing the nuance of the PKCS7 structure. In addition extensive fuzzing has been conducted on these changes.

This was also submitted to the Mozilla fork: mozilla-services#81

This commit attempts to address possible `panic` conditions due to access outside of the bounds of the slice.  There are specifically three changes:
 * A couple log messages are commented out due to them attempting to do an out of bounds view into the slice.
 * Existing protocol validation was fixed.  There was an attempt to guard against these conditions, however in many cases there was an off by one error, or other conditions had not been considered.
 * A PR from the parent fork which attempts to bring in a protocol fix for lengths between `0x80` and `0xFF` was also included as part of this: mozilla-services#68

The logic for slice access has been reviewed carefully in an attempt to make sure we are defensive, but still allowing the nuance of the PKCS7 structure.  In addition extensive fuzzing has been conducted on these changes.
@jentfoo
Copy link
Author

jentfoo commented Jul 31, 2023

Hello! @vanbroup, I am first time contributor to this project, I noticed you helped review some previous PR's. Is this a PR you would be able to help provide feedback on? Thank you!

@vanbroup
Copy link
Member

vanbroup commented Aug 3, 2023

@jentfoo thanks for your PR, as I just returned from vacation, I need some more time to review this request.

@jentfoo
Copy link
Author

jentfoo commented Aug 3, 2023

Sounds good, let me know if you have any questions!

@jentfoo
Copy link
Author

jentfoo commented Aug 15, 2023

@vanbroup Have you had an opportunity to look at this PR? This fix is important to me and I would really love to help contribute to your project. Thank you!

@vanbroup vanbroup merged commit 3a137a8 into digitorus:master Aug 18, 2023
@jentfoo jentfoo deleted the jent/digitorus-protocol_defense branch August 18, 2023 19:51
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