Adversary SimulationsJan Kahmen6 min read

HSTS: What You Should Know About the HTTPS Extension

In our article, we look at the technical background of HSTS, HTTPS and SSL stripping. Learn more about website security now.

What Is HSTS?

In recent years, protecting sensitive data has increasingly moved online. Ensuring that confidential information is only transmitted over secure connections has become essential. HSTS provides exactly this guarantee on modern websites. The abbreviation stands for "HTTP Strict Transport Security" -- a security header that forces the browser to establish a secure connection when loading a website. OWASP describes HSTS as a security header in its technical documentation.

In this article, you will learn what you need to know about HSTS and how, as a website operator, you can ensure the highest level of security for your visitors. We also explain the relationship between HSTS and HTTPS. To do so, we examine the underlying protocols, certificates, and technical details, and address whether operators are still defenseless against SSL stripping today.

HTTPS Extension with HSTS

To understand how HSTS benefits you, consider its relationship with HTTPS. An HTTPS connection encrypts your data during communication with the website, making it significantly harder for third parties to intercept or read your information. HSTS can be activated server-side by the website operator, forcing a secure HTTPS connection in every case.

A simple 301 redirect alone is not enough to prevent a man-in-the-middle attack. An attacker could intercept and manipulate the communication between you and the website by disrupting the redirect to HTTPS. HSTS prevents this by enforcing the encrypted connection. Google has been actively warning users before they access unencrypted websites for several years now.

SSL Stripping: How Dangerous It Is Today

In the context of web security, SSL stripping deserves special attention. In this attack, a proxy searches for SSL-protected login paths and replaces the certificate with a modified version. The result: users visit what they believe to be an SSL-protected website and unknowingly send their login credentials unencrypted in plain text. An attacker can then easily read this data. Cloudflare has published a technical explanation of SSL stripping.

Nearly 20 years ago, SSL stripping already enabled attackers to intercept visitor information and access cookies with sensitive data in unencrypted form. Once in place, neither the user nor the server detects the attack. Both assume a secure connection, so the data transfer goes unquestioned. To protect themselves, users and website operators should consistently use HTTPS connections. Combined with HSTS, the risk of SSL stripping can be effectively eliminated.

The Effects of HSTS on SEO

Beyond the technical aspects, it is worth examining how HSTS affects SEO. Search engine optimization is essential today for delivering relevant results to your audience. When HSTS is enabled, 307 redirects replace the usual 301 redirects. This catches the attention of Google's Search Console, which may send you warning emails. SEO tools from other providers will also flag the new 307 redirects after crawling your site.

The question is whether these 307 redirects -- typically used for temporary redirections -- are cause for concern. A look behind the scenes provides reassurance: since the redirect only occurs at the browser level, it remains a 301 redirect at the server level. This means HSTS has no negative impact on your SEO results. Search Engine Land has compiled further details on HSTS and SEO.

Conclusion: HSTS Belongs on Every Modern Website

Having explored the technical background of HSTS in connection with HTTPS and SSL, we strongly recommend implementing it in your website's header. HSTS is an ideal safeguard against man-in-the-middle attacks. This added layer of security gives your visitors a safer browsing experience while protecting you against data breaches and the theft of personal information.

Given the advantages of HSTS, it is clear that reputable websites should take this extra step to protect everyone involved. After all, it is in everyone's interest to deny hackers and cybercriminals any opportunity online. HSTS is the right tool for the job. By deploying it on your website, you leave no room for modern cybercrime to access the data of your employees or visitors.