# CVE-2022-0778: Infinite loop in BN\_mod\_sqrt() reachable when parsing certificates

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.5
- **CVSS:** 7.5 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: None; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** Yes (see exploit references)
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 52.57% (percentile 99, 2026-11-26)
- **CWE:** CWE-835
- **Aliases:** BIT-mariadb-2022-0778, BIT-mariadb-min-2022-0778, BIT-mysql-client-2022-0778, BIT-node-2022-0778, BIT-node-min-2022-0778, GHSA-x3mh-jvjw-3xwx, RUSTSEC-2022-0014
- **Published:** 2022-03-15T12:00:00.000Z
- **Modified:** 2026-10-14T13:17:14.377Z

## Who should check

- Projects that depend on crates.io package openssl-src (\>= 300.0.0, \< 300.0.5)
- Anyone running OpenSSL 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)

## 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).

## Affected and fixed versions

- crates.io `openssl-src`: affected \>= 300.0.0, \< 300.0.5; fixed 300.0.5, 111.18.0 (osv)
- OpenSSL: 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) (cvelist)

## Mitigation

- Upgrade openssl-src to one of 300.0.5, 111.18.0 (or later in the same release line).

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2022-0778. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2022-0778.md
Affected: openssl-src >= 300.0.0, < 300.0.5
Fixed in: 300.0.5, 111.18.0

Steps:
1. Search this machine and project for openssl-src (crates.io), OpenSSL: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2022-0778 being exploited?

There is no confirmed exploitation: CVE-2022-0778 is not in the CISA Known Exploited Vulnerabilities catalog. Public exploit code or a proof of concept is available. EPSS estimates a 52.57% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2022-0778?

High: CVSS 7.5 (v3.1, scored by CNA). Remote, no login needed.

### Which versions are affected by CVE-2022-0778?

openssl-src \>= 300.0.0, \< 300.0.5.

### Is there a fix for CVE-2022-0778?

Yes. Fixed in 300.0.5, 111.18.0. Upgrade openssl-src to one of 300.0.5, 111.18.0 (or later in the same release line).

### How do I check if I'm affected by CVE-2022-0778?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://www.openssl.org/news/secadv/20220315.txt>
- vendor: <https://www.debian.org/security/2022/dsa-5103>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/GDB3GQVJPXJE7X5C5JN6JAA4XUDWD6E6/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/323SNN6ZX7PRJJWP2BUAFLPUAE42XWLZ/>
- vendor: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/W6K3PR542DXWLEFFMFIDMME4CWMHJRMG/>
- vendor: <https://security.gentoo.org/glsa/202210-02>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2022-0778>
- vendor: <https://rustsec.org/advisories/RUSTSEC-2022-0014.html>
- exploit: <http://packetstormsecurity.com/files/167344/OpenSSL-1.0.2-1.1.1-3.0-BN_mod_sqrt-Infinite-Loop.html>
- other: <https://git.openssl.org/gitweb/?p=openssl.git%3Ba=commitdiff%3Bh=a466912611aa6cbdf550cd10601390e587451246>
- other: <https://git.openssl.org/gitweb/?p=openssl.git%3Ba=commitdiff%3Bh=3118eb64934499d93db3230748a452351d1d9a65>
- other: <https://git.openssl.org/gitweb/?p=openssl.git%3Ba=commitdiff%3Bh=380085481c64de749a6dd25cdf0bcf4360b30f83>
- other: <https://lists.debian.org/debian-lts-announce/2022/03/msg00023.html>
- other: <https://lists.debian.org/debian-lts-announce/2022/03/msg00024.html>
- other: <https://www.oracle.com/security-alerts/cpuapr2022.html>
- other: <https://security.netapp.com/advisory/ntap-20220321-0002/>
- other: <https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2022-0002>
- other: <https://www.tenable.com/security/tns-2022-06>
- other: <https://www.tenable.com/security/tns-2022-07>
- other: <https://www.tenable.com/security/tns-2022-08>
- other: <http://seclists.org/fulldisclosure/2022/May/33>
- other: <http://seclists.org/fulldisclosure/2022/May/35>
- other: <http://seclists.org/fulldisclosure/2022/May/38>
- other: <https://www.oracle.com/security-alerts/cpujul2022.html>
- other: <https://support.apple.com/kb/HT213257>
- other: <https://support.apple.com/kb/HT213256>
- other: <https://support.apple.com/kb/HT213255>
- other: <https://www.tenable.com/security/tns-2022-09>
- other: <https://security.netapp.com/advisory/ntap-20220429-0005/>
- other: <https://cert-portal.siemens.com/productcert/pdf/ssa-712929.pdf>
- other: <https://security.netapp.com/advisory/ntap-20240621-0006/>
- other: <https://cert-portal.siemens.com/productcert/html/ssa-712929.html>
- other: <https://cert-portal.siemens.com/productcert/html/ssa-398330.html>
- other: <https://cert-portal.siemens.com/productcert/html/ssa-108696.html>
- other: <https://cert-portal.siemens.com/productcert/html/ssa-028723.html>
- other: <https://cert-portal.siemens.com/productcert/html/ssa-019200.html>
- other: <https://security.netapp.com/advisory/ntap-20220321-0002>
- other: <https://security.netapp.com/advisory/ntap-20220429-0005>
- other: <https://security.netapp.com/advisory/ntap-20240621-0006>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/W6K3PR542DXWLEFFMFIDMME4CWMHJRMG>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/GDB3GQVJPXJE7X5C5JN6JAA4XUDWD6E6>
- other: <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/323SNN6ZX7PRJJWP2BUAFLPUAE42XWLZ>
- other: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/W6K3PR542DXWLEFFMFIDMME4CWMHJRMG>
- other: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/GDB3GQVJPXJE7X5C5JN6JAA4XUDWD6E6>
- other: <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/323SNN6ZX7PRJJWP2BUAFLPUAE42XWLZ>
- other: <https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=a466912611aa6cbdf550cd10601390e587451246>
- other: <https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=380085481c64de749a6dd25cdf0bcf4360b30f83>
- other: <https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=3118eb64934499d93db3230748a452351d1d9a65>
- other: <https://crates.io/crates/openssl-src>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2022-0778>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-x3mh-jvjw-3xwx> (license: <https://creativecommons.org/licenses/by/4.0/>)
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/RUSTSEC-2022-0014> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2022-0778> · JSON: <https://flawdb.com/api/v1/entries/CVE-2022-0778>
