OpenSSL 3.0.7 fixes X.509 email address buffer overflows
openssl.org
openssl.org
Fixed two buffer overflows in punycode decoding functions. A buffer overrun can be triggered in X.509 certificate verification, specifically in name constraint checking. Note that this occurs after certificate chain signature verification and requires either a CA to have signed the malicious certificate or for the application to continue certificate verification despite failure to construct a path to a trusted issuer.
In a TLS client, this can be triggered by connecting to a malicious server. In a TLS server, this can be triggered if the server requests client authentication and a malicious client connects.
An attacker can craft a malicious email address to overflow an arbitrary number of bytes containing the . character (decimal 46) on the stack. This buffer overflow could result in a crash (causing a denial of service). ([CVE-2022-3786])
An attacker can craft a malicious email address to overflow four attacker-controlled bytes on the stack. This buffer overflow could result in a crash (causing a denial of service) or potentially remote code execution depending on stack layout for any given platform/compiler. ([CVE-2022-3602])
-----------------------------------
Doesn't sound that critical to me. CAs normally don't let you outright construct your own certificate, and I'd expect you'll have a hard time to get a certificate issued which is both for mail encryption (so you get an email name constraint) and TLS (SAN constraint). And servers without TLS client authentication, which is about 99.99 % of them, aren't affected. TLS client auth is usually only used in enterprise networks and typically terminated by middleboxes running ancient software anyway.
### Changes between 3.0.6 and 3.0.7 [1 Nov 2022]
* Fixed two buffer overflows in punycode decoding functions.
A buffer overrun can be triggered in X.509 certificate verification,
specifically in name constraint checking. Note that this occurs after
certificate chain signature verification and requires either a CA to
have signed the malicious certificate or for the application to continue
certificate verification despite failure to construct a path to a trusted
issuer.
In a TLS client, this can be triggered by connecting to a malicious
server. In a TLS server, this can be triggered if the server requests
client authentication and a malicious client connects.
An attacker can craft a malicious email address to overflow
an arbitrary number of bytes containing the `.` character (decimal 46)
on the stack. This buffer overflow could result in a crash (causing a
denial of service).
([CVE-2022-3786])
An attacker can craft a malicious email address to overflow four
attacker-controlled bytes on the stack. This buffer overflow could
result in a crash (causing a denial of service) or potentially remote code
execution depending on stack layout for any given platform/compiler.
([CVE-2022-3602])
*Paul Dale*would be glad if someone could clarify whether openssh has this vulnerability?
OpenSSH only links to OpenSSL for the cryptographic primitives. SSH and SSL are different protocols.
I agree; and it looks like the developers have had a change of heart as this is apparently only being categorized as "high" rather than "critical" severity now.
https://www.openssl.org/blog/blog/2022/11/01/email-address-o... has
Q: The 3.0.7 release was announced as fixing a CRITICAL vulnerability, but CVE-2022-3786 and CVE-2022-3602 are both HIGH. What happened to the CRITICAL vulnerability?
A: CVE-2022-3602 was originally assessed by the OpenSSL project as CRITICAL as it is an arbitrary 4-byte stack buffer overflow, and such vulnerabilities may lead to remote code execution (RCE).
During the week of prenotification, several organisations performed testing and gave us feedback on the issue, looking at the technical details of the overflow and stack layout on common architectures and platforms.
Firstly, we had reports that on certain Linux distributions the stack layout was such that the 4 bytes overwrote an adjacent buffer that was yet to be used and therefore there was no crash or ability to cause remote code execution.
Secondly, many modern platforms implement stack overflow protections which would mitigate against the risk of remote code execution and usually lead to a crash instead.
So for some people, this still is a critical vuln. Is there a list of people for whom this is still urgent?
They're still doing a CVE and publishing a fix, they're just calling it HIGH and not CRITICAL (definition at https://www.openssl.org/policies/general/security-policy.htm...). More on their categorization, from when they decided to break CRITICAL out of HIGH: https://www.openssl.org/blog/blog/2015/09/28/critical-securi...
* CRIT - Wake an engineer up at 3 AM to apply the patch.
* HIGH - Apply the patch in the next 24 hours.
* MEDIUM - Apply the patch in the next week.
* LOW - Apply the patch in the next month.
I'm making these time frames up, but I'm doing it to illustrate a point: different vulnerabilities have different priority levels. If you consider EVERY VULNERABILITY IN EVERY PACKAGE TO BE AN EMERGENCY then your on-call engineers aren't going to get a lot of sleep, and they'll probably find work somewhere less alarmist. Library maintainers like OpenSSL provide these severity levels to assist you in that prioritization game. If you don't trust them, which might be warranted in some systems, that's fine; you can always read every single CVE for every package yourself (or pay someone to do so).
* CRIT - The CEO called my boss and asked if we were patched yet, so I will be working 16 hour days until it's patched, even if the vuln can't be exploited
* HIGH - My boss told his bosses we have a deadline of other work to meet, so I have until the end of next week
* MEDIUM - Put it in the backlog
* LOW - We will upgrade or sunset the product before it gets patched
The panic set in over the weekend as managers decided to issue major panic stations, bronze and silver bridge calls, etc - after it had reached the more general press.
Told them to f-off, public facing servers had been automatically patched, most of the rest manually done and triaged.
- There are limited resources (time and money)
- Which of the other seemingly urgent things also need to be done?
If you don't differentiate between finer-grained severities, then you won't be able to differentiate or triage between existential threats, and something that can hurt and be ok. And probably more controversially for people who don't know Go, sometimes you accept losses in order to capture greater gains elsewhere.
No action will always guarantee a risk-free decision, so this is about managing or mitigating risk, rather than become risk-free. There are the risks that are statutory, and therefore requires compliance in order to stay legal. And then there are the risks that are not legal, and depends upon an organization's appetite for risk. Risk is something that is always present in some form (we don't have perfect-information for every decision we want to make, let alone know all of the available choices), so it is up to each individual organization and individual to make. Being able to differentiate between severity allows an organization to weigh risk against cost, time, and opportunity.
And if we want to eliminate this whole class of problems (like stack overflow), we could also look at using something like rust instead.
And that's also not getting into nation-state actors sabatoging standards so that vulnerabilities in OpenSSL keep popping up.
In this particular case, the response my team is doing is inventorying our existing systems to find anything using OpenSSL 3.0.x, and therefore vulnerable. So far, all the systems we have found are using OpenSSL 1.1.1 ... as is probably the case for most organizations.
The reason to have these descriptions is to assess whether this threat applies to you. If I were in another position I would care a lot, but I'm not.
I'll likely patch anyways because this bug may end up being a useful primitive in a larger chain of bugs (kinda doubt it tho tbh), and for me patching is not hard, but at scale, given this threat model, I would not necessarily trigger an out of cycle patch.
i mean it’s not far from the truth. do i wake up early on release day and rush out a manual patch, or do i do nothing and observe it to be fixed 1-2 days from now when my OS vendor ships an updated openssl in the course of business-as-usual?
what kind of environment are you in where you’re keeping up with CVEs but don’t care about their categorization?
Would I have preferred to not deal with it on this holiday? Yes. But I prefer to be safe than sorry, and the OpenSSL team is doing their best to help us be to safe.
When was the last time you had to deal with such an issue, where a HIGH vuln was announced as a CRITICAL one?
Do you shut systems down proactively? Revoke certs for hosts running the old version? Change network access protocols to require the new version? All those decisions have measurable costs, and in practice "we believe this is unexploitable on the OS version you are running" is going to change the decision for some users.
> This code was first introduced in OpenSSL 3.0.0. OpenSSL 1.0.2, 1.1.1 and other earlier versions are not affected.
> We did release an update to OpenSSL 1.1.1, namely 1.1.1s, also on 1st November 2022, but this is a bug fix release only and does not include any security fixes.
Shouldn't fuzzing have caught this at some point? I was under the impression that OpenSSL was being fuzz tested constantly since Heartbleed.
[1] https://www.openssl.org/blog/blog/2022/11/01/email-address-o...
Eventually, yes. Unfortunately, fuzzing is usually nondeterministic/pseudorandom so it won't necessarily go down the path that leads to the bug soon enough.
To catch this they would've needed to make a specific fuzzing setup where the process prepared random certificates that are THEN signed and passed further and make the fuzzer short-circuit anything where the random cerificate failed the signing to actually test verification.
The size of the code base is also just daunting and a security risk in itself.
We have released LibreSSL 3.6.1, which will be arriving in the
LibreSSL directory of your local OpenBSD mirror soon.
It includes the following fixes:
- Custom verification callbacks could cause the X.509 verifier to
fail to store errors resulting from leaf certificate verification.
Reported by Ilya Shipitsin.
- Unbreak ASN.1 indefinite length encoding.
Reported by Niklas Hallqvist.
- Fix endian detection on macOS
Reported by jiegec on GithubQ: Are all applications using OpenSSL 3.0 vulnerable by default?
A: Any OpenSSL 3.0 application that verifies X.509 certificates received from untrusted sources should be considered vulnerable. This includes TLS clients, and TLS servers that are configured to use TLS client authentication.
Q: Are there any mitigations until I can upgrade?
A: Users operating TLS servers may consider disabling TLS client authentication, if it is being used, until fixes are applied.
A: Users operating TLS servers may consider disabling TLS client authentication, if it is being used, until fixes are applied.
Paraphrasing... A: if you depend on mutual TLS; no.
> Note that this occurs after certificate chain signature verification and requires either a CA to have signed the malicious certificate or for the application to continue certificate verification despite failure to construct a path to a trusted issuer.
There is a separable question of whether your service trusts certificates issued by a CA that might produce a certificate with a SAN of the necessary form to trigger the exploit.
Am I missing something?
https://github.com/openssl/openssl/commit/3b421ebc64c7b52f1b...
A one character change.
Ubuntu packages are built with stack protector, reducing the
impact of this CVE from remote code execution to a denial of
service.
-- https://ubuntu.com/security/CVE-2022-3602Does anyone know when Ubuntu might ship the fix?
But of course THEY don't want to run the audit (sounds too much like work!) so they contract the audit out to a third-party that builds a database saying which versions of various software are vulnerable according to these CVEs. Of those, these contractors don't actually understand how Linux distributions are put together and their scanners _always_ flag fully patched and up-to-date machines as being vulnerable to X, Y, and Z.
And then I have to explain that their scanners are broken by virtue of using a cheap-to-get value (the version number) as a totally inadequate proxy for something else (exposure to a vulnerability) when the two have only a weak to no actual correlation in real life. And then they shut up. Until the next audit comes around...
This is in any case notwithstanding the fact that the detection is in the base image of a Docker container from a vendor that confirms they don't use OpenSSL; and that said container runs in a context where the only TLS services it faces off to are run by AWS.
It depends on which software is used and how scans are done.
For (e.g.) Nessus, if all it does a port/protocol scan, and something like "OpenSSL 3.0.2" is reported in the Apache/web server string, then it is going to get flagged.
But you can set up "authenticated scans" where Nessus can go in as a (non-privileged) user and get a package listing. It then has a list of CVEs for each distro, which distro packages are vulnerable, and in which version the CVE was fixed in: you get a report saying "Package X is vulnerable because you are running Version a.b.c; please install Version a.b.c_foo1 to fix".
Run a yum/apt-get update to pull in the newest package(s) and vulnerability is cleared on the next scan after the _foo1 patched package is running.
The fact that your auditors (a) are using crappy scanning software, (b) do not know how to use it, and/or (c) the scanners cannot / are not allowed to login to get package versions, does not mean that auditing is inherently bad or useless.
For instance, plenty of upstream software never even releases security fixes in older versions, yet distributions might be committed to supporting them for 5 or 10 years in their LTS releases.
The only universal solution to this is back-porting: it reduces the risk of exposing LTS release customers to backwards compatibility issues, but increases the risk of a bad patch slightly.
If upstreams cared about the things distro customers cared about too (don't break my stuff I haven't changed), it would be much easier to put the blame solely on distros, but they don't.
$ patchinfo openssl
3.0.6 LTS
Patches:
Cve-2022-xxx
Cve-2022-xxx
Etc
Introducing a new tool will only add another on top of the existing tools, when nothing tells us that people will use it! (plug the xkcd on n standards -> fix with a better standard -> n +1 standards)
Basically, you want to make everyone use a single tool when humans always strive to build something better or just different :)
The best we could hope to achieve is to have the CVE MITRE database start accepting "patched in" strings from all the distributors (so as Ubuntu pushes a signed and patched package to the archive, it pings the CVE db with a new version string for eg. Ubuntu-22.04 namespace).
Even that gets tricky with dependencies and issues covering multiple packages ("this is only patched if you've updated both of these"), though that's a technically solvable problem.
I also think that you’re probably right we the patched in, it’s not infinitely scalable, but I doubt it needs to be anyway
At one point I was managing a fork of OpenSSL 0.9.7 for an OS version and in order to communicate what vulnerabilities were fixed, we appended the list of CVEs to the version string. The line grew to hideous dimensions as you can imagine.
Edit (28 minutes later): I got the update now. Many thanks to Marc Deslauriers for his work!
If you are using an APT mirror, you might not see the update yet. Consider adding `deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted` to `/etc/apt/sources.list` to get the updated package
Firstly, we had reports that on certain Linux distributions the stack layout was such that the 4 bytes overwrote an adjacent buffer that was yet to be used and therefore there was no crash or ability to cause remote code execution.
Secondly, many modern platforms implement stack overflow protections which would mitigate against the risk of remote code execution and usually lead to a crash instead.
However as OpenSSL is distributed as source code we have no way of knowing how every platform and compiler combination has arranged the buffers on the stack and therefore remote code execution may still be possible on some platforms.
If OpenSSL is written in Rust, to what extent will the vulnerabilities be reduced (assuming that Rust is supported by the host, of course)?
Stay tuned for the next buffer overflow, use after free, and another easily preventable problem. We will run out of CVE numbers soon thanks to OpenSSL.
If there only were well-known solutions to this problem. Like programming languages that restrict what you can do in terms of memory management... Like Rust.
But hey, don't get distracted by automated memory management solutions, we are too busy fixing memory management problems manually.
I don’t know Rust, and I love C, but we’re well past the point where one can reasonably argue that careful use of C is good enough.
https://access.redhat.com/security/vulnerabilities/RHSB-2022...
> Can you imagine that 10 years ago, a paper came out called "The most dangerous code in the world: validating SSL certificates in non-browser software". And today we're still getting X.509 critical vulnerabilities in OpenSSL (https://crypto.stanford.edu/~dabo/pubs/abstracts/ssl-client-...)
rough afternoon ahead
Did they handroll their own decoder, or did they use the reference code [0] in the RFC?
This is definitely far from Heartbleed level of catastrophe.
https://github.com/NCSC-NL/OpenSSL-2022/blob/main/software/R...
Ubuntu v22.04 is vulnerable, but any before it is not. Debian is good (except bookworm which is currently in testing), Fedora (<36) is good, RHEL/CentOS (<9), Arch...
So on top of being not as serious as Heartbleed, servers that are a bit longer in operation (but still well within their support cycle) don't need patching.
https://github.com/NCSC-NL/OpenSSL-2022/tree/main/software
EDIT just to add this quote from their blog post (https://www.openssl.org/blog/blog/2022/11/01/email-address-o...):
> We did release an update to OpenSSL 1.1.1, namely 1.1.1s, also on 1st November 2022, but this is a bug fix release only and does not include any security fixes.
Surprisingly enough, Arch Linux, a rolling release distro, still hasn't. It's a real mixed bag.
As a client, you're only affected if you connect to a malicious server.
What is the minimum failure of any CA required for me to get popped? If some malicious actor goes through the effort to get me, how many other clients/servers on the internet can get from the same CA breach / malicious cert?
How would you know to un-trust a CA you already trust until after the incident (a malicious certificate issued) had already happened? Even if the incident happened, someone still needs to alert you to un-trust the CA involved. That takes time.
History of mistakes / bad decisions by cert authorities: https://sslmate.com/resources/certificate_authority_failures
> who is issuing certificates some lunatic wrote nonsense into, but which you trust
Do you know every CA your OS and each browser trusts out of the box? Have you done an audit of each one of them? Does an audit 100% prevent a breach from happening in the future?
What are the odds that their policies are perfectly followed every time and that no employee in the right place can be bribed/blackmailed?
Remember Cert Authorities are watering holes. Almost all of the internet trusts a few of them. By breaching one (which may be very significant, either technically or reputationally), the payoff can be massive.
They need to issue an intermediate with this weird constraint, for most CAs that's a major business decision, maybe bringing in auditors to witness the ceremony, and then it's advertised, which seems like we'd go "Er, why does it have this really strange constraint" and the jig is up.
> Do you know every CA your OS and each browser trusts out of the box?
Yes.
> Have you done an audit of each one of them? Does an audit 100% prevent a breach from happening in the future?
No, I have not performed an audit of any public CAs. My observation, over years more and less actively overseeing the Web PKI (sometimes as a contributor to m.s.d.policy) is that the CAs are on the whole not malevolent but they're sometimes incompetent and lazy, like most humans.
I think you're imagining this is an end entity certificate needed, but the end entity certificate isn't interesting here, OpenSSL is (mis)parsing data from an intermediate, the end entity certificate is just a trigger and not an interesting one. I don't see any way you could get such a "trigger" certificate from Let's Encrypt, but I wouldn't expect it's hard to buy something suitable from a for-profit CA, however the problem is that there's no malformed intermediate to act as the explosive for you to detonate.
https://github.com/NCSC-NL/OpenSSL-2022/blob/main/software/R...
rustls has C bindings these days: https://github.com/rustls/rustls-ffi
I've started work on Python bindings too, with the idea that it probably wouldn't be crazy hard to do something that can pass as an `ssl.SSLSocket`. Please sponsor me on GitHub if that's something you'd like to use (https://github.com/sponsors/djc).
Note, we're aware that by far the biggest impediment to adopting rustls is the lack of support for IP addresses in certificates (we currently need a DNS name). This work is funded and should be completed in the next few months.
So much undefined behavior - more than C! /s
Edited to reflect sarcasm as rustaceans apparently can't infer it.
See also this recent blog post:
edit: clarity
This is not quite accurate; there is no upper limit to the number of bits in a char (except for INTMAX_MAX, perhaps), but it cannot have any fewer than 8 bits, including a possible sign bit.
For 'char', it must at least support the range 0 to 127 (and in addition, it must have the same range as either 'unsigned char' or 'signed char').
In particular, does it support all the common crypto accelerator CPU instructions? How does it fare on the microbenchmarks the various openssl forks ship?
https://jbp.io/2019/07/01/rustls-vs-openssl-performance.html
I'm pretty sure current versions of rustls are faster than the ones from 2019, but I don't have an intuition for how OpenSSL performance has evolved in the past three years.
I'd like to do another comparison some time soon.
(Yes, the underlying ring crypto library should take advantages of specific instructions available on common CPU architectures.)
In contrast, EverCrypt is a formally proven TLS implementation. There is a portable implementation of all algorithms that is used to verify the correctness of the assembly implementations.
https://www.crowdsupply.com/sutajio-kosagi/precursor/updates...
Also interesting to see the Precursor project getting so deep in the weeds! I saw that project on crowd supply months ago and thought it was notable.
* Fixed two buffer overflows in punycode decoding functions.
A buffer overrun can be triggered in X.509 certificate verification,
specifically in name constraint checking. Note that this occurs after
certificate chain signature verification and requires either a CA to
have signed the malicious certificate or for the application to continue
certificate verification despite failure to construct a path to a trusted
issuer.
In a TLS client, this can be triggered by connecting to a malicious
server. In a TLS server, this can be triggered if the server requests
client authentication and a malicious client connects.
An attacker can craft a malicious email address to overflow
an arbitrary number of bytes containing the `.` character (decimal 46)
on the stack. This buffer overflow could result in a crash (causing a
denial of service).
([CVE-2022-3786])
An attacker can craft a malicious email address to overflow four
attacker-controlled bytes on the stack. This buffer overflow could
result in a crash (causing a denial of service) or potentially remote code
execution depending on stack layout for any given platform/compiler.
([CVE-2022-3602]) A: CVE-2022-3602 was originally assessed by the OpenSSL project as CRITICAL as
it is an arbitrary 4-byte stack buffer overflow, and such vulnerabilities may
lead to remote code execution (RCE).
During the week of prenotification, several organisations performed testing
and gave us feedback on the issue, looking at the technical details of the
overflow and stack layout on common architectures and platforms.
Firstly, we had reports that on certain Linux distributions the stack layout
was such that the 4 bytes overwrote an adjacent buffer that was yet to be used
and therefore there was no crash or ability to cause remote code execution.
Secondly, many modern platforms implement stack overflow protections which
would mitigate against the risk of remote code execution and usually lead to a
crash instead.
However as OpenSSL is distributed as source code we have no way of knowing how
every platform and compiler combination has arranged the buffers on the stack
and therefore remote code execution may still be possible on some platforms.
Our security policy states that a vulnerability might be described as CRITICAL
if “remote code execution is considered likely in common situations”. We no
longer felt that this rating applied to CVE-2022-3602 and therefore it was
downgraded on 1st November 2022 before being released to HIGH.Once they were outed, it was clear that all they did was push as much complexity as possible into the spec, ensuring a steady stream of vulnerabilities like this.
For instance, instead of hardcoding things that are definitely fine, they would push through a configuration knob, or champion obscure extensions to the wire protocol in the name of "generality". Whenever someone else proposed a compliciation, they would fast track it as much as possible, and simplifications were black holed.
I can't find a reference anywhere. Does anyone know what I'm (mis)remembering?
I'd be interested to see references to SSL too (from a historical perspective)
- if (written_out > max_out)
+ if (written_out >= max_out)
return 0;
Plus a second, less memeable fix. - (written_out - i) * sizeof *pDecoded);
+ (written_out - i) * sizeof(*pDecoded));
Edit: just to be clear-- I'm claiming there's no way the addition of parentheses could change the behavior of the program.I guess I can understand resolving an ambiguity so that the reader doesn't have to look up precedence rules. But when combined with a high-profile bug in a critical piece of infrastructure it looks a bit like the software equivalent of not shaving one's beard in the hopes of winning a sports tournament.
> A: The OpenSSL project has not named or created logos for either CVE. The best way to refer to them is via the CVE names to avoid confusion.
I chuckled a bit, but im also sad that we ended up in this situation. The obsession with brands is, to some extent, unhealthy.
While it's cool to talk about heartbleed and people knowing what it was (it even had its own XKCD comic), I fear this marketing trend is detrimental because it's not really aimed at the people who apply the patches/mitigations.
Personally, I'm totally fine with CVEs. (And if people to stop acting like QIDs are interchangeable, that would be great, too.)
And you won't remember what WhizzyBadBug refers to in 5 years, you'll have to look it up. It'll only take you 10 seconds or so.
Update: And I'm completely wrong. :-)
Of course, that's cheating a little since we now know that it's not _automatically_ an RCE
>A: The OpenSSL project has not named or created logos for either CVE. The best way to refer to them is via the CVE names to avoid confusion.
"I survived CVE-2022-3786 & CVE-2022-3602 and all I got was this crappy t-shirt."
> Node.js v18.x and v19.x use OpenSSL v3. Therefore these release lines are impacted by this update.
> Node.js 14.x and v16.x are not affected by this OpenSSL update.
> At this stage, due to embargo, the exact nature of these defects is uncertain as well as the impact they will have on Node.js users.
> After assessing the impact on Node.js, it will be decided whether the issues fixed require immediate security releases of Node.js, or whether they can be included in the normally scheduled updates.
(via https://news.ycombinator.com/item?id=33423271, but we merged that thread hither)
Otherwise moderators have to run around cleaning stuff up, fixing titles, merging threads, posting notes about comments that make less sense due to merge, etc.
Sorry this sounds so beratey, just worth keeping in mind next time.