DEV Community

Cover image for 7 Man-in-the-Middle (MitM) Attacks to Look Out For
Mark
Mark

Posted on

7 Man-in-the-Middle (MitM) Attacks to Look Out For

Today’s man-in-the-middle (MitM) attacks go far beyond coffee-shop Wi-Fi. Attackers now target browsers, APIs, device enrollments, and DNS infrastructure, using automated proxy kits and supply-chain flaws to steal tokens, session cookies, and credentials. Once credentials are stolen, they can be replayed again and again—turning one interception into persistent access.

These attacks are no longer rare. Cyber threat automation has surged nearly 17%, with billions of stolen credentials circulating on the dark web. As a result, credential-based attacks are up more than 40%. Traditional passwords and MFA can’t hold up unless access is limited, time-bound, and verified continuously.

Security teams must adopt a zero standing privilege model—making intercepted credentials worthless. By shortening token lifetimes, using just-in-time (JIT) access, and enforcing continuous verification, you can reduce the risk of long-lived access abuse.

What Is a Man-in-the-Middle (MitM) Attack?

A MitM attack happens when a hacker secretly intercepts communications between two parties—such as between a user and an app or two connected services. Attackers eavesdrop, modify traffic, or impersonate legitimate users, stealing sensitive data or gaining full visibility over a session.

Modern MitM attacks target API calls, machine-to-machine traffic, and agent-to-agent protocols in cloud-native environments. When a token or cookie is intercepted, the attacker gains legitimate-level access to systems and services.

Common MitM Techniques

Eavesdropping/sniffing: Capturing unencrypted traffic.

Message tampering: Altering data in transit.

Session hijacking: Stealing tokens, cookies, or certificates.

Machine or non-human identities (NHIs) are especially vulnerable. These service accounts now outnumber humans by up to 80:1, creating a massive attack surface. Without identity governance and access controls, a single intercepted token can lead to system-wide compromise.

7 Common Man-in-the-Middle Attacks and How to Prevent Them

  1. HTTPS Spoofing and SSL Stripping

Attackers downgrade HTTPS to HTTP, exposing plaintext credentials, API keys, and tokens. Misconfigured certificates or ignored browser warnings make this possible.

Best Practices:

Enforce TLS 1.3 and HSTS across all systems.

Automate certificate rotation and renewal.

Continuously validate TLS configurations in CI/CD pipelines.

  1. DNS Spoofing (Cache Poisoning)

DNS hijacking redirects legitimate domains to malicious servers. Attackers can intercept traffic, steal credentials, or issue forged certificates.

Best Practices:

Enable DNSSEC and certificate transparency logs.

Protect registrar accounts with MFA and change approvals.

Limit exposure by using JIT access and short-lived credentials.

  1. ARP Spoofing in Internal Networks

In local networks, attackers poison ARP tables to reroute internal traffic through a malicious device—sniffing or altering internal data.

Best Practices:

Use VLAN segmentation and microsegmentation.

Monitor for ARP anomalies and enable switch security features.

Encrypt internal traffic with mTLS to make sniffed data useless.

  1. Wi-Fi Eavesdropping & Rogue Access Points

“Evil twin” hotspots mimic trusted Wi-Fi networks to trick users into connecting and revealing their credentials.

Best Practices:

Require VPNs and device posture checks on untrusted networks.

Use certificate-pinned apps and disable auto-join for enterprise devices.

Detect and block duplicate SSIDs on corporate networks.

  1. Session Hijacking and Token Replay

Attackers replay stolen cookies or tokens to impersonate legitimate users or services. This type of MitM attack can bypass even MFA.

Best Practices:

Use short-lived, scoped, auto-expiring tokens.

Bind tokens to devices or certificates.

Detect impossible travel and concurrent sessions; revoke access instantly.

Platforms like Apono make this automatic—issuing short-lived tokens that expire in minutes so stolen credentials become useless.

  1. Agent-to-Target Hijacking

When agents or telemetry channels are compromised, attackers can intercept or impersonate service traffic, gaining system-level visibility.

Best Practices:

Enforce strict TLS validation and mTLS for agent communications.

Limit agent privileges and require JIT elevation for sensitive actions.

Monitor agent behavior for anomalous command sequences.

Apono enforces JIT approvals so even if an agent is compromised, its access remains limited and temporary.

  1. Weak Agent-to-Agent Authentication

Simplistic agent-to-agent communication without mutual authentication allows attackers to impersonate agents and intercept system traffic.

Best Practices:

Require mutual TLS and cryptographic signing for all agent interactions.

Use centralized machine identity management with key rotation.

Add per-call authorization and replay protection (nonces/timestamps).

A cloud-native platform like Apono manages machine identities and per-call access, ensuring overprivileged agents aren’t long-term MitM targets.

Building MitM-Resilient Access Controls

Most MitM attacks succeed not because of encryption failures, but because stolen credentials remain valuable for too long. The key to defense is reducing credential value through short-lived access, device-bound authentication, and continuous verification.

Principles for Strong MitM Security

Short-Lived Credentials – Tokens and sessions should auto-expire quickly.

Phishing-Resistant MFA – Use device-bound or cryptographic authentication.

Per-Call Authorization – Every API or agent call should require re-validation.

Zero Standing Privilege (ZSP) – No account should retain continuous access.

JIT Access Control – Grant permissions only when needed and auto-revoke after.

With these steps, even if an attacker intercepts credentials, they expire before exploitation.

Short-Lived Access, Long-Lasting Security With Apono

In the battle against man-in-the-middle attacks, the best defense is ephemeral access. Apono operationalizes this approach with zero standing privilege, automatically expiring permissions, scoped machine identities, and human approvals for critical actions.

Every credential is short-lived, every token is context-bound, and every session is continuously verified. Even if attackers intercept credentials, their window for exploitation closes within minutes.

Man-in-the-middle attacks thrive on longevity—but short-lived access removes their advantage. By adopting JIT access, mTLS encryption, and phishing-resistant MFA, organizations can ensure stolen credentials decay before they do damage.

Top comments (1)

Collapse
 
gnomeman4201 profile image
GnomeMan4201

I like that you covered non-human identities and machine-to-machine traffic, since that’s where a lot of MitM risk hides nowadays.

It might also be worth mentioning how token binding and signed request flows (like mTLS or DPoP) are becoming the next layer of defense beyond TLS alone.

Solid awareness piece overall