How to Factor a 4096-bit Certificate

October 21, 2015 by Ixia Blog Team

The RSA cipher is the basis of today’s web security. Its strength relies on an attacker’s inability to factor a number into the underlying primes that were multiplied together to create that number.

If you were to search the web about the difficulty of factoring integers used for RSA, you run into these intricate formulas that only an intrepid mathematician could understand. You don’t even get a time estimate, but just an order of magnitude. Then you find references to the RSA challenge numbers1 and discover that many are still not factored. It’s believed that a 1024-bit number could be factorable in the near future, but when you get to a 2048-bit number, terms like “heat death of the universe” start showing up. Also, a 4096-bit number is the gold standard used by signing authorities (those who sign certificates for other entities). This can never be factored without a quantum computer (and we seem to be some time away from that event).

There have been ongoing efforts2 in collecting and analyzing web certificates. An eye-opening 1.4% of 1024-bit certificates are relatively easy to factor, since primes end up being reused between certificates. This seems to be from the random number generation used in creating the primes in the first place. has a live ongoing project to collect certificates used all over the web. One entry I found had a malformed certificate. Comparing it to the officially published certificate, there is, in fact, a single bit difference in the base-64 encoding of the certificate. It turns out that this change is enough to turn a very strong product into a number that’s relatively easy to factor.

Here’s the certificate as found by in their 20131030-20150518_certs.gz file (which has the hash of a18db9687dcf975fd74b80b3fbfaf494bd92f9a0)


And here’s the official certificate as published by


Notice the difference? Even the “diff” utility doesn't make it easy:


So I’ve highlighted it here:


This is a change from 0x4f to 0x6f, a one-bit difference. That change is in the middle of the public modulus, which changes the number into:


On the surface, this seems daunting, but quickly breaks down into these primes (and the Miller-Rabin test easily confirms that these are prime):





1819255238231, 4623731541688734360157042570610599516948756673458506045203383012491808884456840033256405244797373597698967825083614426858612172505968492429519729880788904669708659889195420119187545837343961105966713029653015626564410301004065523216873832556827271668037513653274083955351661031451005547129716495519856684862339797215225619044495314803081828924065993631397995002133184553870300969743815093415782391050089126574481411538326136338358602828285227302429027010535487312302708101693546422554530297729638618279672595506733452307463764128075572070518984325606985678956318543708024909638157569790529363117690866454471646918195515608197892797533331343998996749384381287896482752822626708144630179880644910939702909238809836672024841283049899764435643301500156753535232757034055275361761581567949729909736163907014149101108187137389755514653772766995574030729420371074928603918060655933332376504544795477628463896509713211880178013570634849313511923786260820063802222901481912180717261906818645776983810280048759905846118981705184817225422907319149095850579839942393906735249567561852134230042425232475850706950515777817768328720324295190824823428665893682564136428583423557638264707642117886612016046673110507953

Don’t worry. This certificate is no longer in use by that site, nor would it have actually been usable, so there is no danger in exposing these details.

How do we get a one-bit error like this? It can happen from memory corruption when a computer doesn’t use ECC memory3, or even when old hard drives are used. A humorous example of the one-bit-error issue is the registration of “”4, which changes the ‘o’ (0x6f) to an ‘m’ (0x6d), which is a one-bit difference and received many hits.

It’s a reminder that in all things dealing with encryption, the devil is always in the details, and the slightest mistake may be enough for an attacker to break in. The difference is that an attacker won’t tell you when something is broken. Although I’ve “factored” a 4096-bit certificate and can cross that off my bucket list, we are still some time away before we can declare the RSA algorithm broken.



2 “Mining Your Ps and Qs Detection of Widespread Weak Keys" ( by Nadia Heninger



Additional Resources:

Ixia ATI subscription

Ixia security solutions