So this video explains how https works. What I don’t get is what if a hacker in the middle pretended to be the server and provided me with the box and the public key. wouldn’t he be able to decrypt the message with his private key? I’m not a tech expert, but just curious and trying to learn.

  • ZeroGravitas@lemm.ee
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    Nevermind hackers. Look up “corporation in the middle” attacks, which is a prime example of subverting secure channels at scale.

    If you don’t own the hardware, nothing you do on it is truly private. Ditto if someone else has admin access to your hardware (eg BYOD scenarios) . Inserting a root certificate into the OS is trivial in both cases.

  • JakenVeina@lemm.ee
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    An additionap note on what a certificate is, to supplement everyone here who’ve desceibe howbthat’s the missing piece:

    A certificate’s first main purpose is being the vehicle vy which the public key is distributed, but additionally it contains information ABOUT the owner. Then the whole thing is digitally signed with the private key (and also a trusted CA’s private key), so that a receiver can validate the authenticity of the cert with the public key.

    The “info” in the cert can theoretically be anything, but the most important one is the domain. Your browser knows that visiting google.com is secure because it checks the cert it gets from google.com to see if it states that it owns the google.com domain, and then we trust the root CAs around the world to make clients prove they own that domain, before issung a cert for it.

  • lostmypasswordanew@feddit.de
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    1 month ago

    All TLS/HTTPS clients have a set of Certificate Authority keys which they trust. Your client will only accept a public key which is signed by a trusted CA’s key. A proper CA will not sign a key for a domain when it has not verified that the entity that wants it’s key signed actually controls the domain.

    • mox@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      A proper CA will not sign a key for a domain when it has not verified that the entity that wants it’s key signed actually controls the domain.

      Most browsers trust many certificate authorities from all over the world.

      Any of them could…

      • be compelled by authority
      • be compelled by threat
      • be hacked
      • have a lapse in ethics
      • have a rogue employee
      • etc.

      …and yes, it has happened already.

      HTTPS as most of us use it today is useful, but far from foolproof. This is why various additional measures, like certificate pinning, private CAs, and consensus validation are sometimes used.

      • state_electrician@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        0
        ·
        1 month ago

        Many years ago I manually removed all CAs from my trust store and only added those I needed. Turned out that from roughly 160 trusted root CAs I needed about 10 to 12. I stopped because it often was very difficult to figure out which CA signed the cert for an app that was failing. The final nail in the coffin was when I was late for a business meeting and the only way to get a parking space close enough to my destination was by paying with an app I’d never used before and finding the right root CA under pressure was too much. I really wish we had more and easier control over who we trust.

      • lemmyvore@feddit.nl
        link
        fedilink
        English
        arrow-up
        0
        ·
        edit-2
        1 month ago

        I urge everybody to read up on CA records in DNS and add them to your domains. They basically say what CA the certs for that domain are supposed to come from. Even if another CA issues valid certs for the domain they would be rejected if they don’t match the CA în DNS. It takes 5 minutes.

      • zeluko@kbin.social
        link
        fedilink
        arrow-up
        0
        ·
        1 month ago

        Thats why we now have certificate transparency reports and CA-records.
        Sure not perfect, but at least with a compliant CA it wont just happen in the dark.
        At some point you have to trust someone.

  • Mubelotix@jlai.lu
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    It should also be mentioned that you can get a CA to sign your certificate just before your domain expires, so you can attack whatever website is going to buy your domain next

  • Encrypt-Keeper@lemmy.world
    cake
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    So there are two things that certificates are for. You already understand the first one, which is the cryptography itself. You can use them to encrypt your traffic so that information sent over the connection is not in plain text.

    The second thing certificates do, is the answer to your dilemma. Identification. For your browser to trust a website’s certificate, the certificate has to be valid for that website. What makes a certificate valid? The certificate has to have been signed by a trusted Certificate Authority, and the name on the certificate must match the website you’re visiting. If you were to ask “What makes a certificate authority trusted?” The answer is that your web browser and/or operating system come preloaded with certificates for trusted certificate authorities. These special certificates were used to sign the certificate of the website you’re visiting, which is another thing your browser checks for. A malicious third party can’t (easily) obtain a valid certificate/key pair for a domain that they don’t own. If your browser was presented with a fake certificate from the malicious third party, it would not connect and would warn you that your connection isn’t secure and would explain why.

    Now if more specifically, you’re wondering that if a malicious third party takes any given website’s public certificate, can it use that to decrypt your session? After all, that public cert is signed and trusted. The answer to that, is that when a certificate is created, so too is a private key file created. This private key is never presented to the public, and it’s the only thing that can decrypt sessions that were encrypted by its paired public certificate. So that third party could install that certificate on a web server theoretically, but they wouldn’t actually be able to decrypt anything because they don’t have the private key for the legitimate certificate.

    So in order for a man in the middle attack like this to work, they’d have to obtain not only a legit websites public certificate, but also the corresponding private key. OR, the third party would need to get access to your PC, and install its own certificate authority signing cert, so that it’s fake, self signed certificates are trusted by your browser. Both of these are possible, but at that point you’re not talking about an unknown man in the middle, the man would have to compromise one of the two ends.

  • elrik@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    As others have mentioned, a trusted 3rd party signs the correct key so your browser can check the key itself.

    However, it should also be noted that your browser must have a list of trusted 3rd parties and their certificates used for signing in order to perform this check. It’s entirely possible to modify this list yourself. Some examples include:

    • executing your own MITM style “*attack” in order to intercept and analyze local https traffic
    • corporate network inspection and monitoring, where a gateway does the above for all devices on the network which have a CA cert pre-installed through some policy

    So while it’s possible for trusted 3rd parties to issue valid certificates to bad actors, it’s also possible to add anyone (you, your employer, or some bad actors) to the trusted parties list.

    • Huschke@programming.dev
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      Add Norton to that list. They also perform their own MITM attack on your pc to ensure your certificates are “safe”…