About the supposed factoring of a 4096 bit RSA key

Hanno's blog

Sunday, May 17. 2015

About the supposed factoring of a 4096 bit RSA key

Keystl;dr News about a broken 4096 bit RSA key are not true. It is just a faulty copy of a valid key.

Earlier today a blog post claiming the factoring of a 4096 bit RSA key was published and quickly made it to the top of Hacker News. The key in question was the PGP key of a well-known Linux kernel developer. I already commented on Hacker News why this is most likely wrong, but I thought I'd write up some more details. To understand what is going on I have to explain some background both on RSA and on PGP keyservers. This by itself is pretty interesting.

RSA public keys consist of two values called N and e. The N value, called the modulus, is the interesting one here. It is the product of two very large prime numbers. The security of RSA relies on the fact that these two numbers are secret. If an attacker would be able to gain knowledge of these numbers he could use them to calculate the private key. That's the reason why RSA depends on the hardness of the factoring problem. If someone can factor N he can break RSA. For all we know today factoring is hard enough to make RSA secure (at least as long as there are no large quantum computers).

Now imagine you have two RSA keys, but they have been generated with bad random numbers. They are different, but one of their primes is the same. That means we have N1=p*q1 and N2=p*q2. In this case RSA is no longer secure, because calculating the greatest common divisor (GCD) of two large numbers can be done very fast with the euclidean algorithm, therefore one can calculate the shared prime value.

It is not only possible to break RSA keys if you have two keys with one shared factors, it is also possible to take a large set of keys and find shared factors between them. In 2012 Arjen Lenstra and his team published a paper using this attack on large scale key sets and shortly after that Nadia Heninger and a team at the University of Michigan also published research on that. This uncovered a lot of vulnerable keys on embedded devices, but these were mostly SSH and TLS keys. Lenstra's team however also found two vulnerable PGP keys. For more background you can watch this 29C3 talk by Nadia Heninger, Dan Bernstein and Tanja Lange.

PGP keyservers have been around since quite some time and they have a property that makes them especially interesting for this kind of research: They usually never delete anything. You can add a key to a keyserver, but you cannot remove it, you can only mark it as invalid by revoking it. Therefore using the data from the keyservers gives you a large set of cryptographic keys.

Okay, so back to the news about the supposedly broken 4096 bit key: There is a service called Phunctor where you can upload a key and it'll check it against a set of known vulnerable moduli. This service identified the supposedly vulnerable key.

The key in question has the key id e99ef4b451221121 and belongs to the master key bda06085493bace4. Here is the vulnerable modulus:

c844a98e3372d67f 562bd881da8ea66c a71df16deab1541c e7d68f2243a37665 c3f07d3dd6e651cc d17a822db5794c54 ef31305699a6c77c 043ac87cafc022a3 0a2a717a4aa6b026 b0c1c818cfc16adb aae33c47b0803152 f7e424b784df2861 6d828561a41bdd66 bd220cb46cd288ce 65ccaf9682b20c62 5a84ef28c63e38e9 630daa872270fa15 80cb170bfc492b80 6c017661dab0e0c9 0a12f68a98a98271 82913ff626efddfb f8ae8f1d40da8d13 a90138686884bad1 9db776bb4812f7e3 b288b47114e486fa 2de43011e1d5d7ca 8daf474cb210ce96 2aafee552f192ca0 32ba2b51cfe18322 6eb21ced3b4b3c09 362b61f152d7c7e6 51e12651e915fc9f 67f39338d6d21f55 fb4e79f0b2be4d49 00d442d567bacf7b 6defcd5818b050a4 0db6eab9ad76a7f3 49196dcc5d15cc33 69e1181e03d3b24d a9cf120aa7403f40 0e7e4eca532eac24 49ea7fecc41979d0 35a8e4accea38e1b 9a33d733bea2f430 362bd36f68440ccc 4dc3a7f07b7a7c8f cdd02231f69ce357 4568f303d6eb2916 874d09f2d69e15e6 33c80b8ff4e9baa5 6ed3ace0f65afb43 60c372a6fd0d5629 fdb6e3d832ad3d33 d610b243ea22fe66 f21941071a83b252 201705ebc8e8f2a5 cc01112ac8e43428 50a637bb03e511b2 06599b9d4e8e1ebc eb1e820d569e31c5 0d9fccb16c41315f 652615a02603c69f e9ba03e78c64fecc 034aa783adea213b

In fact this modulus is easily factorable, because it can be divided by 3. However if you look at the master key bda06085493bace4 you'll find another subkey with this modulus:

c844a98e3372d67f 562bd881da8ea66c a71df16deab1541c e7d68f2243a37665 c3f07d3dd6e651cc d17a822db5794c54 ef31305699a6c77c 043ac87cafc022a3 0a2a717a4aa6b026 b0c1c818cfc16adb aae33c47b0803152 f7e424b784df2861 6d828561a41bdd66 bd220cb46cd288ce 65ccaf9682b20c62 5a84ef28c63e38e9 630daa872270fa15 80cb170bfc492b80 6c017661dab0e0c9 0a12f68a98a98271 82c37b8cca2eb4ac 1e889d1027bc1ed6 664f3877cd7052c6 db5567a3365cf7e2 c688b47114e486fa 2de43011e1d5d7ca 8daf474cb210ce96 2aafee552f192ca0 32ba2b51cfe18322 6eb21ced3b4b3c09 362b61f152d7c7e6 51e12651e915fc9f 67f39338d6d21f55 fb4e79f0b2be4d49 00d442d567bacf7b 6defcd5818b050a4 0db6eab9ad76a7f3 49196dcc5d15cc33 69e1181e03d3b24d a9cf120aa7403f40 0e7e4eca532eac24 49ea7fecc41979d0 35a8e4accea38e1b 9a33d733bea2f430 362bd36f68440ccc 4dc3a7f07b7a7c8f cdd02231f69ce357 4568f303d6eb2916 874d09f2d69e15e6 33c80b8ff4e9baa5 6ed3ace0f65afb43 60c372a6fd0d5629 fdb6e3d832ad3d33 d610b243ea22fe66 f21941071a83b252 201705ebc8e8f2a5 cc01112ac8e43428 50a637bb03e511b2 06599b9d4e8e1ebc eb1e820d569e31c5 0d9fccb16c41315f 652615a02603c69f e9ba03e78c64fecc 034aa783adea213b

You may notice that these look pretty similar. But they are not the same. The second one is the real subkey, the first one is just a copy of it with errors.

If you run a batch GCD analysis on the full PGP key server data you will find a number of such keys (Nadia Heninger has published code to do a batch GCD attack). I don't know how they appear on the key servers, I assume they are produced by network errors, harddisk failures or software bugs. It may also be that someone just created them in some experiment.

The important thing is: Everyone can generate a subkey to any PGP key and upload it to a key server. That's just the way the key servers work. They don't check keys in any way. However these keys should pose no threat to anyone. The only case where this could matter would be a broken implementation of the OpenPGP key protocol that does not check if subkeys really belong to a master key.

However you won't be able to easily import such a key into your local GnuPG installation. If you try to fetch this faulty sub key from a key server GnuPG will just refuse to import it. The reason is that every sub key has a signature that proofs that it belongs to a certain master key. For those faulty keys this signature is obviously wrong.

Now here's my personal tie in to this story: Last year I started a project to analyze the data on the PGP key servers. And at some point I thought I had found a large number of vulnerable PGP keys – including the key in question here. In a rush I wrote a mail to all people affected. Only later I found out that something was not right and I wrote to all affected people again apologizing. Most of the keys I thought I had found were just faulty keys on the key servers.

The code I used to parse the PGP key server data is public, I also wrote a background paper and did a talk at the BsidesHN conference.

Trackbacks

No Trackbacks

Comments
Display comments as (Linear | Threaded)

Even though your own research didn't end up where you first thought it might, it still clearly paid off by providing the evidence to debunk this latest self-promoting FUD-propagation. So thanks for that; I'll be sure to direct those in a panic on freenode here instead of Mircea's blog.
#1 Ben (Homepage) on 2015-05-18 00:46 (Reply)
So in your paper you write "It is unknown to me what the origin of the other two keys is and why they were broken in such a way." Your post seems to imply you are more certain now. What changed?
#2 some guy on 2015-05-18 01:05 (Reply)
I don't really know, but I talked to Nadia Heninger about it and she mentioned that they were probably created by some email software only used in Germany. She also mentions something in a talk she gave lately:

https://mvideos.stanford.edu/graduate#/SeminarDetail/Spring/2015/EE/380/9469
#2.1 Hanno (Homepage) on 2015-05-18 01:10 (Reply)
The process for hacking a key and finding the factors of a PGP or RSA type key is really no where near as hard as is believed. I will give a few hints

(1) The sum of any two prime numbers can be defined as
Sum = Center^2 - Difference^2 where the high prime is Center + Difference and the lower prime is Center - Difference.
(2) Center can be guessed approximately as SqrRoot(Sum)+1.
(3) Validity checks can validate based on last digits of potential sums
(4) A proposed square produces
Sum - Center(guess)^2 = Difference(guess)^2. If Difference(guess) square root as integer produces a remainder then the guess is invalid.
(5) Using ending digit validation for sums most guesses can be tossed out.
(6) Factors are automatically derived as a pair by this means.
The number of factors to process is reduced by the following means
(a) the process is linear not geometric
(b) the math only uses multiplication and shift right
(c) The process reduces necessary processor time by a factor of several trillion times compared with the successive factors and such methods.
I know people may not realize this but RSA process is easily cracked using this method. Instead of taking years it takes an hour or two and is easily handed to parallel processing.

Cryptographic success with any known RSA Sum should be within reasonable times for any modest computer this way.

The problem is guys you are shooting at the wrong end of the problem. Any time math problems become geometrically more complex your solution method is wrong.
#3 Paul Noel on 2015-05-18 04:42 (Reply)

Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
 
 

Quicksearch

About me

Informationen über meine Arbeit als freier Journalist finden Sie hier.

Hanno Böck
mail: hanno@hboeck.de
jabber: hanno@hboeck.de
gpg: BBB51E42
ssh: RSA

Hanno on Google+
Hanno on Twitter
Hanno on identi.ca

Impressum

schokokeks.org
If you can read this your browser is vulnerable to TLS POODLE
If you can read this you're probably fine



POODLE TLS client check by Hanno Böck

Anzeigen

Ad covers the page
Report this ad
Thanks for the feedback! Undo
What was wrong with this ad?
Thanks for the feedback! Back
We’ll review this ad to improve the experience in the future.
Thanks for the feedback! Undo
We’ll use your feedback to review ads on this site.
Closing ad: %1$d

Events

Creative Commons

CC0
Unless noted otherwise, all content is CC Zero / public domain