Skip to content
Misconfiguration Disclosed report Intermediate CVE-2025-15079

CVE-2025-15079: libssh global knownhost override

libcurl does not disable libssh's global known_hosts file when a user supplies their own known hosts file, so host key checks fall back to the system-wide file. An attacker whose key is trusted in that global file could pass host identity validation even when the user intended to trust only their own list.

nyymi Follow

Originally disclosed on HackerOne

  • Triaged in 12 hours
  • Fixed in 14 days
  • Disclosed after 14 days

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.

The original report as published on HackerOne, by nyymi. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely libcurl sets the user's known hosts file but never overrides libssh's global known hosts option, so libssh falls back to the system-wide file when no match is found.

Impact

Host identity validation could succeed when the user expected it to fail, but only if the attacker's key is already present in the system-wide file, which a non-privileged user cannot modify, so the impact is limited.

What the attacker needed

Attacker key in system-wide known_hosts; administrator-level write access needed

The fix

libcurl should set the global known hosts option to a non-existent path such as /dev/null whenever the user supplies their own known hosts file.

How it was found

  1. Build curl against libssh.
  2. Put a valid host entry for the target host into the system-wide known hosts file.
  3. Create an empty known hosts file for the user.
  4. Run curl against the host using that empty file as the known hosts file and observe that validation still succeeds.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you connect to a server over SSH, your computer checks the server's identity against a list of known servers, kept in a file called known_hosts. libcurl lets you point it at your own list, but it forgot to switch off the system-wide list, so a server listed there is still accepted. In practice the system-wide list can only be edited by an administrator, which makes this hard to abuse.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by nyymi

View all

51 more disclosed reports, best first.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.