HTTP Strict Transport Security (HSTS) Not Enforced

The site does not send an effective Strict-Transport-Security header, so browsers may still make HTTP requests to it that an attacker can intercept and downgrade.

SeverityLow
CVSS 3.13.1 CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N Open in the calculator
CVSS 4.02.3 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator
CWECWE-319: Cleartext Transmission of Sensitive Information
OWASP Top 10A04:2025 Cryptographic Failures
MITRE ATT&CKT1557 Adversary-in-the-Middle
CategorySecurity Misconfiguration

Description

The application is available over HTTPS but does not instruct browsers, through the Strict-Transport-Security response header, to use HTTPS for every future request to the domain. Without that instruction, a browser makes a plain HTTP request whenever a user types the address without a scheme or follows an http:// link or bookmark, and relies on the server's redirect to reach HTTPS.

An attacker on the network path, such as on a shared or public wireless network, can intercept that first request and the redirect, and keep the user on an unencrypted connection to the attacker while relaying to the real site over HTTPS, an attack known as SSL stripping. The attacker can then read credentials, session cookies that lack the Secure attribute and other data the user enters, and can alter pages. The attack needs the user to start from an HTTP address while the attacker is on the path, and an attentive user may notice that the connection is not secure. Without HSTS, browsers also let users click through certificate warnings for the site, which helps an attacker presenting a forged certificate.

The weakness takes several forms: the header is absent; it is sent with a short max-age, so protection lapses soon after each visit; it omits includeSubDomains where subdomains also serve the application or receive its cookies; or it is sent only over HTTP, where browsers ignore it. Even a correct header cannot protect a user's first visit, which is why a domain can also be added to the preload list built into browsers.

The issue is confirmed by inspecting HTTPS responses for the header and its directives. Scanners commonly report it as a missing security header.

Remediation

Send the Strict-Transport-Security header on every HTTPS response from the domain:

  • Use a max-age of at least one year (31536000 seconds). Where subdomains have not been checked, start with a short value and raise it once nothing has broken.
  • Add includeSubDomains once every subdomain is confirmed to work over HTTPS, since it applies the policy to all of them.
  • Keep any HTTP listener as a permanent redirect to HTTPS; browsers ignore the header when it arrives over HTTP.
  • To protect first visits, consider submitting the domain to the HSTS preload list once the policy has run without problems. This needs includeSubDomains, a max-age of at least one year and the preload directive, and is slow to reverse.
nginx: add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; Apache (mod_headers): Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" IIS (web.config, within system.webServer): <httpProtocol> <customHeaders> <add name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains" /> </customHeaders> </httpProtocol>

In nginx, an add_header directive in a location block replaces those inherited from the server block, so check each location; recent IIS versions also offer a native HSTS setting for each site. Confirm the fix by checking that HTTPS responses, including redirects and error pages, carry the header with the intended directives.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Web Applications Findings

Every Web Applications finding