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

Three out-of-bound pointers (check_certificate_request) #196

Closed
bathooman opened this issue Apr 27, 2023 · 3 comments
Closed

Three out-of-bound pointers (check_certificate_request) #196

bathooman opened this issue Apr 27, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@bathooman
Copy link

Description

  • Type: Out of bound pointer
  • Priority: High
  • The bug affects the develop branch
  • This affects the processing of the messages on the client-side.

How to trigger

image

Upon receipt of a Certificate Request message, if the message is maliciously crafted in a way that the value of the Certificate Types Count and Signature Hash Algorithms Length are not within the boundary of the Fragment Length, three out-of-bound pointer de-reference occurs in the following three points:

  1. https://github.com/eclipse/tinydtls/blob/main/dtls.c#L3529
  2. https://github.com/eclipse/tinydtls/blob/main/dtls.c#L3531
  3. https://github.com/eclipse/tinydtls/blob/main/dtls.c#L3508

My suggestion:

There should always be a check that ensures that the fields that represent the size of fields are within the boundary of data_length.

@boaks
Copy link
Contributor

boaks commented Apr 28, 2023

Thanks a lot for reporting!

I see, this function doesn't obey the already processed bytes by subtracting them from data_length.
And, as you report, the size of the length field must also be obeyed, e.g. in L3510, where data + 1 is used instead of data + sizeof(uint16).

I will provide a fix.

@boaks boaks added the bug Something isn't working label Apr 28, 2023
@boaks boaks mentioned this issue Apr 28, 2023
@bathooman
Copy link
Author

It appears that this bug is fixed in #197. We can close this issue.

@boaks
Copy link
Contributor

boaks commented Sep 28, 2023

Thanks a lot for reporting.
Currently "too many" larger PRs are pending, but I plan to consolidate the parsing in general using the new macros as in PR #198

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants