OpenSSL Security Advisory – EDIPARTYNAME null pointer de-reference
openssl.org
openssl.org
Seems like the most likely attack vector is having a server check a malicious certificate, which happens automatically in some cases. But not always. And it's unclear what prompts the automatic check in the first place - perhaps the server executing a remote HTTPS request a malicious user specifies?
Thanks in advance!
The conditions are also rather special, it seems the most likely scenario is that you have any software that verifies certificates and automatically checks CRLs and there's a way for an attacker to provide you a bad certificate and a CRL. That's not something that I'd expect to be very common.
The ability to map arbitrary memory is, of course, as you point out, a game-over vulnerability by itself.
Including read vs write, and what the read is used for, yes.
https://www.corelan.be/index.php/2009/07/25/writing-buffer-o...
https://github.com/openssl/openssl/commit/f960d81215ebf3f65e...
I highly doubt that rust would have prevented this.
Rust is not a silver bullet that solves all bugs.
Depends on how it's doing the check. If it has to fetch the CRL from the CRLdp or do OCSP with the OSCP AIA, like CAPI does, then it definitely has to have an error for when certificate revocation status is not available.
Honestly, even if I provide the cert & CRL, it should probably be able to throw an error if either one has invalid ASN.1 encoding or such.
[1]: https://docs.rs/webpki/0.21.4/webpki/struct.EndEntityCert.ht...
It's only by happy coincidence that it manifests cleanly as a segfault. In the C language, dereferencing NULL causes undefined behaviour, so all manner of peculiar things can happen. This isn't just theoretical nit-picking, it can happen with real code:
• Raymond Chen's Undefined behavior can result in time travel (among other things, but time travel is the funkiest), https://devblogs.microsoft.com/oldnewthing/20140627-00/?p=63...
• John Regehr's A Guide to Undefined Behavior in C and C++, Part 1, https://blog.regehr.org/archives/213 (ctrl-f for A Fun Case Analysis)
You get Result< Data T, Error>. And you have to handle Error condition (usually kick it up stack, but it has to be handled somewhere) for it to compile.
What rust wouldn't prevent you from is forgetting to check for revocation, or doing it wrong.
GENERAL_NAME[1] is a struct containing a type tag "enum" and a union of the data (d) for each type. If I'm reading it right the bug here is reading the union as 'other' when the tag says its `GEN_EDIPARTY`.
In rust this would just be a fat enum where the variants of the enum would actually contain the data that this has in the union. Then the Rust compiler would only allow you to read the data as the type it's stored as.
[1] https://github.com/openssl/openssl/blob/13a574d8bb2523181f81...
If you created a combined X.509 + CRL parser fuzzer you might have found it. Probably nobody has done that.
If hardly anyone is using EDIPARTYNAME, maybe support for it should just be dropped? Reject as invalid every certificate containing it? Release a new streamlined version of X.509 with the legacy cruft removed or deprecated?
https://itlaw.wikia.org/wiki/Electronic_Data_Interchange_Per...
Of course you can write translation code at the boundaries between your code and the other code to convert `OtherCode.MightBeNullType` to `OtherCode.MightBeNullType option`, but that still doesn't help for `OtherCode.MightBeNullType`'s fields unless you redefine all the types and write conversion functions for all of them.
And changing that introduces a lot of risk.
It was started in a situation where OpenSSL had bad security practices, a chaotic coding style and plenty of obsolete garbage. None of that is true any more.
If you look at the vuln posted here it's a sign how mature OpenSSL became: They rate it HIGH, but it's a rather insignificant vuln that will barely matter in practice.
OpenSSL is old and supports lots of platforms. Some people need to use OpenSSL because of the platform they're running on. I do hope the situation gets better, and over time we have seen competing TLS libraries replace OpenSSL in more and more places. It's not an easy problem to solve.
Its been a while since I looked, but IIRC, there's some pretty major stuff missing like PKCS11 which means you can't do the CLI smartcard stuff you can do with OpenSSL.
I mean, I wouldn't be surprised if it lets you check a box on PCI checklist; but only people who are forced to use that checklist.
But it's common that if you work with governments that FIPS certification is a requriement.
So yea - great stuff!
It's a pain in the ass at times because it means things like Ed25519 and ECDSA not over NIST certified curves is not allowed...
Some platforms don't have a TLS library, but TLS is sometimes required. Some platforms have an outdated library and no reasonable update method. Some platforms have nasty bugs in their libraries. Some platforms have very inconsistent libraries depending on version. You might want to send extensions the platform library doesn't support (SNI used to be pretty hard to use), or to manage the acceptable CA roots (which I understand you dislike). You might want more control over ciphers, so as not to offer ciphers that are outdated. Having one buggy library you ship with your code is better than dealing with a different buggy platform library for each platform.
I do seem to recall a few OpenSSL advisories in the last few years for which libressl was not vulnerable though.