Currently I'm working with mitmproxy and intercepting some HTTPs traffic using it. Before I could use it in my browser, I had to trust the certificate via my OS settings. After that, the certificate was trusted by my machine and browser didn't complain. This self signed certificate sent from mitmproxy server got me thinking if it would be possible for an attacker to get his certificate signed by some trusted authority (not mitmproxy like in example above) and to use his own keypair which would be in that certificate to serve it and perform MITM attack and escape the fact that someone needs to trust the certificate after receiving it? It would be the same as getting certificate signed for any newly formed https website, just in this scenario, attacker would be using it to serve certificate for sake of having his own key pair so he can sniff traffic and for victim to have it trusted initially in his browser.
So the procedure would be following:
- Attacker generates certificate with his own keypair
- He gets trusted certificate authority to sign it
- He starts mitm proxy server and places that newly signed certificate instead old self signed certificate
- Victim starts using that proxy and tries to navigate some web page and now due to the fact that the certificate that person got was signed by trusted authority, browser won't complain and the victim won't notice anything.
- Attacker will sniff all traffic
Is there something I'm missing here? Is this possible to do and are trusted certificate authorities trying to prevent something like this because for me it sounds really easy thing to achieve? Please correct me if I'm wrong on something.