Executive brief
A security flaw in the libcurl library could allow an attacker to intercept or modify data during secure file transfers (SCP or SFTP). The library may fail to verify the identity of a server if the server uses a different type of security key than what was previously recorded. This could lead to a man-in-the-middle attack where an unauthorized party impersonates a trusted server without the application noticing.
Technical details
A vulnerability exists in libcurl when built with the libssh backend (libssh2 is unaffected) during SCP or SFTP transfers. When an application utilizes the CURLOPT_SSH_KEYFUNCTION callback, the library may fail to properly enforce host key restrictions if the server presents a key type that differs from the one stored in the known_hosts file for that host. Instead of rejecting the mismatch, the callback mechanism allows the connection to proceed, enabling potential man-in-the-middle (MITM) attacks. This issue does not affect the curl command-line tool and is fixed in version 8.21.0.
Affected products
- curl curl 7.69.0 to 8.20.0
Timeline
- 2026-05-20: disclosed: Reported to the curl project
- 2026-06-24: patched: Fixed in curl 8.21.0
- 2026-06-24: advisory: Project curl advisory published