Skip to content
Heist/ feed
Back to feed
High

Libssh: invalid return code for chacha20 poly1305 with openssl backend

Type: advisorySources: OSV

A flaw was found in libssh when using the ChaCha20 cipher with the OpenSSL library. If an attacker manages to exhaust the heap space, this error is not detected and may lead to libssh using a partially initialized cipher context. This occurs because the OpenSSL error code returned aliases with the SSH_OK code, resulting in libssh not properly detecting the error returned by the OpenSSL library. This issue can lead to undefined behavior, including compromised data confidentiality and integrity or crashes.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2025-5987
Confirmed fixed CVEs
Not specified
Updated in this feed
4 Nov 2026, 02:24 UTC · Revision 1

Source evidence

Libssh: invalid return code for chacha20 poly1305 with openssl backend

core-osv · Original source

Published 7 Jul 2025, 14:24 UTC

A flaw was found in libssh when using the ChaCha20 cipher with the OpenSSL library. If an attacker manages to exhaust the heap space, this error is not detected and may lead to libssh using a partially initialized cipher context. This occurs because the OpenSSL error code returned aliases with the SSH_OK code, resulting in libssh not properly detecting the error returned by the OpenSSL library. This issue can lead to undefined behavior, including compromised data confidentiality and integrity or crashes.

osv:CVE-2025-5987
Complete source record
{
  "id": "c7b6d9136d872e7ce9962c0cb1ddd39da240eebb5a411edb8bf3d61c6a0b5b23",
  "url": "https://osv.dev/vulnerability/CVE-2025-5987",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Libssh: invalid return code for chacha20 poly1305 with openssl backend",
    "summary": "A flaw was found in libssh when using the ChaCha20 cipher with the OpenSSL library. If an attacker manages to exhaust the heap space, this error is not detected and may lead to libssh using a partially initialized cipher context. This occurs because the OpenSSL error code returned aliases with the SSH_OK code, resulting in libssh not properly detecting the error returned by the OpenSSL library. This issue can lead to undefined behavior, including compromised data confidentiality and integrity or crashes.",
    "evidence": "osv:CVE-2025-5987",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2025-5987",
      "aliases": [
        "CVE-2025-5987"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://gitlab.com/libssh/libssh-mirror",
              "type": "GIT",
              "events": [
                {
                  "introduced": "7f6b3fab4e8d4b97e73d5ca60ddc5a3d0f5880d2"
                },
                {
                  "fixed": "dff6c0821ed54f6fbf5b755af43f54cbb723b1b1"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:libssh:libssh:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0.10.0"
                      },
                      {
                        "fixed": "0.11.2"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-5987.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:32.381511090Z",
      "provider": "osv",
      "references": [
        "https://access.redhat.com/downloads/content/package-browser/",
        "https://www.libssh.org/",
        "https://access.redhat.com/errata/RHSA-2025:23483",
        "https://access.redhat.com/errata/RHSA-2025:23484",
        "https://access.redhat.com/errata/RHSA-2026:0427",
        "https://access.redhat.com/errata/RHSA-2026:0428",
        "https://access.redhat.com/errata/RHSA-2026:0430",
        "https://access.redhat.com/errata/RHSA-2026:0431",
        "https://access.redhat.com/errata/RHSA-2026:0702",
        "https://access.redhat.com/errata/RHSA-2026:0978",
        "https://access.redhat.com/errata/RHSA-2026:0980",
        "https://access.redhat.com/errata/RHSA-2026:0985",
        "https://access.redhat.com/errata/RHSA-2026:0996",
        "https://access.redhat.com/errata/RHSA-2026:1539",
        "https://access.redhat.com/errata/RHSA-2026:1541",
        "https://access.redhat.com/errata/RHSA-2026:3415",
        "https://access.redhat.com/security/cve/CVE-2025-5987",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/5xxx/CVE-2025-5987.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2025-5987",
        "https://www.libssh.org/security/advisories/CVE-2025-5987.txt",
        "https://bugzilla.redhat.com/show_bug.cgi?id=2376219"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-393"
        ],
        "cna_assigner": "redhat",
        "unresolved_ranges": [
          {
            "extracted_events": [
              {
                "range": [
                  {
                    "fixed": "0:0.11.1-5.el10_1"
                  },
                  {
                    "fixed": "0:0.11.1-4.el10_0.1"
                  },
                  {
                    "fixed": "0:0.10.4-17.el9_7"
                  },
                  {
                    "fixed": "0:0.10.4-17.el9_7"
                  },
                  {
                    "fixed": "0:0.10.4-9.el9_2.2"
                  },
                  {
                    "fixed": "0:0.10.4-13.el9_4.2"
                  },
                  {
                    "fixed": "0:0.10.4-15.el9_6.1"
                  },
                  {
                    "fixed": "413.92.202602240113-0"
                  },
                  {
                    "fixed": "414.92.202601191325-0"
                  },
                  {
                    "fixed": "415.92.202601271320-0"
                  },
                  {
                    "fixed": "416.94.202601160124-0"
                  },
                  {
                    "fixed": "417.94.202601120213-0"
                  },
                  {
                    "fixed": "418.94.202601202224-0"
                  },
                  {
                    "fixed": "4.19.9.6.202601260820-0"
                  },
                  {
                    "fixed": "4.20.9.6.202601211057-0"
                  }
                ],
                "source": "AFFECTED_FIELD",
                "strategy": "InverseAffectedRanges"
              }
            ]
          },
          {
            "extracted_events": [
              {
                "range": [
                  {
                    "introduced": "0.10.0"
                  },
                  {
                    "fixed": "0.11.2"
                  }
                ],
                "source": "AFFECTED_FIELD",
                "strategy": "StandardRange"
              }
            ]
          }
        ],
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/5xxx/CVE-2025-5987.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2025-5987",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 499639,
  "published_at": "2025-07-07T14:24:12.576+00:00"
}