PuTTY's P-521 Nonce Bug: The Users Who Paid the Price

Archi4 min read

cryptographysecuritysshvulnerability

Contents
  1. A Blank Space in the Nonce
  2. Who Felt It First
  3. The Cost of a Misplaced Trust
  4. The Chain Reaction
  5. The Other Advisories People Miss
  6. What Should Change

A Blank Space in the Nonce#

When the PuTTY advisory arrived in April 2024, most readers skimmed past the curve name. P-521 is the largest standard elliptic curve from NIST, and larger numbers sound safer. For a small number of users, the opposite turned out to be true.

The bug was in the way PuTTY generated a random integer called a nonce. Every ECDSA signature depends on a fresh, unpredictable nonce. If even a few bits of that nonce are predictable, an attacker who collects enough signatures can solve for the private key. PuTTY's code generated nonces with SHA-512, which gives 512 bits. But the P-521 curve needs roughly 521 bits. That 9-bit gap was enough.

Who Felt It First#

The advisory listed affected products: PuTTY, FileZilla, WinSCP, TortoiseGit, TortoiseSVN, and any other tool that used PuTTY's cryptography. The people at risk were not the engineers with dedicated key management teams. They were independent developers, small web hosts, and open source maintainers who had generated one strong key and reused it across a dozen servers.

An attacker only needed about 60 signatures signed with that key. SSH sends a signature during authentication. A busy maintainer can produce 60 signatures in a single day of connecting to servers and pushing commits. For someone managing a small cluster, the campaign could be silent.

Some large organizations were also exposed, but they had options. Centralized configuration could rotate keys across hundreds of machines within hours. A freelancer with one key in an aging Pageant session had to notice the advisory, figure out which keys were P-521, and replace them before doing anything else. Many did not.

The Cost of a Misplaced Trust#

P-521 was not the weak link. The curve is mathematically sound. The failure came from an implementation detail buried inside a widely trusted tool. This is a common pattern in cryptography. The strongest algorithm still depends on a random number generator or a nonce generator. When that generator is slightly off, the entire system falls.

The users who chose P-521 likely did so because they wanted maximum security. A 521-bit key sounds harder to break than a 256-bit key. In this case, choosing the "strong" option made them the only users exposed. Everyone else on the default curve was not affected.

The Chain Reaction#

The effects did not stop at the key owner. Open source projects rely on a small group of maintainers. If a maintainer’s SSH key leaked, an attacker could push malicious code that looks authentic. That is not hypothetical. Tools that signed releases with the affected key would produce honest-looking artifacts even though the key was no longer secret.

Small businesses felt it too. A managed service provider with five engineers might use the same PuTTY-generated P-521 key for all client servers. A recovery would not cost much in computing power, but the cleanup would. Every client system needed a new key, new user accounts, and new monitoring. For a small shop, that is a week of work.

The Other Advisories People Miss#

This bug got attention because PuTTY is common. But the same pattern appears elsewhere. The randomness source for an ECDSA implementation can be a weak library, a hardware random number generator with a factory default, or a custom nonce scheme that looks clever. The lesson is not unique to PuTTY.

What matters is who reads the advisory. A security team does. A person running a small VPN gateway likely does not. They get the news weeks later from a hosting provider, often after the keys have already been exposed.

What Should Change#

Key rotation should not wait for a specific bug report. Every SSH key has a life span. Rotating a key on a schedule, even without a known vulnerability, reduces the window of exposure. For a small user, that means setting a calendar reminder every six months and generating a fresh key with the default algorithm.

Ed25519 is a better default. It uses a deterministic nonce derived from the key and the message, removing the need for a random nonce generator. That is not perfect, but it eliminates an entire class of failure. Many large platforms already prefer it.

For users still on ECDSA, the curve and the nonce matter together. A high-security curve with a sloppy nonce is worse than a standard curve with a careful implementation. The safest choice is the one that has been reviewed by many eyes, not the one with the biggest number.

The PuTTY advisory was fixed in version 0.81. That part was quick. The slower part was reaching everyone who had a P-521 key in a drawer, still in active use. The people who paid the most were not the ones who read the advisory first. They were the ones who trusted that a larger key means a larger margin of error.

More articles