Two 2048-bit RSA Keys, One GCD, Both Broken: Check Your Own Public Keys in the Browser

Community Article
Published November 25, 2026

Live app: FINAL-Bench/KeyGuard · English, Korean, Chinese · MIT · no sign-in

KeyGuard home screen

TL;DR

A 2048-bit RSA key is out of reach for today's factoring methods, as long as its two primes were chosen well. When a device picks them badly, the key length stops mattering.

  • If two devices share one prime, a single greatest common divisor opens both keys.
  • If the two primes sit too close together, a 2048-bit key falls in about a millisecond.
  • KeyGuard checks RSA public keys for four families of structural defects, entirely in your browser. In our capture session the page sent 0 network requests after loading, across every check.

Open the app, press a sample button, and watch both cases happen.

The problem is not RSA. It is how some keys are born

An RSA public key is a product of two secret primes, N = p × q. Security rests on nobody being able to find p and q from N.

That holds only if the primes are unpredictable. Routers, cameras and other embedded devices often generate a key right after first boot, when there is little randomness to draw from. Two different devices can then land on the same prime.

This has been measured at internet scale:

Study Finding
Mining Your Ps and Qs, USENIX Security 2012 Private keys obtained for about 0.50% of TLS hosts because their public keys shared factors
Keyfactor, 2019 249,553 distinct keys broken, about 1 in 172 of the internet-collected RSA certificates
ROCA, CVE-2017-15361 Keys from a flawed chip library carry a recognizable mathematical fingerprint

Keyfactor also looked at about 100 million certificates from Certificate Transparency logs and found shared factors in only five of them. Keys issued through public certificate authorities are usually healthy. The weak ones live in self-signed certificates on devices, which is exactly why the owner of those devices is the right person to check.

What KeyGuard checks

Check What goes wrong How it is found
Shared primes Two devices use the same prime, so both private keys are recoverable Pairwise GCD over the keys you paste together
Close primes p and q are nearly equal, so N factors almost at once Fermat factorization with a bounded number of steps
ROCA fingerprint Keys built by the flawed library follow a fixed pattern modulo small primes Membership test of N in the subgroup generated by 65537, over 38 odd primes
Length and exponent 768 bits or less, under 2048 bits, or an abnormal public exponent Direct inspection

See it: two keys, one shared prime

Press Shared prime (2 devices). Two 2048-bit public keys go in, and one GCD reveals the 1024-bit prime they have in common.

Two 2048-bit keys broken by a shared prime

The core of it fits in a few lines:

from math import gcd

g = gcd(N1, N2)          # both values are public
if g not in (1, N1, N2):
    p, q1, q2 = g, N1 // g, N2 // g   # both keys are now factored

No supercomputer, no quantum computer. The two owners never did anything wrong. Their devices did, at first boot.

See it: a 2048-bit key in about a millisecond

Press Close primes. Fermat's method looks for a such that a² − N is a perfect square. When the primes are neighbours, it succeeds on the first try.

A 2048-bit key with close primes, recovered in 1.4 ms

In this capture the key was recovered in 1.4 ms inside a normal browser tab. The app shows shortened primes as proof and never prints the private key.

A healthy 2048-bit key gets a plain answer:

A healthy key passes all checks

Why combine the checks

Each method sees one kind of defect. The built-in benchmark uses 145 keys (80 healthy, 65 weak, fixed seed 20262025) and runs every detector on the same machine.

Detector Weak keys found False alarms on 80 healthy keys Time for 145 keys
KeyGuard (combined) 65 / 65 (100%) 0 73 ms
Size and exponent check 25 / 65 (38.5%) 0 under 1 ms
GCD only 20 / 65 (30.8%) 0 9 ms
Fermat only 20 / 65 (30.8%) 0 95 ms

Weak-key detection benchmark

We also ran two further checks:

  • ROCA: we generated 12 keys with the ROCA structure and 40 ordinary 1024-bit keys, then ran the app's own detection code. 12 of 12 flagged, 0 of 40 false alarms.
  • Scale: a batch-GCD engine from the same family processed 220,713 keys in 122.5 seconds, made of 220,707 real RSA public keys from Certificate Transparency logs plus 6 planted weak keys. It found 6 of 6 planted keys with 0 false alarms on the real ones. Only public keys were used.

Private by design

  • Every check runs in JavaScript on your device, using the browser's native big integers.
  • During our capture session we recorded network traffic while running all six samples and pasting keys. After the page loaded there were 0 requests.
  • You paste public keys only. A public key is meant to be public, and even that stays in your tab.
  • There is no account and no upload step.

Check your own devices in three steps

1. Get the public key of a device you own or are authorized to test. A certificate file, a public key file or an SSH public key all work as they are.

# certificate from a device you own
openssl s_client -connect 192.0.2.10:443 </dev/null 2>/dev/null | openssl x509

# SSH RSA public key
cat ~/.ssh/id_rsa.pub

2. Paste it. KeyGuard accepts BEGIN PUBLIC KEY, BEGIN RSA PUBLIC KEY, BEGIN CERTIFICATE, ssh-rsa lines, a hex modulus, a decimal N, or N:e. Put keys from several devices in together so that shared primes can be found. Private keys are not accepted.

3. Read the result: Safe, Caution or Danger, with the reason for each key.

Who should run it

  • Device makers: check a production batch before shipping. A shared prime shows up only when keys are compared with each other.
  • Network and IoT operators: check routers, cameras, printers and VPN gateways with self-signed certificates.
  • Security teams: use it as a first triage step in an audit.
  • Teachers: the sample buttons make a classic lesson visible in one click.

Safe here means that none of the four defect families was found. If a key comes back as Danger, retire it, update the device firmware, and generate a new key.

Responsible use

Use KeyGuard only on keys of devices you own or are authorized to test. If you find a weak key in someone else's product, report it privately to the vendor or your national CERT.

Try it

Built by VIDRAFT. Feedback is welcome in the Space's Community tab.

Community

Sign up or log in to comment