Eight Bits of Trust; eMudhra's CA keys cracked in milliseconds

(scotthelme.co.uk)

247 points | by hkc 2 hours ago

28 comments

  • jasonjayr 26 minutes ago
    > It's fortunate that the steps required here aren't particularly complicated for the devices you can update, and the advice essentially boils down to 'update them'. The problem is the devices you can't update or update easily.

    > Update everything that ships a CA bundle: your OS ca-certificates package, certifi, Node, Homebrew, and rebuild your container images once the base images pick up the change.

    > Devices you can't update are the hard part. Routers, printers, TVs, appliances with frozen firmware will trust these certificates until expiry, which is July 2039...

    Quick -- we need to MITM all the smart TVs so they can be jailbroken in one fell swoop!

    • justincormack 5 minutes ago
      Some of them seem to do some cert pinning
    • mschuster91 8 minutes ago
      > > Devices you can't update are the hard part. Routers, printers, TVs, appliances with frozen firmware will trust these certificates until expiry, which is July 2039...

      The interesting question is, how many of these devices will have the compromised CA root certificate in place?

      Oh and another thing is problematic, many a Java app ships with its own keystore.jks if it needs to trust some privately hosted endpoint, and that keystore.jks may or may not contain the compromised CA root certificate... updating the OS will not catch this kind of stuff.

    • binyu 22 minutes ago
      [dead]
  • jlmorton 2 hours ago
    In retrospect, having 100 trusted certificate authorities might have been excessive.
    • tclancy 1 hour ago
      In retrospect, not having a tiny competency check may have been an oversight.
    • BirAdam 1 hour ago
      or, perhaps you need more so that one being stupid doesn't effect so much.
      • epanchin 29 minutes ago
        Each CA is like a padlock locked in series with other padlocks. The weakest padlock is the only one that matters.
      • caaqil 30 minutes ago
        > perhaps you need more so that one being stupid doesn't effect so much.

        So you create more surface area for vulnerability? We might already be at or close to the sweet spot. Security is hard.

    • otabdeveloper4 1 hour ago
      Correct, we only need zero.
      • sebzim4500 50 minutes ago
        Interesting, what would be the alternative?

        I mean specifically for the use case of the browser warning the user if there is a MITM between them and e.g. their bank.

        • lukewarm707 2 minutes ago
          For me the complexity of anything connected to public internet is now over what I can secure.

          I genuinely can't say I secured a PC, when it needs to phone home for a configuration at this point.

          We are most likely over the line for needing to airgap a personal PC.

        • josephg 44 minutes ago
          Make dns secure and put certs / public keys in dns. Control over dns already gives you the right to get tls certs. It should just be connected directly. We don’t need CAs.
          • braiamp 26 minutes ago
            That still requires trust stores to be distributed to the clients and some clients don't need that baggage on the dns. Also, dns is by default insecure, dnssec is a configuration nightmare
            • otabdeveloper4 18 minutes ago
              > That still requires trust stores to be distributed to the clients

              There's no such thing as a "trust store" in practice. To be "trusted" you just need to demonstrate you have control over a DNS TXT record, and we don't need a special "store" or intermediary for that.

              Certificate authorities are an artifact of a bygone time and an entirely different model of internet infrastructure.

          • shiandow 38 minutes ago
            Making DNS secure is not trivial though. In a way that's just moving the problem.
          • asksomeoneelse 40 minutes ago
            But how do you make DNS secure without CAs?
            • growse 38 minutes ago
              You just have one big one on the root.

              (Half joking).

        • embedding-shape 46 minutes ago
          The first time you go to the bank, you do the "trust exchange" (maybe scanning a QR? People sure love that) that verifies future connections, similar to how you acquire digital certificates today when you deal with the government online and similar.

          Edit: > Every time you access your bank on different devices normalizes it so that visiting a typo domain would show the dialog and many would just click through.

          Show the dialog? What dialog? There is no dialogues here, you cannot login to the bank unless you've verified the connection. You do it with your phone, then you can propagate the trust from there to other devices if needed.

          • bluehatbrit 20 minutes ago
            Not all banks have physical locations, not everyone has the ability to get to the ones which do.

            You can't walk back from the existing expectation and ease of use we have today. It's just not going to happen, people will opt for the current path because it's easy and seems good enough to them.

            Most normal people don't even know this whole thing is going on. They don't know the difference between http and https other than "it's secure".

            If we want to improve on this, it has to come with the current level of ease of use at a minimum.

          • whywhywhywhy 43 minutes ago
            Every time you access your bank on different devices normalizes it so that visiting a typo domain would show the dialog and many would just click through.
          • lirolero 17 minutes ago
            [dead]
  • eviks 6 minutes ago
    > recovered all of them from their public certificates on my laptop just now, and it took less than a second.

    Why wasn't this second spend by the parties accepting those certificates as valid before they were accepted?

  • WalterGR 2 hours ago
    Related: https://news.ycombinator.com/item?id=50166579

    “eMudhra intermediate CA compromise” | 947 points | 19 hours ago | 408 comments

  • bombcar 2 hours ago
    Of COURSE it's easy to crack, 4 isn't even prime!
    • DavidSJ 1 hour ago
      In their defense, they were probably targeting the Mersenne prime 2^2 - 1 and just made a typo.
      • throw0101a 1 hour ago
        > In their defense, they were probably targeting the Mersenne prime 2^2 - 1 and just made a typo.

        There are two hard problems in computer science: naming things, cache invalidation, and off-by-one errors.

    • wolfi1 59 minutes ago
      ok, it's joke. but for those who don't get it: elliptic curves don't need primes
    • joshuat 2 hours ago
      It’s really impressive no one caught their three previous private key values
      • bcvvvy 2 hours ago
        I suspect they did but it wasn't publicised.
    • chompychop 41 minutes ago
      They should have gone with 57. Everyone knows it's prime.
    • delibes 1 hour ago
      • lta 24 minutes ago
        It's been a while since this one popped up. It's surprising how many of those doodles are surviving the test if times, in the midst unexpected ways
    • walrus01 1 hour ago
      Hey, that's the same combination I have on my luggage!
  • supernes 1 hour ago
    Two more things to note about impact assessment: Flatpak uses the selected runtime's baked-in trust store (I think), so any apps may be susceptible even if you update the system package. Containers also don't inherit the host's trust store and use the one from the base image.
  • tniemi 1 hour ago
    Someone used the Dilbert random number generator. https://www.random.org/analysis/
  • nmeofthestate 34 minutes ago
    I wonder how someone stumbled upon this - maybe leaked by someone inside eMudhra?

    Since there's nothing to indicate that the private key was all zeroes and one non-zero lsbyte, and presumably nobody would try to brute-force a private key.

    • hnfong 25 minutes ago
      Of the thousands of people bored with a swarm of AI agents, is it not plausible that somebody would just say "hey, let's do a vibe check to see whether any CAs are trivially crackable"?
    • consp 24 minutes ago
      > and presumably nobody would try to brute-force a private key.

      Why not? There are examples of RNGs providing very poor entropy which might be a reason to check it (looking at you Sony).

      • nmeofthestate 12 minutes ago
        Just seems weird for anyone to focus on trying to crack private keys starting with absurd 8-bit values that "nobody would use for a private key", let alone bother to do it at all, given the search space.
        • consp 4 minutes ago
          I would not expect anyone to be on the lookout continuously, but like the researcher doing a "yolo" and trying. There are enough people out there that it is likely to happen at least once in a while. Or for instance someone looking for a firmware exploit in a downstream device.
  • sylware 4 minutes ago
    The CA concept itself is flawed, unless normal users were able to cherry pick the CA they do trust, dream. And even with that, they must keep in mind that many authorities and/or mafias have very probably rogue certificates for browser invisible man-in-the-middle.
  • tclancy 1 hour ago
    I will say, there’s something almost reassuring when something goes boom that badly and the story is really silly. It’s like [horrific human-caused disaster] but it’s because of a Three Stooges episode.
  • positive-spite 2 hours ago
    That's some criminal negligence right there.

    8 bits is crazytalk!

    • bombcar 20 minutes ago
      Isn't 4 simply 2 bits?

      Silly 2-bit outfit.

      Maybe it's 3 bits.

      • patrickthebold 11 minutes ago
        I think the way that the bits are counted is based on the pool from which the number was randomly drawn. So it's possible they had 256 bits of entropy but got really unlucky.
    • joshuat 2 hours ago
      “4”

      hey chatgbg what is a “private key”

      • Agentlien 1 hour ago
        As someone from Gothenburg, Sweden (often referred to as gbg) I shall answer:

        A private key is a tiny number you don't need to share publicly because it is easy enough to guess.

      • Hamuko 1 hour ago
        Maybe they were counting on the fact that usually the right answer to “I’m thinking of a number between 1 and 10” is “7”.
  • mnx 23 minutes ago
    I made test.key4.lol if you want to quickly check if your device/browser is vulnerable still.
  • TazeTSchnitzel 1 hour ago
    Could HN start feeding submissions through Pangram so us human readers don't have to suffer with reading the nauseating AI-prose?
    • swiftcoder 1 hour ago
      Count yourself lucky - compared to Claude's prose, this is fairly readable.
    • jadamson 1 hour ago
      It reads fine to me. If it is AI, I'd like to know which one so I can use it too.
      • stratos123 1 hour ago
        It reads okay to me too, yet Pangram says it's mixed - the "What a private key actually is" section is AI, so is 'Why "it cannot be contained"' and some others.
      • TazeTSchnitzel 1 hour ago
        I think it's a hybrid text. The section about how elliptic curve keys work is particularly aggravating. Unfortunately it's also the only section that gave me new information.
      • karel-3d 39 minutes ago
        It has parts that are human written and parts that are generated. I couldn't tell at first, but now seeing it in Pangram, it's kind of clear.
    • marsven_422 1 hour ago
      [dead]
  • Qision 2 hours ago
    It feels like they chose the private keys by hand.
    • muvlon 1 hour ago
      My bet is on one of

      - A sequence number being accidentally used as the private key or

      - The private key being generated securely but then accidentally truncated to 8 bits (e.g. writing a single char into a zeroed buffer when you should've memcpy'd from a char*).

      The sequence number idea is supported by the fact that two of the G3B private keys are consecutive numbers. I ran a quick Monte Carlo simulation and if I got it right, sampling 8 keys from [0,255] uniformly at random (as in the truncation scenario), you'd expect them to contain 2 consecutive numbers only about 18% of the time.

      • account42 1 hour ago
        All the numbers also have digits going from left to right on a keyboard. I think the manual "random" input theory is plausible.
        • muvlon 17 minutes ago
          Oh wow, that is even more damning. Only 146 out of the possible 256 keys have this property. You only have about a 1% chance to get that 8 times in a row (A little more than 1% if sampling with replacement and a little less if sampling without. You'd expect them to at least not use the exact same key twice but at this point???).
      • Avamander 53 minutes ago
        Some error code being used? FIPS mode gone wrong?
    • PalmPilotProMax 2 hours ago
      Artisanal cryptography. Hand-picked private keys salted with organically sourced nonces.
      • tclancy 1 hour ago
        Brooklyn-based. Guy in overalls and a waxed mustache hands out the bits.
      • account42 1 hour ago
        Sharing is caring after all.
      • donandon 1 hour ago
        Made with love
    • Fabricio20 1 hour ago
      The fact that there are more than the "4" one, and all the low numbers are below 384 (384 being the bits for private key) makes me think whoever was creating these thought "Oh a random number between 1-384" let me choose... 4! (156, 230, 115, 56, 66, 237, 155)...

      https://xkcd.com/221/

    • walrus01 1 hour ago
      A long time ago one time pads used to be chosen by hand by women picking numbered lottery balls out of a spherical tumbling machine on a table.
  • sscaryterry 1 hour ago
    I wouldn't be surprised if we learn in the near future, that this was deliberate.
    • edent 1 hour ago
      I'm not so sure. If you wanted to be deliberate, you'd choose a plausible value that you could control.

      No one is going to suspect `98761316832165974216498789746` is anything other than random. But `000000000000000123` looks suspicious.

      • sscaryterry 1 hour ago
        Why are many of them, suspicious?
        • kenniskrag 41 minutes ago
          The probability of getting a 0 is the same for every digit. However, in my opinion, the probability of getting a number that starts with two zeros is 1/10 * 1/10, and the probability of getting a number that starts with the same two digits is 10 * 1/10 * 1/10.

          But the probability to receive one number or the other are the same.

        • matsemann 58 minutes ago
          By random chance you probably wouldn't get that many zeros. Of course, one could say it's just as random as any other string, but..
          • sscaryterry 45 minutes ago
            Not a mathematician, but I'm sure the probability of them all being below 384 is going to be in the order of 0.000000001% if not less :)
            • kenniskrag 38 minutes ago
              10 times the amount of digits is the possible number space.

              smaller than 384 means 384 numbers (including 0) divided by the amount of possible numbers (see above) imho

    • hannob 1 hour ago
      Makes no sense.

      If it was deliberate, one would use keys that only the person abusing it has. Not keys everyone can guess if they get a hint.

      • bombcar 18 minutes ago
        Deliberate deniability - if you leak a real key, it's pretty obvious you leaked a real key.

        Here, you didn't leak anything, you just fucked up.

    • yoavm 1 hour ago
      Why would it be?
      • sscaryterry 1 hour ago
        Do I honestly need to enumerate what you can do if you have the keys for a CA?
        • swiftcoder 1 hour ago
          Yeah, but if you are the one issuing the CA's private key, you already, by definition, have the keys to that CA. You don't need to make stupid keys in that scenario
          • sscaryterry 56 minutes ago
            In case it wasn't obvious. The NSA and many other organisation would find this extremely useful.
            • yoavm 40 minutes ago
              But it doesn't make sense. Sure they'd find it extremely useful to have the key, but it doesn't need to be a weak key for it to be useful. If anything, it makes it less useful to them.

              If I'm going to ask you or force you to share your password with me, there's no reason I'd ask you to set the password to 4. We might as well agree that the password would be D#!(s9fj0jalk!4af095SF42 , and it's much more likely our collaboration will continue working for years.

              "Never attribute to malice that which is adequately explained by stupidity"

    • skywhopper 1 hour ago
      Sounds more like extremely sloppy procedures. Which depressingly I doubt are unusual among CAs.
      • sscaryterry 42 minutes ago
        As far as I know, to become a CA, with the requirements and ceremonies involved, this type of mistake must never happen. Assuming malice instead of ignorance is reasonable here. The entire premise of a CA, is trust.
  • dbcooper 1 hour ago
    All the numbers were under 384. Surely they couldn't have ...
    • MrDOS 1 hour ago
      All the numbers were under 256. Surely they did.
  • karel-3d 15 minutes ago
    Crypto nerds: "we need to worry about post quantum crypto! we need to worry about AI breaking foundational math that we use for cryptography! make new cryptographic algorithms yesterday"

    some random CA: "lol. 4."

  • hypfer 1 hour ago
    This is not a good write-up. Yesterday's discussion did contain better data, less self-Promotion and actually asked why it happened, instead of just saying "number small".
  • joelkoen 44 minutes ago
    Someone else has published usable .key files here: https://github.com/Fluepke/emudrahahahahaha
  • maeln 2 hours ago
    eMudhra explanation : https://bugzilla.mozilla.org/show_bug.cgi?id=2083449#c11

    Kind of hard to understand how a bug would have generated a second pair of key so bad, and how would human would have ended up using them. Never attribute to malice what can be attributed to stupidity, but sometimes you wonder.

    • sobkas 1 hour ago
      Any sufficiently advanced malice is indistinguishable from stupidity.
    • dist-epoch 1 hour ago
      And an equal amount of stupidity in the whole ecosystem, apparently there are no "unit-tests" for trivial failure modes, like 8 bits of entropy, before adding a CA to the trusted list.

      What next, googling the public key finds a 2 year old pastebin with the private key?

      • silvestrov 1 hour ago
        Even just a human glancing at the private key should do it.

        Don't they even test script changes on a staging server? How could there be such a script error in production that was not caught in testing/staging?

        This sounds very like a fundamental organization error, not an innocent whoopsie. It should lead to a permanent ban of the organization.

        • karel-3d 38 minutes ago
          Well humans should NOT glance at private keys! That is the whole point of HSMs!
          • consp 7 minutes ago
            I'm still flabergasted the HSM allowed this key to be generated. Then again, I've worked with HSMs, there are always many mistakes in the firmware, usually less severe though.
            • karel-3d 3 minutes ago
              It seems there was some issue with the ceremony with some wrapping/unwrapping scripts.

              They explicitly said they wanted to export the keys from the HSM; the keys were intended for USA/Europe (for sovereignty reasons) but were never actually used.

              It seems the HSM itself worked, their ceremony around wrapping/unwrapping didn't.

  • dist-epoch 1 hour ago
    > and no TLS certificates chaining to these CAs ever showed up in CT

    Why are browsers trusting CAs which issued zero certificates since their creation 1 year ago?

    • skywhopper 1 hour ago
      These are intermediate roots, signed by trusted root certs, so the trust from your OS or browser is implicit to the roots it trusts.
      • akino_germany 44 minutes ago
        Yes, but there was no TLS cert issued that had these intermediate certs in its chain of trust at all anywhere. So why are they a CA if they don't issue any certs?
  • siwatanejo 2 hours ago
    • Qision 1 hour ago
      Literally the tutorial they used
  • AlexITC 36 minutes ago
    Another very unfortunate even next to the php, fun times we are living in.
  • glimshe 1 hour ago
    "Hah! 0x000...0 is the most secure private key I could use because nobody will think of trying that! Too obvious! Just like my 1234 bank pin!"
  • koolba 1 hour ago
    What the chances there’s another CA key out there with something like unix time as the key?
  • naabozaurus 2 hours ago
    hey, at least it was easy to remember...