Say Alice wants to open up an HTTPS connection to Bob through a proxy named Earl.

What prevents Earl from reading alices request, opening a connection pretending to be bob, and then opening a https connection with bob pretending to be Alice , and snooping on the traffic as it passes through ?

  • nomad@infosec.pub
    link
    fedilink
    arrow-up
    4
    ·
    1 year ago

    This is a good question, I dont know who would downvote that.

    ELI5: Alice and bob have an aunt that knows them both and has an unfakeable voice recognition service that allows both to verify who they really speak to.

  • Sigmatics
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    1 year ago

    The security of HTTPs relies on public key certificates.

    I recommend reading up on it here: https://en.m.wikipedia.org/wiki/HTTPS#Overview

    Especially the part after this segment:

    Web browsers know how to trust HTTPS websites based on certificate authorities that come pre-installed in their software.

    • bellsDoSing@lemm.ee
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Great explanation indeed!

      I was missing this part from my understanding:

      The certificate correctly identifies the website (e.g., when the browser visits “https://example.com”, the received certificate is properly for “example.com” and not some other entity).

      In a sense it all comes down to a CA (e.g let’s encrypt) not giving out certificates for your domain, so that only your server has a valid certificate for your domain and not also some attacker.

      But that itself requires domain verification to be secure (robust against MITM attacks), which apparently it wasn’t for the longest time.

      Just recently there was a post about ACME-CAA, which addresses this issue (when configured). Great article on it here: https://www.devever.net/~hl/acme-caa-live

      • Sigmatics
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Yeah, pretty much. If you control the DNS you can do whatever

  • IAm_A_Complete_Idiot@sh.itjust.works
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    1 year ago

    This is about PKI. An HTTPS server has a TLS cert, and that TLS cert is signed by / created by a certificate authority (or CA). When you connect to a service over HTTPS, a TLS handshake happens. The handshake starts by the client asking a server to setup a session, and the server hands back it’s certificate. This certificate can be used to encrypt traffic, but not decrypt it. The client makes sure the certificate is signed by a CA it trusts (such as let’s encrypt).

    Once the client has this certificate, it sends a key to the server in encrypted form, and the server decrypts it. They both now use this key to communicate.

    The MITM server can’t compromise the session because: If it swaps the certificate (or in other words, the encryption key the server sent), that key won’t be trusted because it isn’t signed by a CA the client trusts.

    If the MITM tries to send its own shared key signed by the servers certificate - it doesn’t really matter since it can’t read the clients messages anyways to get the shared key from the client. If it forwards it, then you effectively have two separate https sessions with their own keys, and the server will treat them as distinct.