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

Added advisory for undefined behavior in openssl #2021

Merged
merged 1 commit into from
Jul 21, 2024
Merged

Conversation

alex
Copy link
Member

@alex alex commented Jul 21, 2024

No description provided.

@Shnatsel
Copy link
Member

Is the length of the slice attacker-controlled? If not, I would rather file this as informational = unsound.

Also, this makes me wonder if there are any other similarly problematic calls to slice::from_raw_parts in the codebase that should be fixed before we publish an advisory, so that users could upgrade all at once instead of getting several different notifications.

@alex
Copy link
Member Author

alex commented Jul 21, 2024

This API is used all over the place, there's at least a few places where the string length will be attacker controlled, yes.

And there may be others, I filed this before doing the variant analysis.

@Shnatsel
Copy link
Member

There's about a dozen places where a slice is constructed from raw parts:

https://github.com/search?q=repo%3Asfackler%2Frust-openssl%20slice%3A%3Afrom_raw_parts&type=code

Perhaps we should just wrap all of them in a helper function that explicitly checks for the zero length, just in case?

@alex
Copy link
Member Author

alex commented Jul 21, 2024

It's not a bad idea, a quick review gives me a few that I'm skeptical of (but which I don't have a PoC for), and most of them aren't problems or already have checks.

@alex
Copy link
Member Author

alex commented Jul 21, 2024

Ok, on further review (and reading OpenSSL's code) I don't see any others that should be able to trigger UB.

It may still be worth it to have a utility function that handles this case as a best practice, but I don't think it needs to block this advisory.

@Shnatsel
Copy link
Member

Could you open a PR to refactor them with a helper function with a zero check then? And after that I'd be happy to publish an advisory once that's released to crates.io. Since it's not clear how one would go about exploiting this, I wouldn't want to publish a non-actionable advisory, or several different advisories.

@alex
Copy link
Member Author

alex commented Jul 21, 2024

sfackler/rust-openssl#2268 has the refactor, but I'm not going to do another release for this in the absence of any way to trigger this issue.

@Shnatsel Shnatsel merged commit 627aa62 into main Jul 21, 2024
1 check passed
@alex alex deleted the alex-patch-2 branch July 21, 2024 17:27
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