Security flaw in top SSH client could let hackers recover cryptographic private keys

A computer being guarded by cybersecurity.
(Image credit: iStock)

Multiple versions of the PuTTY SSH client were found to be vulnerable to a high-severity flaw which allowed, in certain scenarios, threat actors to exfiltrate private keys used to generate cryptographic signatures. 

As a result, the attackers could gain unauthorized access to SSH servers, or could be allowed to sign commits as a developer. 

As reported by BleepingComputer, the vulnerability in versions PuTTY versions 0.68 to 0.80 is tracked as CVE-2024-31497, and affects at least these software:

FileZilla 3.24.1 – 3.66.5 (fixed in 3.67.0)
WinSCP 5.9.5 – 6.3.2 (fixed in 6.3.3)
TortoiseGit 2.4.0.2 – 2.15.0 (fixed in 2.15.0.1)
TortoiseSVN 1.10.0 – 1.14.6 (mitigation possible by configuring TortoiseSVN to use Plink from the latest PuTTY 0.81 release)

There could be others, the researchers warned, depending on the version of PuTTY used, urging users to double-check their tools.

Needing signatures

The researchers who discovered the flaw are Fabian Bäumer and Marcus Brinkmann of the Ruhr University Bochum. PuTTY is a free, open-source terminal emulator, serial console, and network file transfer application. It supports different network protocols, such as SCP, SSH, Telnet, and others. It can also connect to a serial port. 

Companies typically use the service to access and manage servers, and other network-connected devices, remotely, over SSH. 

The problem, as the researchers explained, stems from how PUTTY generates ECDSA nonces for the NIST P-521 curve, used for SSH authentication:

"PuTTY's technique worked by making a SHA-512 hash and then reducing it mod q, where q is the order of the group used in the DSA system. For integer DSA (for which PuTTY's technique was originally developed), q is about 160 bits; for elliptic-curve DSA (which came later), it has about the same number of bits as the curve modulus, so 256 or 384 or 521 bits for the NIST curves," they said.

"In all of those cases except P521, the bias introduced by reducing a 512-bit number mod q is negligible. But in the case of P521, where q has 521 bits (i.e. more than 512), reducing a 512-bit number mod q has no effect at all – you get a value of k whose top 9 bits are always zero."

The only caveat here is that the attackers need 58 signatures to be able to calculate their target’s private key. The best way to do that, it was said, was through Git commits. Git can be configured to use OpenSSH to sign Git commits with the SSH key provided by Pageant.

The ssh-agent of PuTTY then generates the signature, which can then be recovered. Version 0.81 addressed the flaw.

More from TechRadar Pro

Sead is a seasoned freelance journalist based in Sarajevo, Bosnia and Herzegovina. He writes about IT (cloud, IoT, 5G, VPN) and cybersecurity (ransomware, data breaches, laws and regulations). In his career, spanning more than a decade, he’s written for numerous media outlets, including Al Jazeera Balkans. He’s also held several modules on content writing for Represent Communications.