← Back to Portfolio

An Analysis of Silent Protocol Downgrading, HSTS Mitigation, and the Security vs. Usability Trade-off

Abstract

This report analyzes the vulnerability of the HTTP-to-HTTPS transition mechanism to Man-in-the-Middle (MITM) attacks and evaluates the effectiveness of HTTP Strict Transport Security (HSTS) as a countermeasure. Using a controlled virtualized environment, an SSL stripping attack was executed against a victim client to intercept credentials in plaintext. The study confirms that while standard 301 redirects are susceptible to silent protocol downgrading, implementing HSTS effectively neutralizes the attack by enforcing browser-level security policies. Furthermore, the experiments practically demonstrate known limitations in the HSTS specification (RFC 6797), specifically regarding bare IP addresses and the Trust On First Use (TOFU) model. These findings illustrate the practical implications of defense-in-depth strategies and the importance of secure default configurations.

Keywords: SSL Stripping, HSTS, Man-in-the-Middle, Network Security, Protocol Downgrade

1 Introduction

In an era where digital communication underpins critical infrastructure and personal privacy, the integrity of web protocols is paramount. While the Transport Layer Security (TLS) protocol provides robust encryption for data in transit, the mechanism by which users initially connect to secure services remains a significant vulnerability. Historically, web browsers default to unencrypted HTTP, relying on server-side redirects to upgrade the connection to HTTPS. This transitional phase creates a window of opportunity for attackers to intervene.

This report investigates the mechanics of “SSL Stripping,” a silent protocol downgrading attack that exploits this transition to intercept sensitive data without triggering browser security warnings. The primary objective of this study is to practically demonstrate the susceptibility of standard HTTPS redirects to Man-in-the-Middle (MITM) attacks and to evaluate the efficacy of HTTP Strict Transport Security (HSTS) as a mitigation strategy.

The analysis is conducted within a controlled virtual environment, simulating a realistic attack scenario where an adversary intercepts traffic between a victim and a web server. The report further explores the technical edge cases of HSTS, specifically its behavior regarding direct IP address access, and discusses the broader ethical implications of silent failure modes in security design. The subsequent sections detail the theoretical background of the protocols, the experimental methodology used to execute the attack, the observed results, and a critical discussion of the security versus usability trade-offs inherent in modern web defense.

2 Background

The Man-in-the-Middle (MITM) attack performed in this study relies on the lack of authentication in the Address Resolution Protocol (ARP) [1]. By spoofing ARP responses, an attacker can position themselves logically between the victim and the gateway.

Historically, websites relied on HTTP (Port 80) for initial connections, redirecting users to HTTPS (Port 443) via a 301 Moved Permanently response. Administrators are often forced to keep Port 80 open to accommodate human behavior (users typing bare domain names without https://) and to facilitate legacy compatibility, creating the very window of opportunity SSL stripping exploits. In 2009, Moxie Marlinspike demonstrated that this transition is vulnerable to “SSL Stripping” [2]. In this attack, a transparent proxy intercepts the HTTPS connection to the server and serves unencrypted HTTP to the victim, effectively removing transport layer security without triggering browser warnings [3].

To mitigate this, the Internet Engineering Task Force (IETF) introduced HTTP Strict Transport Security (HSTS) in RFC 6797 [4]. HSTS allows a server to declare that user agents (browsers) should only interact with it using secure connections, eliminating the insecure redirect after the first successful visit.

3 Method

The experimental procedure involved setting up a controlled network environment to simulate a Man-in-the-Middle (MITM) attack and evaluate HSTS protection.

3.1 Environment setup

The environment consisted of three VM nodes attached to the same NAT Network in VirtualBox.

Table 1: Network Configuration of the Experimental Environment

Role Description IPv4 Architecture
Hypervisor VirtualBox Qt6.8.0 (Windows 11) - AMD
NAT Network NAT Network (VirtualBox) 10.0.2.0/24 AMD
Victim Ubuntu LTS 20.04.4 10.0.2.15 AMD
Server Ubuntu Server 22.04 LTS 10.0.2.5 AMD
Attacker Kali Linux 2025.4 10.0.2.3 AMD

3.2 Configuration

An Apache web server was deployed to host a dummy login page. A private Certificate Authority (CA) was generated and imported into the victim’s trust store. This step was essential because modern browsers disable HSTS protections for self-signed certificates, requiring a valid chain of trust to accurately simulate the security mechanism. The server was configured to listen on HTTP (port 80) and issue a standard 301 Redirect to HTTPS. The HSTS header was applied with max-age=31536000 and includeSubDomains. Finally, the /etc/hosts file on the victim was modified to map the server’s IP to securelab.local for DNS resolution.

3.3 Attack Execution

The attack was conducted using bettercap [5] on Kali Linux. The net.probe module was used to identify targets. Crucially, because the target server was located on the same local subnet, the arp.spoof module was configured with internal true. This enabled the interception of peer-to-peer traffic directly between the victim and the server, which typically bypasses the network gateway. The http.proxy module was enabled with sslstrip to intercept the 301 redirect and downgrade HTTPS requests to HTTP. Packet sniffing (net.sniff) was active to capture plaintext credentials.

3.4 Testing Scenarios

Two scenarios were tested to evaluate the security mechanisms:

  1. Direct IP Access: The victim accessed the server via its IP address to determine if HSTS applies to bare IPs.
  2. Domain Access: The victim accessed the server via the domain name to verify if the cached HSTS policy prevented the downgrade.

4 Results

The experiments yielded distinct outcomes depending on the access method (IP address vs. Domain Name), confirming the specific scope of HSTS protection.

4.1 Baseline Attack: IP Address Vulnerability

When the victim accessed the server via its direct IP address (http://10.0.2.5/index.php), the browser did not enforce HSTS. The bettercap proxy successfully intercepted the traffic, stripped the SSL encryption, and served an unencrypted HTTP page to the victim. Consequently, the credentials entered by the victim were captured in plaintext.

Bettercap capturing plaintext credentials during the IP-based attack
Figure 1: Bettercap capturing plaintext credentials during the IP-based attack.

4.2 Mitigated Attack: Domain Name Protection

When the victim accessed the server via the domain name (http://securelab.local/index.php) after the initial Trust On First Use (TOFU) event, the browser’s HSTS policy was active. The browser forced an internal redirect to HTTPS before any network request was sent. As a result, bettercap was unable to strip the encryption. The logs showed only encrypted SNI (Server Name Indication) traffic, and no credentials were captured.

Bettercap logs showing only encrypted HTTPS traffic (SNI) when HSTS is active
Figure 2: Bettercap logs showing only encrypted HTTPS traffic (SNI) when HSTS is active.

5 Discussion

5.1 Technical Interpretation and Limitations

The results demonstrate a critical limitation in the HSTS specification. While the domain-based attack was successfully mitigated, the IP-based attack succeeded. This is not an implementation error but a documented design choice in RFC 6797, which states that HSTS policies must not apply to bare IP addresses [4]. This creates a persistent vulnerability for services accessed via direct IP or for users who bypass DNS.

Furthermore, HSTS relies on a “Trust On First Use” (TOFU) model. As noted by Kranch and Bonneau [6], if an attacker intercepts the very first connection attempt before the HSTS header is cached, the protection is nullified.

5.2 Real-World Attack Vectors and Consequences

This vulnerability is particularly acute in untrusted network environments, such as public Wi-Fi hotspots in airports, cafes, or hotels. In these settings, Layer 2 isolation is often weak or non-existent, allowing an attacker to easily perform ARP spoofing or deploy a rogue access point, commonly known as an “Evil Twin,” to intercept traffic [3].

The consequences of a successful attack extend far beyond the capture of login credentials. As demonstrated by Marlinspike, once the secure transport layer is stripped, the attacker gains full control over the traffic flow [2]. This allows for session hijacking by stealing unencrypted session cookies, enabling impersonation without credentials. Furthermore, modern attack frameworks like bettercap allow for real-time data modification, such as altering transaction details or injecting malicious JavaScript to compromise the victim’s device [5]. For individuals, this results in identity theft and financial fraud; for organizations, it can lead to massive data breaches and loss of institutional trust.

5.3 Ethical and Social Analysis

The success of SSL stripping highlights a dangerous reliance on user vigilance. As Schechter et al. demonstrated, users often fail to notice the absence of security indicators when focused on a primary task [7]. The attack is particularly insidious because it is silent; unlike a self-signed certificate error which presents a warning, SSL stripping simply removes the lock icon, which many users interpret as a neutral rather than dangerous state [8].

From an ethical perspective, relying on user awareness is insufficient. The ACM Code of Ethics (Principle 2.9) mandates that professionals design systems that are robustly secure [9]. System administrators therefore have an ethical obligation to implement HSTS and not rely solely on 301 redirects, effectively shifting the burden of security from the user to the infrastructure.

5.4 Security vs. Usability Trade-off

To address the TOFU flaw, administrators can utilize “HSTS Preloading,” where the domain is hardcoded into the browser’s source code [6]. However, this introduces a significant trade-off between security and usability. Preloading makes a site extremely secure but brittle; if a certificate expires or a configuration error occurs, the site becomes completely inaccessible to users, potentially causing significant operational disruption.

Additionally, the operational requirement to keep Port 80 open creates a paradox. Automated certificate authorities such as Let’s Encrypt often rely on the HTTP-01 challenge, which requires Port 80 to be accessible for domain validation [10], [11]. Consequently, administrators cannot simply close the insecure port to prevent SSL stripping without breaking the automated renewal process that maintains the HTTPS certificates themselves.

6 Conclusion

This study successfully demonstrated the mechanics of silent protocol downgrading attacks and the effectiveness of HTTP Strict Transport Security (HSTS) as a mitigation strategy. The experiments confirmed that while standard 301 redirects are vulnerable to SSL stripping, HSTS effectively neutralizes this threat by forcing browser-level redirection before any insecure network request is made. However, the results also highlighted significant limitations in the protocol, specifically the exclusion of bare IP addresses and the reliance on Trust On First Use (TOFU).

Future work should investigate the deployment of HSTS Preloading to address the TOFU vulnerability, though this comes with increased operational complexity. Additionally, exploring Layer 2 security mechanisms, such as Dynamic ARP Inspection (DAI), would provide a more comprehensive defense-in-depth strategy by preventing the initial Man-in-the-Middle position required for these attacks. Ultimately, technical mechanisms like encryption are only as strong as the protocols that enforce them, necessitating a balanced approach between strict security policies and user usability.

References

  1. [1] D. C. Plummer, “An ethernet address resolution protocol,” RFC Editor, RFC 826, Nov. 1982. doi: 10.17487/RFC0826 [Online]. Available: https://www.rfc-editor.org/rfc/rfc826.txt
  2. [2] M. Marlinspike, “New tricks for defeating ssl in practice,” in Black Hat DC, 2009. [Online]. Available: https://www.blackhat.com/presentations/bh-dc-09/Marlinspike/BlackHat-DC-09-Marlinspike-Defeating-SSL.pdf
  3. [3] N. Nikiforakis, W. Meert, Y. Younan, F. Piessens, and W. Joosen, “Hproxy: Client-side detection of ssl stripping attacks,” in International Conference on Detection of Intrusions and Malware, and Vulnerability Assessment (DIMVA), Springer, 2010. doi: 10.5555/1884848.1884865 [Online]. Available: https://www.securitee.org/files/hproxy_dimva2010.pdf
  4. [4] J. Hodges, C. Jackson, and A. Barth, “Http strict transport security (hsts),” RFC Editor, RFC 6797, Nov. 2012. doi: 10.17487/RFC6797 [Online]. Available: https://www.rfc-editor.org/rfc/rfc6797.txt
  5. [5] S. Margaritelli, Bettercap, 2023. [Online]. Available: https://www.bettercap.org/
  6. [6] M. Kranch and J. Bonneau, “Upgrading https in mid-air: An empirical study of strict transport security and public key pinning,” in Network and Distributed System Security Symposium (NDSS), 2015. [Online]. Available: https://www.ndss-symposium.org/wp-content/uploads/2017/09/Upgrading-HTTPS-in-Mid-Air-An-Empirical-Study-of-Strict-Transport-Security-and-Key-Pinning.pdf
  7. [7] S. E. Schechter, R. Dhamija, A. Ozment, and I. Fischer, “The emperor’s new security indicators,” in IEEE Symposium on Security and Privacy, 2007. doi: 10.1109/SP.2007.35 [Online]. Available: https://stuartschechter.org/papers/emperor.pdf
  8. [8] A. P. Felt et al., “Rethinking connection security indicators,” in Symposium on Usable Privacy and Security (SOUPS), 2016. [Online]. Available: https://www.usenix.org/system/files/conference/soups2016/soups2016-paper-porter-felt.pdf
  9. [9] Association for Computing Machinery, Acm code of ethics and professional conduct, 2018. [Online]. Available: https://www.acm.org/code-of-ethics
  10. [10] J. Aas et al., “Let’s encrypt: An automated certificate authority to encrypt the entire web,” in Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security (CCS ’19), Association for Computing Machinery, 2019, pp. 2460–2474. doi: 10.1145/3319535.3363192 [Online]. Available: https://doi.org/10.1145/3319535.
  11. [11] R. Barnes, J. Hoffman-Andrews, D. McCarrell, and J. Kasten, “Automatic certificate management environment (acme),” RFC Editor, RFC 8555, Mar. 2019. doi: 10.17487/RFC8555 [Online]. Available: https://www.rfc-editor.org/rfc/rfc8555.txt