CVE-2022-0778 Infinite loop in BN_mod_sqrt() reachable when parsing certificates
Attackers can cause a denial of service via infinite loop in OpenSSL by crafting malicious certificates with invalid elliptic curve parameters.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2022-0778?
CVE-2022-0778 is a high-severity denial of service vulnerability in Debian Debian Linux, published on 15 Mar 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
The BN_mod_sqrt() function, which computes a modular square root, contains a bug that can cause it to loop forever for non-prime moduli. Internally this function is used when parsing certificates that contain elliptic curve public keys in compressed form or explicit elliptic curve parameters with a base point encoded in compressed form. It is possible to trigger the infinite loop by crafting a certificate that has invalid explicit curve parameters. Since certificate parsing happens prior to verification of the certificate signature, any process that parses an externally supplied certificate may thus be subject to a denial of service attack. The infinite loop can also be reached when parsing crafted private keys as they can contain explicit elliptic curve parameters. Thus vulnerable situations include: - TLS clients consuming server certificates - TLS servers consuming client certificates - Hosting providers taking certificates or private keys from customers - Certificate authorities parsing certification requests from subscribers - Anything else which parses ASN.1 elliptic curve parameters Also any other applications that use the BN_mod_sqrt() where the attacker can control the parameter values are vulnerable to this DoS issue. In the OpenSSL 1.0.2 version the public key is not parsed during initial parsing of the certificate which makes it slightly harder to trigger the infinite loop. However any operation which requires the public key from the certificate will trigger the infinite loop. In particular the attacker can use a self-signed certificate to trigger the loop during verification of the certificate signature. This issue affects OpenSSL versions 1.0.2, 1.1.1 and 3.0. It was addressed in the releases of 1.1.1n and 3.0.2 on the 15th March 2022. Fixed in OpenSSL 3.0.2 (Affected 3.0.0,3.0.1). Fixed in OpenSSL 1.1.1n (Affected 1.1.1-1.1.1m). Fixed in OpenSSL 1.0.2zd (Affected 1.0.2-1.0.2zc).
Weakness: CWE-835
Which versions are affected by CVE-2022-0778?
10 open source packages ship an affected version, including openssl-src, mariadb and mariadb-min. It affects 13 products.
| Package | Affected | Fixed in |
|---|---|---|
openssl-src crates.io | All versions | 111.18.0 |
openssl-src crates.io | All versions | 111.18.0 |
openssl-src crates.io | From 0.0.0-0 | 111.18.0, 300.0.5 |
openssl-src crates.io | From 300.0.0 | 300.0.5 |
openssl-src crates.io | From 300.0.0 | 300.0.5 |
mariadb Bitnami | From 10.2.0 | 10.2.42, 10.3.33, 10.4.23, 10.5.14, 10.6.6, 10.7.2 |
4 more packages
mariadb-min Bitnami | From 10.2.0 | 10.2.42, 10.3.33, 10.4.23, 10.5.14, 10.6.6, 10.7.2 |
mysql-client Bitnami | From 10.2.0 | 10.2.42, 10.3.33, 10.4.23, 10.5.14, 10.6.6, 10.7.2 |
node Bitnami | From 12.0.0 | 12.12.1, 12.22.11, 14.14.1, 14.19.1, 16.12.1, 16.14.2, 17.7.2 |
node-min Bitnami | From 12.0.0 | 12.12.1, 12.22.11, 14.14.1, 14.19.1, 16.12.1, 16.14.2, 17.7.2 |
Linux distribution packages (30)
compat-openssl10 AlmaLinux:8 | All versions | 1:1.0.2o-4.el8_6 |
openssl AlmaLinux:8 | All versions | 1:1.1.1k-6.el8_5 |
openssl-devel AlmaLinux:8 | All versions | 1:1.1.1k-6.el8_5 |
openssl-libs AlmaLinux:8 | All versions | 1:1.1.1k-6.el8_5 |
openssl-perl AlmaLinux:8 | All versions | 1:1.1.1k-6.el8_5 |
openssl Red Hat:enterprise_linux:7::client | All versions | 1:1.0.2k-25.el7_9 |
openssl-debuginfo Red Hat:enterprise_linux:7::client | All versions | 1:1.0.2k-25.el7_9 |
openssl-devel Red Hat:enterprise_linux:7::client | All versions | 1:1.0.2k-25.el7_9 |
openssl-libs Red Hat:enterprise_linux:7::client | All versions | 1:1.0.2k-25.el7_9 |
openssl-perl Red Hat:enterprise_linux:7::client | All versions | 1:1.0.2k-25.el7_9 |
openssl-static Red Hat:enterprise_linux:7::client | All versions | 1:1.0.2k-25.el7_9 |
openssl-debuginfo Red Hat:enterprise_linux:7::computenode | All versions | 1:1.0.2k-25.el7_9 |
openssl-devel Red Hat:enterprise_linux:7::computenode | All versions | 1:1.0.2k-25.el7_9 |
openssl-perl Red Hat:enterprise_linux:7::computenode | All versions | 1:1.0.2k-25.el7_9 |
openssl-static Red Hat:enterprise_linux:7::computenode | All versions | 1:1.0.2k-25.el7_9 |
openssl Red Hat:enterprise_linux:7::server | All versions | 1:1.0.2k-25.el7_9 |
openssl-debuginfo Red Hat:enterprise_linux:7::server | All versions | 1:1.0.2k-25.el7_9 |
openssl-devel Red Hat:enterprise_linux:7::server | All versions | 1:1.0.2k-25.el7_9 |
openssl-libs Red Hat:enterprise_linux:7::server | All versions | 1:1.0.2k-25.el7_9 |
openssl-perl Red Hat:enterprise_linux:7::server | All versions | 1:1.0.2k-25.el7_9 |
openssl-static Red Hat:enterprise_linux:7::server | All versions | 1:1.0.2k-25.el7_9 |
openssl Red Hat:enterprise_linux:7::workstation | All versions | 1:1.0.2k-25.el7_9 |
openssl-debuginfo Red Hat:enterprise_linux:7::workstation | All versions | 1:1.0.2k-25.el7_9 |
openssl-devel Red Hat:enterprise_linux:7::workstation | All versions | 1:1.0.2k-25.el7_9 |
openssl-libs Red Hat:enterprise_linux:7::workstation | All versions | 1:1.0.2k-25.el7_9 |
openssl-perl Red Hat:enterprise_linux:7::workstation | All versions | 1:1.0.2k-25.el7_9 |
openssl-static Red Hat:enterprise_linux:7::workstation | All versions | 1:1.0.2k-25.el7_9 |
compat-openssl10 Red Hat:enterprise_linux:8::appstream | All versions | 1:1.0.2o-4.el8_6 |
compat-openssl10-debuginfo Red Hat:enterprise_linux:8::appstream | All versions | 1:1.0.2o-4.el8_6 |
compat-openssl10-debugsource Red Hat:enterprise_linux:8::appstream | All versions | 1:1.0.2o-4.el8_6 |
Products include Debian Debian Linux, Fedoraproject Fedora, Mariadb Mariadb, Netapp 500f Firmware, Netapp A250 Firmware, Netapp Cloud Volumes Ontap Mediator and 7 more.
How do I fix CVE-2022-0778?
Upgrade openssl-src to a fixed version for your release line: 111.18.0 or 300.0.5.
Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.
Is CVE-2022-0778 being exploited?
There is no known exploitation of CVE-2022-0778 in the wild and no public exploit code.
Public exploit code: 6 proofs of concept on GitHub.
Other vulnerabilities in Debian Debian Linux
Sources
Also known as ALPINE-CVE-2022-0778, ALSA-2022:1065, ALSA-2022:5326, AZL-9051, BIT-mariadb-2022-0778, BIT-mariadb-min-2022-0778 and 56 more.