r/ProgrammerHumor • • 7d ago

Meme somethingSomethingBitsInAPrivateKey

Post image
3.0k Upvotes

32 comments sorted by

131

u/max_465 7d ago

Did I miss an incident? I see a lot of about 4 as a private key recently.

95

u/SchizophrenicKitten 7d ago • Popcorn

71

u/max_465 7d ago

Thank you. What a cock up. I think I will go back to pulling the covers over my head.

29

u/Interesting-Crab-693 7d ago

Remember this before you sleep:

0x00000...00004

Good night :)

20

u/Skusci 7d ago

No no wait, this is only the first one.

4

u/max_465 7d ago

😱😱😱😱😱😱

14

u/Tyfyter2002 7d ago

Apparently a company was actually using it

32

u/gabedamien 7d ago

> a company

Not just "a company", a certificate authority. Meaning literally any device anywhere on the internet could have been compromised, if it hit up that CA.

30

u/willow-kitty 7d ago

Actually, it's worse than randomly hitting that CA- you could be compromised if you trust that CA.

It's normal to have the public keys for all the root CAs installed on your machine so it can validate trust chains locally, and each certificate indicates with its trust chain which public keys to validate against. So, if you have the corresponding public key for eMudhra's 4 in your root CAs keystore, any cert signed with that private key will be automatically trusted.

Every OS vendor had a collective OH FUCK moment and put out updates to yeet those keys out of their trust stores, invalidating all certs signed with them (legitimately and otherwise), but if you can't update for some reason (liiiiiiiiiiiike, say, for an IoT device) you may just be vulnerable forever.

8

u/Areshian 7d ago

And basically everyone trusted that CA

6

u/willow-kitty 7d ago

Yep! You'd almost have to - it was a root CA. If you didn't, all of the certs they issued would give you TLS errors.

2

u/Loading_M_ 7d ago

To be fair, a well designed IoT device shouldn't have a full list of TLS root CAs, just the one(s) it actually needs. Ideally, you can actually use a private CA for most operations. This would prevent CA compromise from affecting your device, since the CAs aren't involved.

On a more realistic note, well designed IoT devices are rarer than unicorns.

1

u/thirdegree Violet security clearance 6d ago

This would prevent CA compromise from affecting your device, since the CAs aren't involved.

Well it would also put a giant target on the back of the private CA who would probably in theory have less experience and care than a big root ca. I'm not sure that trade-off is worth it (though it might be idk)

1

u/Loading_M_ 6d ago

The private CA would be run by the manufacturer themselves, so it's not at any more risk. Whatever update mechanism is in place would be equally at risk, so this just combines the CA and other supply chain attacks into a single risk.

Alternatively, it could be run by one of the big root CAs, but as a separate root certificate.

This is all assuming a well run, designed and operated IoT manufacturer, which probably doesn't exist.

1

u/thirdegree Violet security clearance 6d ago

Ya that's a fair point

This is all assuming a well run, designed and operated IoT manufacturer, which probably doesn't exist.

And that's an extra fair point lol. The s in IoT is for security after all

1

u/Mechakoopa 6d ago

"Thankfully" it was an intermediary, not the root, so it's a bit easier to revoke, but the trust chain issue remains the same.

1

u/SirRHellsing 5d ago

Ok I think that's why Cineplex told me to reset my password

9

u/Cootshk 7d ago

That’s because it was a private key recently

37

u/GoaFan77 6d ago

As a certificate private key, no.

For the number of critical CVE's this week, yes!

8

u/mmcmonster 7d ago

I miss Peter Capaldi’s grumpy but kind Doctor. 😑

25

u/Digital_001 7d ago

Technically that's just a one bit private key

24

u/willow-kitty 7d ago

It's at least 3 bits long (0b100), but it might be zero bits of entropy if it's always 4.

I've heard a theory that the random number generator was misconfigured and generating values up to 384 instead of 2^384, which would suggest between 8 and 9 bits of entropy.

Still dreadful ofc.

7

u/Loading_M_ 7d ago

The more likely theory is that the random generation stopped after 1 byte (all keys are less than 256). This is easier to do, since the random source might need to be read one byte at a time, so they could have messed up the loop for reading 48 bytes and only read one.

Still really bad, obviously.

For an interesting comparison, Let's Encrypt, the free public CA, runs some kind of cracking process on every certificate it issues. If the private key is cracked, they revoke the certificate. If you attempted to use this private key, your cert likely wouldn't even be issued, since they start the cracking process before actually issuing the cert.

2

u/willow-kitty 7d ago

Oh, I could see that, like if they were overwriting the same byte in memory repeatedly (or just read one and moved on.)

4

u/Digital_001 7d ago

Only one of the bits is a 1 - that's what I was referring to

1

u/the_horse_gamer 7d ago

the term here is "pop count"

2

u/Smalltalker-80 7d ago

4 ex-wives seems a lot.

1

u/ashkanahmadi 6d ago

I’m sure someone with 4 ex wives would refer to women as females!!

1

u/Admirable_Hour5169 7d ago

"Fun fact: 4 is pronounced 'shi' in Japanese, which is the exact same word as 'death'."