Factoring RSA Keys with Many Zeros

Interesting research on a new class of weak RSA keys: keys with lots of zeros. It turns out that these keys are out in the wild.

The badkeys project is an open-source service that checks public keys for known vulnerabilities. While developing this tool, Hanno collected a massive number of real-world keys from public sources, including Certificate Transparency logs, internet-wide TLS and SSH scans, PGP keys, and many others. By searching this dataset for unexpectedly sparse RSA moduli, we uncovered a large number of keys in the wild with the patterns in Figure 1.

Both patterns include several regularly spaced blocks of all zeros interleaved with seemingly random data. Pattern 1 appears in CT logs for certificates issued to several large organizations, including Yahoo and Verizon, and on some devices running NetApp software. Fortunately, these certificates have already expired, but we still shared our findings with these companies. We wanted to learn more about which product could be responsible for generating these keys, but we did not hear back. Pattern 2 appears on SSH hosts running the CompleteFTP software from EnterpriseDT. The underlying vulnerability affects RSA keys generated using versions 10.0.0­12.0.0 (Dec 2016­Mar 2019) and DSA keys generated with v10.0.0­23.0.4 (Dec 2016­Dec 2023).

These vulnerabilities affect a small minority of hosts on the internet, but the more interesting takeaway is that independent cryptographic implementations failed in similar ways. More implementations may include the same bugs, and so it’s worth tailoring cryptanalytic algorithms for this particular type of failure.

The article doesn’t speculate, but I will. This could be a deliberately designed backdoor, of the sort I wrote about back in 2013. I could imagine some government agency figuring out how to break this class of RSA keys, and then convincing different providers to hand them out to users.

Posted on June 29, 2026 at 12:05 PM10 Comments

Comments

lurker June 29, 2026 2:35 PM

It’s not the “bias towards many zeroes” that’s the problem: it’s the zeroes turning up in identical sized blocks, identically spaced in the “random” strings. It looks dodgy to the naked eye, as if it could be cracked quickly with an abacus. If somebody gave me a key like those I would send it back and ask for a replacement.
Or use https://xkcd.com/221/

Clive Robinson June 29, 2026 4:08 PM

@ Bruce, ALL,

With regards,

“The article doesn’t speculate, but I will.”

We’ve been through this prior to 2013.

With respect to generating certificates on embedded devices such as “network devices”.

It’s very difficult to develop entropy on such devices when they are “first out the box” because they have next to no internal entropy and likewise external entropy[1].

Thus there would be a very high chance that all certificates generated on such devices are very closely related.

Whilst factoring the multiple of two large primes is assumed to be hard… Finding two or more such multiples that share a prime is in comparison trivial, using a simple “Greatest Common Divisor”(GCD) algorithm,

https://www.cryptool.org/en/posts/rsa-sanity-check/

As I noted back when I pointed this out, I assume that part of the NSA budget would go on “buying and testing” all edge of network devices looking for weaknesses in such certificate generating devices”

Not technically a “back door” as the NSA did not design or install it. But certainly a nicely exploitable vulnerability almost as good as the one that caused NIST such embarrassment and much to everyone’s suprise turned up on Jupiter Networks high end systems, when it should not have and was still creating issues half a decade back,

https://checkoway.net/musings/dualec/

There were other issues with RSA certs which nearly all overlap in time. Thus if the NSA knew about them all could have had access to all RSA PubKey reliant traffic this century…

Which begs the question about why the NSA are twitchy about PQC key establishment protocols…

What do they know that we don’t and is it another bit of NOBUS nonsense again.

[1] It’s one of those “Catch 22” problems… Because the devices have no real human interfaces or electromagnetic moving parts, the device / internal entropy is in the order of one or three bits a minute. Then because the embedded device has no certificate yet, it’s probably got no real external entropy coming in across the network either.

So the “Catch” is to get entropy to make a couple of random numbers of the right size to make a new secure RSA certificate… you either need the certificate already, or known entropy, neither of which is secure…

Not really anonymous June 29, 2026 5:57 PM

The NSA is still trying to get people to use pure PQC algorithems rather than hybrids, so something seems to be up with the current PQC proposals.

Weather June 29, 2026 6:20 PM

@All

Most algo zero pad, what should be done is 0xaaaa, then each chacter is the value in the area, say 59,60,61,62.

The reason is 0x00 leaks the code book.

anonymouse random June 30, 2026 6:02 PM

@Clive Robinson: With respect to generating certificates on embedded devices such as “network devices”. It’s very difficult to develop entropy on such devices when they are “first out the box” because they have next to no internal entropy and likewise external entropy.

Some creativity will get you usable entropy in a practical time-frame. Any such device will receive a considerable number of packets, even if it’s not configured for operation, especially if the network interface is in promiscuous mode. Just take the lower bit or two of the CPU tick counter at packet arrival, and you have some usable entropy. You can also send requests (e.g., ARP, DNS) and do the same thing with the reply packets.

Clive Robinson June 30, 2026 8:32 PM

@ anonymouse random,

First off apologies for not spotting you sooner, but you might have noticed there is considerable “noise on the line” preceding you.

With regards,

“Some creativity will get you usable entropy in a practical time-frame.”

The problem is –even now more than a decade and a half later– those methods are still considered not a wise thing to do security wise.

Especially if the device is configured by a “web style user interface” with a default password which many still are.

The recommended way security wise is that such devices be set up on a “secure lab network” first. Which back then was a network crossover cable from the network device directly into the “lab network port” on the operators computer or mini-hub.

This environment has very little non deterministic traffic thus few if any bits of true entropy.

Then only when “setup” should the network device be connected to an “internal network” that carries other traffic, let alone external traffic untill tested.

Back a decade and a half ago it was known and demonstrated that if you set up PCs or other devices starting in “factory default” / “out of the box” state. And you did it on a WAN with external connectivity they could be “owned within less than half a minute”… So it was considered unwise to do so, and for many people it still is.

I’ve previously discussed the types of random generator in use and their pros and cons. Our hosts versions used an “entropy file” to safely “re-seed” the entropy pool on reset/startup.

Thus my view was that the manufacturer could easily create and add a unique entropy file in the factory prior to packing and shipping.

Using sources of true entropy on the production line is a technique I developed quite a ways back last century for giving “phones” secure unique ID’s etc quickly and easily as part of “final test” on the production line for a major FMCE manufacturer with factories in several Far Eastern countries.

R. Cake July 1, 2026 2:26 AM

I am not mathematically sound enough to judge, but this rings a bell: there is a 2016 presentation by prof. Petr Svenda (https://scholar.google.com/citations?view_op=view_citation&hl=en&user=sAA8_ysAAAAJ&citation_for_view=sAA8_ysAAAAJ:SP6oXDckpogC) pointing out that many random number generators – back then – were not in fact particularly good. Also an RSA-KG function uses random sources, and doubtful quality RNGs could possibly explain a resulting doubtful-quality key?

Dave Glass July 15, 2026 9:53 AM

That sounds suspiciously like a true random number generator (tRNG) failure. I wonder if anyone has checked for strings of ones (or Fs for hexadecimal) (although these probably wouldn’t be as catastrophic as zeros, or would they?)? A somewhat common failure mode for TRNGs is to be stuck at one value (depending, of course, on the particular type of RNG). One wouldn’t expect such sequences to come out of a Deterministic RNG, though (but, has anyone looked?).

I’m reminded of that cartoon of Dilbert, when he visits the trolls in accounting, and is presented with the RNG troll, who’s sitting at a desk, saying “nine, nine, nine, nine…”, and Dilbert asks if that’s really random.

Of course, it could also be a back-door.

Or, something like that.

Billy Jack July 15, 2026 3:45 PM

It seems reasonable to require three ssh keys to log in:

AuthenticationMethods publickey,publickey,publickey

Even if one or two keys are found to have vulnerabilities, it should be safe.

Leave a comment

Blog moderation policy

Login

Allowed HTML <a href="URL"> • <em> <cite> <i> • <strong> <b> • <sub> <sup> • <ul> <ol> <li> • <blockquote> <pre> Markdown Extra syntax via https://michelf.ca/projects/php-markdown/extra/

Sidebar photo of Bruce Schneier by Joe MacInnis.