What is a man-in-the-middle attack and how can it intercept connections?

Published on 2026-10-20 by frfrand

Man-in-the-middle attacks explained: insecure networks, TLS, certificates, browser warnings, and protection measures.

What is a man-in-the-middle attack and how can it intercept connections?

Short answer: a man-in-the-middle attack occurs when a third party positions itself between two parties that believe they are communicating directly, in order to read or alter what they send. The main defense is to encrypt and verify the identity of the other end: HTTPS with valid certificates, verified host keys in SSH, and not ignoring warnings.

That intermediary may attempt to observe, modify, or redirect traffic, depending on the connection's protections.

The idea is scary, but it does not mean that anyone sharing your Wi-Fi can automatically read all your encrypted messages.

The messenger example

Imagine you send a letter to a client. A person intercepts the envelope, opens it, changes a sentence, and then delivers it. If the recipient has no way to verify who sent the content or whether it was modified, they might trust a fake letter.

In a digital connection the problem is similar: one party believes they are talking to the authentic server, but someone tries to intervene along the way.

How could it occur?

There are different situations: malicious Wi-Fi networks, manipulated DNS configurations, compromised devices, or attempts to trick the user into accepting incorrect certificates.

Not all cases have the same scope. Being connected to a public network does not prove that an attacker exists, but it is advisable to take measures to protect sensitive connections.

Does HTTPS help?

Yes. HTTPS uses TLS to protect the confidentiality and integrity of communication and, when validated correctly, to authenticate the server you connect to.

This makes it much harder for an intermediary to read or change content without the browser detecting it. But there are important conditions: you should not ignore certificate warnings, install unknown certificate authorities without understanding them, or trust fake pages just because they have a padlock.

Encryption protects the connection to the site you actually reached. If you voluntarily enter your credentials on a fraudulent domain with HTTPS, the padlock does not correct the deception.

And a VPN?

A VPN can protect traffic between your computer and the VPN exit point, depending on the protocol and configuration. It can be useful on untrusted networks, but it does not replace HTTPS nor eliminate malware or phishing risks.

It also involves trusting the provider and the destination computer. Not all VPNs have the same level of privacy.

Signs worth investigating

A certificate warning that appears suddenly, a Wi-Fi network with a suspiciously similar name to the original, or unexpected redirects deserve attention.

But not all these symptoms prove a man-in-the-middle attack. An incorrect system date, an enterprise traffic inspection configuration, or a misconfigured server can also cause certificate failures.

The prudent thing is to stop sensitive operations and verify through a trusted channel what is happening.

How to protect an application?

Use TLS correctly, redirect HTTP to HTTPS where appropriate, keep libraries and certificates up to date, verify domain names, and protect administrative accesses.

For applications that handle money, accounts, or private information, it is also useful to review session, cookie, and security header handling. An encrypted connection does not replace a secure backend.

What about SSH?

SSH also uses cryptographic mechanisms to protect connections and authenticate the server. Verifying the host key helps detect suspicious changes and avoids blindly trusting any machine that responds.

Automatically accepting a new key without checking it when there is a warning can waste that protection.

How does it fit into ArduMaker?

In ArduMaker, when publishing a domain on a VPS you can request that its HTTPS certificate be issued, and the host's nginx serves port 443 with TLS. For administrative tasks, the VPS SSH opens on a port with optional expiration. The first time you connect, check the host key fingerprint before accepting it: you can view it from the web terminal of the panel with ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub.

In short: an intermediary seeks to intervene in a communication. Encrypted connections and proper destination verification are primary defenses, but security also depends on not handing over information to fake sites.

Frequently asked questions

Is public Wi-Fi dangerous if the website uses HTTPS? The risk drops significantly: an intermediary can see which domains you connect to, but cannot read or modify the content without triggering a certificate warning. What is dangerous is accepting that warning.

What is HSTS? A header with which a site tells the browser to connect only via HTTPS for a certain period of time. It prevents an intermediary from forcing an initial connection over HTTP.

Related: What is HSTS · What the HTTPS padlock really protects.

Sources: TLS 1.3, RFC 8446 · HTTPS on MDN.

What is a man-in-the-middle attack and how can it intercept connections?
  • MITM
  • seguridad
  • redes

Keep reading

All articles · VPS plans