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 a series of security issues #1854
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
482575b
Resolve an injection vulnerability in SAN creation
alex 332311b
Resolve an injection vulnerability in EKU creation
alex 78aa9aa
Always provide an X509V3Context in X509Extension::new because OpenSSL…
alex a752805
Document the horror show
alex 6ced4f3
Fix race condition with X509Name creation
alex File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, if we want to avoid null pointer and initialize the ctx, why not using
MaybeUninit
instead ofmem::zeroed
based on the description in documentation:Even though ctx is not a reference here, it is still better to use
MaybeUninit
, isn't it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably using
MaybeUnit
consistently would be better, yeah. Would you like to submit a PR to do so?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to do it, but I am still a bit confused about the root cause.
If I understand correctly, null ptr dereference happens because
context
was sent to C functionffi::X509V3_EXT_nconf
as a null mutable pointer. However, based on the codebase ofopenssl
crate, it is a common behavior to passnull_ptr
directly to the C function.I believe there could be another null pointer deref issue hidden in the crate. Is there any suggestion to avoid such issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The null-pointer derefs are inside of OpenSSL, it wasn't a crash in Rust itself. The problem is that some extensions require a context value, but others allow null just fine.
There's test cases for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think my description was not precise enough. "dereference" part was in OpenSSL(C), and "null-pointer" part was led by
None => null_mut
in Rust itself.However, what I am confused is that: Why is it Rust's responsibility to fix the bug? null-pointer derefs happened in C code, then
X509V3_EXT_nconf
should check whether context value is null for some extensions, isn't it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a safe Rust function. It should not be possible to cause a null pointer deref from calling it.