Hi everyone, I’ve been trying to understand how MiTM setups like a transparent proxy work.

Obviously, the use-case here is in a personal scope: I’d like to inspect the traffic of some of my machines. I am aware that Squid can be a transparent proxy, and some might use the Burp Suite to analyse network traffic.

Could someone explain the basic networking and the concept of certificates in this scenario? I feel like I don’t understand how certificates are used well enough.


For example: I realise that if someone inserts a root certificate in the certificate store of an OS, the machine trusts said CA, thus allowing encrypted traffic from the machine to be decrypted. However, say the machine was trying to access Amazon; won’t Amazon have its own certificate? I don’t know how I’m confused about such a simple matter. Would really appreciate your help!

  • MigratingtoLemmy@lemmy.worldOP
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 year ago

    I see. Which would mean that in cases where the application/OS can be made to blindly trust the “fake” CA (by inserting a root certificate into the certificate store, like in Android), the proxy can simply send the certificate and the client will believe that the certificate comes from Amazon. The certificate list can be refreshed by flushing the cache, yes?

    Thanks for the explanation

    • stifle867
      link
      fedilink
      English
      arrow-up
      4
      ·
      1 year ago

      There are some cases where this would not work by the way. It’s called certificate pinning and it’s basically when an application comes with the trusted certificate for a host built-in. Even if you were to override it with a root certificate in the certificate store, the app simply wouldn’t use it.

    • Monkey With A Shell@lemmy.socdojo.com
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      That’s the sum of it. Like others and I have noted some mobile apps (and Apple phones in particular have their entire OS configured to not trust any intercepted certs when attempting to speak to Apple home base) are prone to using certificate pinning and will reject the intercepted certs regardless of the trust store. It’s mostly beneficial for adjusting the browser.

      If I might ask, what’s the purpose of this proxy? Functionally there are a lot simpler and more efficient ways to block traffic from a phone. If it’s more for traffic inspection I’ve seen a couple VPN based pcap apps for Android that could get a lot more detail while a DNS filter could both control and give visibility to traffic from the device without all the cert hassles.

      • MigratingtoLemmy@lemmy.worldOP
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        Thanks, I didn’t realise that certificate pinning was this strict.

        This effort is to check if my mobile has a baseband processor that might be communicating with the internet. I want to know if my device has a backdoor in hardware. The idea with a VPN has me intrigued, could you tell me more about that?

        • Monkey With A Shell@lemmy.socdojo.com
          link
          fedilink
          English
          arrow-up
          3
          ·
          edit-2
          1 year ago

          https://play.google.com/store/apps/details?id=app.greyshirts.sslcapture

          Something like that should ship all traffic through a local VPN adapter and output a standard pcap file.

          Another option if you have a bit more fancy networking available is to set up a security onion instance, then mirror a port on the network and just capture everything at an on-wire level. That would also cover things beyond just web traffic to catch other things like ssh or whatever other remote connectivity could be in play. Seeing the content of the connection is different than just seeing the connections existence though. The endpoint generally has the best visibility before data gets pushed into a a connection but unless you start getting into kernel level debugging it can still be hard to see into the behavior of internal applications.

          https://play.google.com/store/apps/details?id=eu.faircode.netguard

          This is also a local VPN way of seeing all the outgoing traffic along with allowing control of it as a local firewall.

          • MigratingtoLemmy@lemmy.worldOP
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year ago

            Hi, thanks for the resources. However, I don’t think I’ll be able to decrypt the traffic from my mobile using this, yes? Using a VPN for this is a great idea though, this also happens to be how NoRoot firewalls work on Android