Skip to content
Heist/ feed
Back to feed
HighFix available

Infinite loop in BN_mod_sqrt() reachable when parsing certificates

Type: advisorySources: OSV

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 i

Products
node
Affected versions
Not specified
Fixed versions
12.12.1, 12.22.11, 14.14.1, 14.19.1, 16.12.1, 16.14.2, 17.7.2
CVEs
CVE-2022-0778
Confirmed fixed CVEs
Not specified
Updated in this feed
30 Oct 2026, 19:52 UTC · Revision 1

Source evidence

Infinite loop in BN_mod_sqrt() reachable when parsing certificates

core-osv · Original source

Published 6 Mar 2024, 11:04 UTC

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 i

osv:BIT-node-2022-0778

node

Fixed versions: 12.12.1, 12.22.11, 14.14.1, 14.19.1, 16.12.1, 16.14.2, 17.7.2

Complete source record
{
  "id": "eaf7bc2194ef2631aa21de48057280e6185d313dd6a9c91880ea482cbfa2b73b",
  "url": "https://osv.dev/vulnerability/BIT-node-2022-0778",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Infinite loop in BN_mod_sqrt() reachable when parsing certificates",
    "summary": "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 i",
    "evidence": "osv:BIT-node-2022-0778",
    "products": [
      {
        "name": {
          "value": "node",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "12.12.1",
            "evidence": "/affected/0/ranges"
          },
          {
            "value": "12.22.11",
            "evidence": "/affected/0/ranges"
          },
          {
            "value": "14.14.1",
            "evidence": "/affected/0/ranges"
          },
          {
            "value": "14.19.1",
            "evidence": "/affected/0/ranges"
          },
          {
            "value": "16.12.1",
            "evidence": "/affected/0/ranges"
          },
          {
            "value": "16.14.2",
            "evidence": "/affected/0/ranges"
          },
          {
            "value": "17.7.2",
            "evidence": "/affected/0/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "high",
    "structured": {
      "id": "BIT-node-2022-0778",
      "aliases": [
        "BIT-mariadb-2022-0778",
        "BIT-mariadb-min-2022-0778",
        "BIT-mysql-client-2022-0778",
        "BIT-node-2022-0778",
        "BIT-node-min-2022-0778",
        "CVE-2022-0778",
        "GHSA-x3mh-jvjw-3xwx",
        "RUSTSEC-2022-0014"
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "SEMVER",
              "events": [
                {
                  "introduced": "12.0.0"
                },
                {
                  "fixed": "12.12.1"
                },
                {
                  "introduced": "12.13.0"
                },
                {
                  "fixed": "12.22.11"
                },
                {
                  "introduced": "14.0.0"
                },
                {
                  "fixed": "14.14.1"
                },
                {
                  "introduced": "14.15.0"
                },
                {
                  "fixed": "14.19.1"
                },
                {
                  "introduced": "16.0.0"
                },
                {
                  "fixed": "16.12.1"
                },
                {
                  "introduced": "16.13.0"
                },
                {
                  "fixed": "16.14.2"
                },
                {
                  "introduced": "17.0.0"
                },
                {
                  "fixed": "17.7.2"
                }
              ]
            }
          ],
          "package": {
            "name": "node",
            "purl": "pkg:bitnami/node",
            "ecosystem": "Bitnami"
          },
          "severity": [
            {
              "type": "CVSS_V3",
              "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
            }
          ],
          "database_specific": {
            "source": "https://github.com/bitnami/vulndb/tree/main/data/node/BIT-node-2022-0778.json"
          }
        }
      ],
      "modified": "2026-10-16T09:45:19.840950777Z",
      "provider": "osv",
      "references": [
        "https://git.openssl.org/gitweb/?p=openssl.git%3Ba=commitdiff%3Bh=3118eb64934499d93db3230748a452351d1d9a65",
        "https://git.openssl.org/gitweb/?p=openssl.git%3Ba=commitdiff%3Bh=380085481c64de749a6dd25cdf0bcf4360b30f83",
        "https://git.openssl.org/gitweb/?p=openssl.git%3Ba=commitdiff%3Bh=a466912611aa6cbdf550cd10601390e587451246",
        "https://lists.debian.org/debian-lts-announce/2022/03/msg00023.html",
        "https://lists.debian.org/debian-lts-announce/2022/03/msg00024.html",
        "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/323SNN6ZX7PRJJWP2BUAFLPUAE42XWLZ/",
        "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/GDB3GQVJPXJE7X5C5JN6JAA4XUDWD6E6/",
        "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/W6K3PR542DXWLEFFMFIDMME4CWMHJRMG/",
        "https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2022-0002",
        "https://security.gentoo.org/glsa/202210-02",
        "https://security.netapp.com/advisory/ntap-20220321-0002/",
        "https://security.netapp.com/advisory/ntap-20220429-0005/",
        "https://support.apple.com/kb/HT213255",
        "https://support.apple.com/kb/HT213256",
        "https://support.apple.com/kb/HT213257",
        "https://www.debian.org/security/2022/dsa-5103",
        "https://www.openssl.org/news/secadv/20220315.txt",
        "https://www.oracle.com/security-alerts/cpuapr2022.html",
        "https://www.oracle.com/security-alerts/cpujul2022.html",
        "https://www.tenable.com/security/tns-2022-06",
        "https://www.tenable.com/security/tns-2022-07",
        "https://www.tenable.com/security/tns-2022-08",
        "https://www.tenable.com/security/tns-2022-09",
        "https://security.netapp.com/advisory/ntap-20240621-0006/",
        "https://nvd.nist.gov/vuln/detail/CVE-2022-0778"
      ],
      "provider_metadata": {
        "cpes": [
          "cpe:2.3:a:nodejs:node.js:*:*:*:*:-:*:*:*",
          "cpe:2.3:a:nodejs:node.js:*:*:*:*:lts:*:*:*"
        ],
        "severity": "High"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2022-0778",
        "evidence": "/aliases"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/database_specific/severity"
  },
  "source_id": "core-osv",
  "document_id": 338386,
  "published_at": "2024-03-06T11:04:37.785+00:00"
}