VOOZH about

URL: https://dzone.com/articles/securing-https-client-side-interception

⇱ Preventing Client-Side Interception Attacks


Related

  1. DZone
  2. Software Design and Architecture
  3. Security
  4. Securing HTTPS From the Inside Out: Preventing Client-Side Interception Attacks

Securing HTTPS From the Inside Out: Preventing Client-Side Interception Attacks

Learn how such attacks occur, how attackers intercept and manipulate encrypted traffic, and what practical defenses can effectively prevent HTTPS interception.

By Oct. 10, 25 · Analysis
Likes
Comment
Save
1.9K Views

Join the DZone community and get the full member experience.

Join For Free

Overview

HTTPS is the most common mechanism used to protect client-server communication on the internet. Most teams focus on SSL/TLS and server-side hardening — and for good reason — but security is layered: the system is only as strong as its weakest link. This article focuses on a specific class of HTTPS man-in-the-middle (MITM) attacks that is not widely discussed. The aim is to harden one of the weaker links in many deployments.

If you believe it’s perfectly safe to use a banking site over HTTPS on a device that isn’t yours (a friend’s laptop, an office machine), please read on.

Introduction

Client-server applications are everywhere — laptops, smartphones, smart TVs — all routinely connect to remote servers to fulfill requests. The client-server model isn’t new, but it has exploded in popularity because:

  • Computers are smaller, decentralized, and more affordable.
  • Networking is more reliable and cheaper.
  • Smart devices have reached a much larger population.

Security is a major challenge for client-server architectures. In a monolithic app, security controls are easier to centralize; when clients can connect from anywhere, attackers have many more opportunities to interfere. Ensuring security across distributed clients is therefore harder.

Common Client-Server Communication Channels

  • Over the public internet
  • Over a local network

Using HTTPS is the default best practice, and many people feel that “HTTPS = secure.” Unfortunately, HTTPS can be exploited — in some measurements, a very large fraction of HTTPS servers were shown vulnerable to trivial MITM attacks.

Reference: https://news.netcraft.com/archives/2016/03/17/95-of-https-servers-vulnerable-to-trivial-mitm-attacks.html

What Is a MITM (Person-in-the-Middle) Attack?

A MITM attack involves three parties:

  1. Client
  2. Server
  3. The interceptor (traditionally called “man in the middle”)

Terminology note: the industry is evolving — “Person in the Middle (PITM)” is a more inclusive and accurate term.

Victims (the client and server) are usually unaware that their communication has been intercepted. That’s the essence of the threat.

Lesser-Known Reality: When the Client Is the Attacker

We typically design systems to protect clients from external attackers. Less thought is given to the scenario where the client itself is a threat actor — intentionally modifying or replaying traffic to gain an unfair advantage.

Put simply, the consumer (client) can sometimes be the attacker.

Example: A travel site uses HTTPS and two-factor authentication to protect users, but if its API workflows are poorly designed, a consumer could intercept and replay or modify requests to obtain a $1 ticket repeatedly. The client — acting as the “person in the middle” — exploits a weak server workflow.

Later sections show how such attacks are performed by end users and how to prevent them.

Client/Consumer Types

Different client types require different defenses:

  • Thick (native) client: Non-browser clients provided by the vendor (banking desktop or mobile apps).
  • Browser-based client: Users access the service via a browser.

From the vendor’s perspective, the choice matters: prevention strategies vary by client type.

Tools Frequently Used for MITM

Popular tools that make HTTPS MITM easy include:

  • mitmproxy
  • Fiddler
  • SSLsplit

How These Attacks Are Performed (High-Level)

  1. Install a self-signed root certificate on the target device.
  2. Redirect traffic through a proxy (the interceptor).

This creates two TLS sessions:

  • Client ↔ Proxy (using the proxy’s self-signed certificate)
  • Proxy ↔ Origin Server (using the server’s real certificate)

The proxy can then read or modify traffic between the client and server. 

Prevention Mechanisms — Provider (Server/Vendor) Perspective

Thick (Native) Clients

Option 1 — Certificate Pinning

Pin the server certificate (or public key) inside the application. The app performs the verification; if traffic is intercepted by a proxy presenting a different certificate, verification fails, and the connection is rejected.

Optional: Use client certificates to authenticate the client to the server.

Notes:

  • Certificate rotation and expiry must be handled gracefully — updates may require app updates or a robust pin-rotation strategy.
  • Consider an automatic pin update mechanism tied to a trusted channel.

Option 2 — Message Integrity and Confidentiality at the Application Layer

Sign all requests and responses (HMAC or asymmetric signatures). The server validates request signatures; the client validates response signatures. If a proxy modifies payloads, the signature check will fail.

If confidentiality is required beyond TLS, encrypt messages at the application layer as well. Since a proxy terminates TLS, application-level encryption prevents plaintext exposure at the proxy.

For replay protection, include a unique ID or nonce per request and require server-side validation of uniqueness/timestamp.

Notes:

  • Symmetric or asymmetric keys can be used depending on the threat model and key distribution constraints.
  • If you apply integrity, confidentiality, and replay protection at the application layer correctly, TLS’s role becomes less critical for these properties — but TLS still protects metadata and transport-level guarantees.
  • Protect client keys and logic against reverse engineering (e.g., use binary hardening or commercial solutions such as secure wrappers/code obfuscation when appropriate).

When to Use Which Option

  • Hostile environment (end-user machines): Use application layer integrity/encryption (Option 2). Rolling out client upgrades to every end user can be slow or impossible; application-level protections are more resilient to adversarial clients.
  • Trusted environment (B2B, ISV-controlled): Certificate pinning (Option 1) can be effective because client upgrades are manageable and the environment is controlled.

Browser-Based Clients

For browser clients, you have less control over the environment. Instead, design server workflows so that user-side modifications do not provide an advantage:

  • Exploit-free workflows: Backend determines authoritative values (prices, permissions, inventory) based on server-side state. A user altering a price in transit should not succeed if the server validates and applies consistent business rules.

Prevention — Consumer Perspective (When the Consumer Is Not the Attacker)

Browser Users

  • Prevent installation of malicious root certificates: Don’t install unknown root certificates. Inspect and remove unexpected root certs from the system or browser certificate store.
  • Use browser extensions/tools: Browser plugins and online tools can detect suspicious certificate chains or warn about interception. (Example: checkmyhttps.net provides quick checks for common TLS/HTTP issues.)

Native Clients

Primary responsibility lies with the provider — implement the protections described in the provider section. Consumers of native apps should still avoid installing unknown root certificates and keep apps updated.

Practical Recommendations (Quick Checklist)

  • Enforce server-side validation of all sensitive business logic (never trust client input).
  • For native apps: implement certificate pinning and/or application-level signing/encryption with replay protection.
  • For browsers: build exploit-free server workflows and educate users about untrusted root certificates.
  • Protect client secrets and hardened logic against reverse engineering where feasible.
  • Plan for certificate rotation: design pin management and update strategies before deployment.

Closing

HTTPS is necessary but not sufficient. Threat models where the client is the attacker — or where a device has a malicious root certificate — require additional design patterns: certificate pinning, application-level integrity/confidentiality, replay protection, and robust server validation. Combining these controls hardens the weakest links and reduces the risk of client-side or proxy-based exploitation.

HTTPS mobile app security

Opinions expressed by DZone contributors are their own.

Related

  • 5 Challenges and Solutions in Mobile App Testing
  • 5 Ways Docker Can Improve Security in Mobile App Development
  • Secure Your Frontend: Practical Tips for Developers
  • Emerging Mobile Threats and Defensive Strategies for Developers

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

Let's be friends: