libssh backend CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 validation bypass
When libcurl is built against libssh, the [redacted] option is silently ignored, so the expected host key fingerprint is never checked. An attacker able to intercept or impersonate the SSH server could therefore get a connection accepted despite a mismatched fingerprint.
- Disclosed after 20 hours
Summary:
If libcurl is built against libssh CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 is quietly ignored. As a result a SSH connection will be established even if the SHA256 key set doesn't match.
Steps To Reproduce:
- configure libcurl with libssh and build it
curl --hostpubsha256 HOSTFINGERPRINTHERE sftp://example.tld/
Instead of failing due to mismatching fingerprint the connection quietly continues.
While the CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 documentation does mention that this option Requires the libssh2 backend, it is still wrong to quietly ignore the validation.
Remediation
Change lib/vssh/libssh.c myssh_is_known to reject connection if CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 is set, or implement sha256 fingerprint support for libssh.
Impact
SSH host validation bypass.
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 the libssh backend never implements the SHA256 host key check, so the option is accepted but has no effect on validation.
Impact
SSH host validation is bypassed, so a connection succeeds even when the fingerprint does not match.
What the attacker needed
Libcurl built with libssh backend; attacker can impersonate the SSH server
The fix
The libssh backend should refuse the connection when the SHA256 option is set, or it should implement SHA256 fingerprint checking.
How it was found
- Build libcurl configured to use the libssh backend.
- Run curl against an SFTP URL while supplying a host public key SHA256 fingerprint.
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 client can be told to check that the server's identity (its host key) matches a known fingerprint. Here the library accepted the connection without doing that check at all, so someone pretending to be the server would not be noticed. The setting looked like it was protecting the connection but was quietly doing nothing.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.