HexBrain

curl · Report #3477116

CVE-2025-15079: libssh global knownhost override

Validstatus
lowseverity
18upvotes
7 Jan 2026disclosed

How it was found

Summary:

libssh has SSH_OPTIONS_GLOBAL_KNOWNHOSTS that specifies a global known_hosts file that will be used if the host is not found from the file specified in SSH_OPTIONS_KNOWNHOSTS file. libcurl CURLOPT_SSH_KNOWNHOSTS doesn't specify an invalid (or /dev/null) path to SSH_OPTIONS_GLOBAL_KNOWNHOSTS resulting in libcurl accepting any host identities that might be specified in the default file. This is significant when user tries to limit the known hosts to ones specified in their own file, as the global file will be checked if no match is found from the user specified file.

By default this file is /etc/ssh/ssh_known_hosts, and thus not modifiable by non-privileged user (at least on major platforms). Thus in most situations this issue cannot be exploited by actively modifying the file. This limits the impact of this flaw.

Affected version

8.17.0

Steps To Reproduce:

  1. Configure and compile curl with --with-libssh
  2. Add valid host entry for host.example to /etc/ssh/ssh_known_hosts
  3. echo "" > knownhosts
  4. curl --knownhosts knownhosts [email protected]

The host identity validation succeeds even though it should not.

Remediation

  • Make CURLOPT_SSH_KNOWNHOSTS set SSH_OPTIONS_GLOBAL_KNOWNHOSTS to /dev/null (or some non-existing path?).

Supporting Material/References:

Impact

Summary:

Host validation unexpectedly succeeding.

This report was disclosed publicly on HackerOne and belongs to its author and the program. See the original