Blog | G5 Cyber Security

HTTPS First Visit Impersonation

TL;DR

Yes, a site with HTTPS can be impersonated on its first visit by a Man-in-the-Middle (MitM) attacker. This is because the browser hasn’t yet learned to trust the certificate of that specific site. However, modern browsers quickly detect and warn users about this situation after the initial connection.

How it Works

When you visit a website for the first time, your browser needs to verify its identity using an SSL/TLS certificate. This process involves checking with Certificate Authorities (CAs) to ensure the certificate is valid and issued to the correct domain. A MitM attacker can intercept this initial connection and present their own fake certificate.

Steps for a First-Visit Impersonation Attack

  1. Network Positioning: The attacker needs to be in a position to intercept your network traffic – typically on the same Wi-Fi network or through DNS poisoning.
  2. Intercept Connection: When you try to access the HTTPS website for the first time, the attacker intercepts the initial TLS handshake.
  3. Present Fake Certificate: The attacker provides a fake SSL/TLS certificate that appears valid to your browser (often self-signed or obtained fraudulently). Crucially, your browser doesn’t have any prior knowledge of the real site’s certificate at this point.
  4. Decrypt and Re-Encrypt Traffic: The attacker decrypts the traffic using their fake certificate, potentially stealing sensitive information like login credentials. They then re-encrypt it with their own certificate before sending it to the legitimate website. You see a secure connection (HTTPS) but are communicating with the attacker.
  5. Browser Cache & Future Visits: After the initial visit, your browser will cache the real site’s certificate. Subsequent visits won’t be vulnerable unless the certificate changes or is revoked.

Why it Only Works on First Visit

Browsers use a trust store of known Certificate Authorities (CAs). When you visit a website for the first time, your browser checks if the site’s certificate was issued by a trusted CA. If it is, and other validation checks pass, the connection proceeds. However, because the browser hasn’t seen this specific certificate before, it has no way of knowing if it’s legitimate.

How Browsers Protect You

Checking a Certificate (Example)

You can view the details of a website’s SSL/TLS certificate in your browser:

  1. Chrome: Click the padlock icon in the address bar, then click ‘Connection is secure’. Click ‘Certificate is valid’ to see details.
  2. Firefox: Click the padlock icon, then click the arrow next to ‘Connection secure’. Select ‘More Information’, then go to the ‘Security’ tab and view the certificate.

Look for:

Mitigation

Exit mobile version