I was about to stick my foot in my mouth by saying 4 is not a prime number. But I did a double-take and, yes, 4 is a perfectly valid EC key. It's only the modulus and the generator's order that need to be prime. Not only that, but restricting the possible values to primes would greatly reduce the field and thus lessen security.
I've had that false notion lingering in my head for years, and you fixed it with a single shitpost.
So you generate a public key using said private key. In this case, it used elliptic curve cryptography. Here, you take a base point that lies on a elliptic curve, multiply it by your private key, which will generate a new point on the curve. The base point and specific curve are defined by the standard used, in this case NIST P-384.
Because of this, the certificate looked like any other certificate. The certificate itself is just a base64 encoding of a bunch of stuff like what type of encryption is used, who issued it, time period it is valid for, etc. And of course the public key.
To simplify it, imagine that someone draws you some finite squiggly line. You then put a point on it, and then another, and another. Until it's so dense, that these points look like that line in the first place.
You now choose a random point, call it P. Imagine that "adding P to P" points to another, different point, 2P. And as you keep on adding, you jump from a point to another point, never hitting the same starting point again. Until you do, and from there on you jump to exactly the same points you previously jumped to.
It's a cycle. The number of points on that curve, and the number of times you have to add P to itself are equal.
Adding P to P is simple. But imagine I'm choosing another point, Q. And I'm asking, how many times do I have to add P together so that it returns Q?
This is the basis for the security behind elliptic curve cryptography. It's extremely difficult to find such k, that k*P=Q. But it's super easy to calculate Q once you know k and P. Iterating over all possible values of k will take longer till the heat death of the Sun, so that's out.
So are the public keys fixed-length? Because if this was RSA, I believe you would have to have a pretty short public key to get that as your private key.
TLS certificates are special files that servers use to prove they really exist at the IP address they say they do (otherwise you get coffee shop hackers intercepting messages and pretending to be the server).
For the user's browser to verify a TLS certificate, it has a stored list of "top-level" TLS certificates that your everyday website can register their certificate with. So when you get the website's certificate, you can algorithmically prove it was verified at the top level, and therefore is legit.
Some of the top-level certificates had trivially breakable encryption key numbers that were recently discovered and removed. One of them was the number 4.
Why not have an RNG generate 100 numbers, and then that string of 100 numbers is they key? Why would you not put something in to prevent the key number from being 1 or 2 or even under 10 digits? Why not precede them with 99 zeros first and have it always be a 100-digit number?
To be clear, nobody decided to make the key be 4. That would be a terrible idea. What happened is they set it to 4 for testing purposes, and then they forgot to change it. The key was supposed to be a random 115-digit number.
You're supposed to pick a 4096 bit random number (huge, many digits). Random of course means that 4 has just as much of a chance of being picked, but the rules say that the number also can't be less than 256 . Someone made a big oops and overrode those rules, setting it to 4. A bored person just trying the first few numbers stumbled across 4 being valid
And this will require weeks to months of patching everything, because certbundle management across many applications and languages is a clusterfuck. Especially once containers are involved.
Sorry for sounding bitter, but the PHP 9.2 vulns now go straight into this shite. At least it was just 1% of revenue for eMudhra. It could have hurt the company otherwise! Who cares about the thousands of hours we now have to spend cleaning up their crap.
The compromised eMudhra keys were defective at a level that’s challenging the imagination of many of the engineers studying the incident. A normal size for a NIST P-384 elliptic curve cryptography private key contains roughly 384 bits of entropy, a size allowing almost 2384, or a number with 116 digits, different possibilities. The private key sizes of the compromised keys ranged from 3 to 8 bits. Astonishingly, the private keys were 4, 56, 66, 115, 155, 156, 230, 237.
I heard about the first one but what the hell, they were all like that?? The person brute forcing them would have seen that finish before standing up to go grab a coffee
I read somewhere that the internal tool or script they used to generate their keys was flawed so it only used the first byte of a byte array as the key. Pure r/programminghorror
Hey genuine question, why in the hell would someone go out of their way to use a one digit number for a private key when most utilities that generate them with proper syntx and formats normally always generate very long hashes/ random patterns. Isnt this like counter intuitive? if anyone even wanted a random numher, the good ol keyboard mashing would've done better than this
The simplest explanation is that they did everything right and we just happen to exist in the universe where they were randomly assigned single digit numbers from of a range of 0 to far more particles than there are in the observable universe.
you don't need simple test key though. they're going out of your way to make your "test" less representative of the real thing.
There's no reason it should've existed in test either. It almost would've been better to be fucked up directly into prod, because that's just one miss. This "generated god awful key" AND "mixed test and prod".
Yess exactly. Nowhere since the dawn of computer cryptography have single digit keys ever been a thing. The whole point of cryptography is that it's hard to guess, you don't make it the 4 trial in child's first brute force attempt
Like, I get how it's a "valid" key, but I also don't. I would think somewhere within someone of the utilities that do the signing, something would identify that there isn't sufficient entropy or something.
They didn't do this on purpose. You wouldn't even do this on purpose out of malice. Its their key; if they wanted to misuse it they would just misuse it.
If you RNG is truly random, it needs to allow 4 to be a possibility, if you start at 10 000 for exemple, 10 004 is as quick to find as 4 if you start at 0.
I'm curious what the knock ons of this are. I've been annoyed how many CAs I accept by default and wondering if I should pare it down, and that was my idle paranoia. Now this shit happens and it doesn't seem like paranoia anymore. just good safety. The fuck site do I need that "eMudhra" was going to sign for?
They're still in business, as the Certificate Authority gig was a small part of their operations. It's worth noting that this has resulted in a significant blow to their stock value, however
eMudhra is a MASSIVE company bro. They shunted their SSL/TLS certs department, less than 1% of their revenue. Didn't even fire anyone yet, at least publicly.
Using public-private key encryption you create a private key. That private key can be used to create certificates that can be signed and then verified using the public key.
Basically someone figured out that their private keys that were literally just the numbers 4, 56, 66, 115, 155, 156, 230 and 237. Those numbers are supposed to be 116 digits long making them impossible to guess. Meanwhile their keys were 1-3 digits in length.
If you know the private key you can create a certificate and pretend to sign things on their behalf. In this case all 8 of those keys were figured out by counting from 1-237 and trying them all. It's beyond dumb and likely just test keys that accidentally got used.
It's beyond dumb and likely just test keys that accidentally got used.
"Everybody knows everyone uses keys that are 116 digits long...nobody would bother to try and brute force check our keys starting from the number 1...they'd obviously start at the number 1x10¹¹⁵, so it's extra safe to use low numbers that everyone is just going to skip over"
eMudhra’s statement about the incident says it generated keys during “a Key Generation Ceremony (KGC) held on April 30, 2025, using FIPS 140-2 Level 3 Hardware Security Modules (HSMs).”
Such hardware is the standard kit for the job and should in theory produce nicely complex keys and store them securely.
But something went wrong.
“A flaw in the KGC caused a wrap/unwrap step to produce a second set of weak keys alongside the original strong keys,” the statement claims. “The weak keys were the ones published to the browser root stores. eMudhra is working to establish the root cause.”
So I looked into it more and they are claiming that they generated 2 sets of keys, one of them purposefully weak for some reason and published the wrong set.
No, if I remember correctly, the key must be the product of two prime numbers, ideally two very large prime numbers, but technically speaking any two prime numbers will produce a valid key. (Determining which numbers is a p=np problem which is great for encryption)
4 is the lowest possible value for the key being the product of the prime number 2 and the prime number 2.
This is true for RSA- essentially, the private key is two prime numbers, and the public key is their semi-prime product. Getting to the public key from the private is easy, while going backward is not. Mostly.
Shor's Algorithm can theoretically factor a semi-prime correctly 50% of the time, and it's trivial to check if the answer is correct and if not, try again. That requires a quantum computer with enough storage to represent the key, which..may not exactly exist but is kinda what people are talking about when they say RSA isn't quantum-safe - a sufficiently powerful quantum computer can crack it pretty trivially.
There are quantum-resistant asymmetric ciphers that don't depend on the semi-prime problem, but tbh I don't really know how they work.
The key is not a prime number, the private part is the prime number. So in this case 2 is the private key, 4 is the public key... literally the smallest possible.
yes, depending on the algorithm. RSA requires it to be prime, not because of any security properties, but because if it wasnt you wouldnt be able to satisfy the property D_k(E_k(m)) = m (decrypting encrypted data gives back the original message). however, other algorithms, like ECDSA (which was used here) and EdDSA, doesnt have this requirement and thus you could use any number
2.7k
u/Paul_Robert_ Oct 23 '26 •
848
u/breesyroux Oct 23 '26
I'm clearly out of the loop. Why do I keep seeing variations of this joke everywhere?
264
u/Queasy_Moment_6619 Oct 23 '26
Idempotent deterministic keygen whenever i need a key
100
u/CeeMX Oct 23 '26
-----BEGIN EC PRIVATE KEY-----
4
-----END EC PRIVATE KEY-----
126
u/Ayushispro11 Oct 23 '26
Hey genuine question, why in the hell would someone go out of their way to use a one digit number for a private key when most utilities that generate them with proper syntx and formats normally always generate very long hashes/ random patterns. Isnt this like counter intuitive? if anyone even wanted a random numher, the good ol keyboard mashing would've done better than this
79
u/6T_K9 Oct 23 '26
It’s even worse than that. The 8 super secret ultra important private keys were:
4, 56, 66, 115, 155, 156, 230, 237….
What the fuck?
116
u/Stummi Oct 23 '26
Technically, it was eMudhra who set the bar too low.
60
u/Fantastic-Fee-1999 Oct 23 '26
Perfection!
24
u/AsideLogical Oct 23 '26
Chosen by a fair dice roll. Guaranteed to be random
20
u/RoboJediNate Oct 23 '26
Well now its public, so checkmate
35
u/picuber Oct 23 '26
As always, there is a fitting XKCD
https://xkcd.com/221/
14
u/AlMasaDuun Oct 23 '26
I mean to be fair... was anyone dumb enough to try 4?
9
u/FallenVampireLord Oct 23 '26
Lol
7
u/Triscuitador Oct 23 '26
did you aee that they posted the algorithm?
7
u/ofthefuckingrivia Oct 23 '26
Fair Dice Roll
14
u/Upstairs-Ad-7962 Oct 23 '26
I feel left out, why are There so many memes about encryption key 4 now?
5
u/jorizzz Oct 23 '26
CISSP Exam be like
3
u/ApatheistHeretic Oct 23 '26
I'm certain it would be a prime number. I would've gone with 7.
3
u/Ozymandias_1303 Oct 23 '26
Surely the correct answer is "you wouldn't be able to check it if I did, because it's private."
3
u/Landkey Oct 24 '26
“Oh yeah? Name a private key” is hilarious
3
u/Cart1416 Oct 24 '26
So you like encryption? Name every private key
5
u/screw-britannia Oct 23 '26 edited Oct 24 '26
So that was the reason Firefox wouldn't load one of the indian govt. website. Oddly enough, Edge happily loaded the website.
2
u/unlinked3297 Oct 23 '26
Way too low...
2
u/fatrobin72 Oct 23 '26
id_rsa
2
u/TheRealJayk0b Oct 23 '26
Hahah yes I saw a video about this today! I KNOW THE JOOKEEE! finally I can laugh about something from this sub.
1
u/a_shootin_star Oct 24 '26
♦ 8 B s ¢ £ µ Ω
1
u/Hydra-dragon96 Oct 24 '26
Can anyone explain the context here
1
u/AlexVirlan Oct 24 '26
It reminds me of this: https://youtu.be/u8ccGjar4Es?si=uPQ2tUxdhs5iIOI9
1
u/BlakeXHunt Oct 25 '26
What can I say? Us Indians can’t lose. 🗿
1
u/dawoodur 17d ago
Sweetheart, the only thing I can give you is 'Public key'
-2
u/Sw0rDz Oct 23 '26
Can a non prime number be a key? I guess, but not very good key.
1
u/jani00 Oct 23 '26
Jizz in my pants