Course contentsShow
← Security
Lesson 397 of 3,0529. Network Security - Traffic AnalysisFree lesson

SSL/TLS MITM with Certificate Substitution

Proxying encrypted connections by presenting forged certificates and decrypting traffic in both directions.

SSL/TLS MITM with Certificate Substitution

You'll learn how attackers intercept encrypted HTTPS traffic by replacing legitimate certificates with forged ones.

The Core Concept

When you've positioned yourself as a man-in-the-middle (using techniques like ARP spoofing), encrypted SSL/TLS traffic still remains a problem—you can see it flowing, but you can't read it. Certificate substitution solves this from an attacker's perspective: you act as a proxy, presenting a fake certificate to the victim while maintaining a separate legitimate connection to the real server.

Here's how it works:

  1. Victim connects to what they think is bank.com
  2. Your MITM device intercepts the connection
  3. You present a forged certificate claiming to be bank.com (signed by a fake CA you control)
  4. If the victim accepts it, their browser encrypts data using your certificate
  5. You decrypt the victim's traffic, read/modify it, then re-encrypt it with the real bank.com certificate and forward it along

The Weak Link

This attack only works if the victim's browser doesn't reject your fake certificate. Modern browsers check:

  • Is the certificate signed by a trusted Certificate Authority?
  • Does the domain name match?
  • Is it expired?

Attackers must either install a rogue CA certificate on the victim's system first, or hope the victim clicks through browser security warnings.

Real-World Example

Tools like mitmproxy and bettercap automate this process. They generate certificates on-the-fly for any domain the victim visits, decrypt both sides of the conversation, and log everything in plaintext.

Key Takeaway: SSL/TLS MITM with certificate substitution breaks encryption by tricking the client into trusting a fake certificate, allowing the attacker to decrypt, inspect, and modify supposedly secure traffic—but only if certificate validation fails or is bypassed.