I am setting up a new webserver. In addition to TLS/HTTPS, I'm considering implementing Strict-Transport-Security and other HTTPS-enforcement mechanisms.

These all seem to be based on the assumption that I am serving http://www.example.com in addition to https://www.example.com. Why don't I just serve HTTPS only? That is, is there a security-based reason to serve HTTP -- for example, could someone spoof http://www.example.com if I don't set up HSTS?

share|improve this question
2  
non browsers can have a lot more trouble fetching content, if that's a concern. Sites like craigslist thrive on mashups, for example. i don't see the harm in leaving some http sections open, for non-human "users"; they don't care about phishing, xss, or privacy, and you don't even need to serve HTML... – dandavis yesterday
4  
@dandavis - is that really a problem? If Craigslist went to HTTPS only, wouldn't everyone just convert their fetch scripts over to HTTPS? Most HTTP client libraries include HTTPS support. – Johnny 13 hours ago
    
How are people supposed to spread FUD about HTTPS being impractical if you run an HTTPS-only site without any problems? Think, man! And what about the poor hackers who want to attack grandmas who haven't heard of HTTPS-everywhere? It's like you're trying to promote a more secure web or something. – Superbest 9 hours ago
    
@Johnny: not as much infra supports https as http, that's all. it will get better... – dandavis 9 hours ago

For usability reasons you need to offer a redirect to HTTPS from all HTTP URL:s. Otherwise first time visitors who simply enter example.com/some/page into the URL bar of the browser will be greeted by a connection error.

Serving the redirect does not make you more vulnerable. Users who don't have your HSTS entry in their browsers will make a HTTP request anyway. Whether or not there is a real service or not on HTTP is irrelevant to a man in the middle.

So you need to run a HTTP server, but it doesn't need to respond with anything but the redirects.

share|improve this answer
46  
@Guillaume What is the point of being "more secure" if your user cannot reach your site at all? because they only used the default behavior of their browser connecting on port 80. With HSTS and a redirect from HTTP to HTTPS on the first connection, the attacker has a limited time window for its attack. You will only have 1 URL disclosed and most of the time this is just the main page, i.e., the domain name not protected by HTTPS anyway. – Ronny yesterday
19  
@Guillaume Your browser will try to connect on HTTP regardless of it actually being available. If someone opens a HTTP link and HSTS isn't in effect, the url may be leaked no matter what. A redirect from HTTP to HTTPS will increase accessibility without affecting security at all. – knbk yesterday
7  
Just in case someone's wondering, "can't they just MITM the first connection?" - Yes, they can. Even if you don't serve HTTP, they still can. Don't forget to set up HSTS even if you decide to reject HTTP requests for some reason. – Jan Dvorak yesterday
9  
@Guillaume If your web application or API's security relies on keeping URLs secret, you have a flawed security set up. The only time this should be a concern is when there is real physical danger to the user associated with the leak of the URLs, and in such cases, they're exposed simply by the user sending the request whether you respond or not. – jpmc26 yesterday
3  
"Your browser will try to connect on HTTP regardless of it actually being available." normally (systems using stuff like TCP fast open may be an exception) the http request (which contains the url) is only sent once the TCP connection is established. If the server refuses the TCP connection then the client won't send the request. – Peter Green 15 hours ago

Why don't I just serve https only?

The main reasons are the default behavior of browsers and backward compatibility.

Default behavior

When an end-user (i.e, without knowledge in protocols or security) types the website address in its browser, the browser uses by default HTTP. See this question for more information about why browsers are choosing this behavior.

Thus, it is likely that users will not be able to access your website.

Backward compatibility

It is possible that some users with old systems and old browsers do not support HTTPS or more likely, do not have an up-to-date database of root certificates, or do not support some protocols.

In that case, they either will not be able to access the website or will have a security warning. You need to define whether the security of your end-users is important enough to force HTTPS.

Many websites still listen to HTTP but automatically redirects to HTTPS and ignore users with really old browsers.

could someone spoof http://www.example.com if I don't set up HSTS?

If an attacker wants to spoof http://www.example.com, it needs to take control of the domain or take control of the IP address in some way.

I assume you meant: could an attacker perform a man-in-the-middle attack?

In that case yes, but even with or without HSTS:

  • Without HSTS: An attacker can easily be in the middle of your server and the user, and be active (i.e, modify the content) or passive (i.e., eavesdrop)

  • With HSTS: The first time a user try to visit the site using HTTP, an attacker could force the user to use HTTP. However, the attacker has a limited time window of when it can perform its attack.

What you should do?

Like many websites, you should allow HTTP connections and make you server redirects the user to the HTTPS version. This way you override the default behavior of browsers and ensure your users use the HTTPS version.

Old systems without the proper protocols or root certificates will not be able to access the site (or at least will have a warning), but depending on your user base this should not be an issue.

Conclusion

It will do more harm than good to disable HTTP. It does not really provide more security.

Any security added to protect a resource is useless if it prevents most of its users from accessing it. If your end-users cannot access your website because their browser default to HTTP and you do not listen for HTTP connections, what is the benefit?

Just perform the HTTP 301 redirection to the HTTPS version.

Related questions

share|improve this answer
    
I was referring to the bold "With HSTS" bullet, where the wording suggests that there's less security if the server serves a redirect from HTTP to HTTPS. – Ben Voigt yesterday
    
@BenVoigt Oh ok I see. I removed the "If you serve HTTP" to avoid a misunderstanding. Thanks – Ronny yesterday
    
In addition, some users might not be able to access https sites. For instance, China has previously been blocking all https traffic to Wikimedia projects. – leo 18 hours ago
    
Just a correction for the choice of word: The user does not enter a "URL", but a "web address". (There is no such thing as a default scheme/protocol.) – Oskar Skog 12 hours ago
    
@OskarSkog I changed to "website address", thanks. – Ronny 5 hours ago

The up-voted answers are very good. You'll sacrifice usability without a major impact on security if you completely shut off HTTP.

However, you can mitigate that with the HSTS Preload option. Preloading your website means you register your domain with the browser vendors and they'll hard-code their browsers to visit your website via HTTPS only. That means if a user attempts to access your website over HTTP the browser will change the request to HTTPS. They user doesn't need to first get the HSTS header before being secure. They will always connect to you over a secure channel.

Now this doesn't protect users who are using browsers that haven't updated their list of HTTPS only websites. Even when using preloading I recommend not shutting off HTTP for the few people who are using old or un-updated browsers.

But beware, preloading is permanent! It is extremely difficult to get off the preload list.

To get on the preload list: https://hstspreload.org/

share|improve this answer

You should support HTTP only to support backward compatibility. And Make sure that you do proper redirection in the back end server to HTTPS. The best way to implement this is provide the HTTP support only to your home page or any page which do not have sensitive information. You must not support HTTP requests to pages where user can access after the Authentication.

Even if there are devices(IoT) are accessing your server's sensitive data, you must force them to use TLS ( many current devices can store your certificate and create TLS connection). Keep in mind the SSL versions prior to 3.0 do have many vulnerabilities such as poodlebug etc.. Hence, disable all previous version from your Web server and allow only > TLS 1.1.

It is good that you implement the HSTS. I recommend you to take a look at feasibility of implementing HPKP to your site as well.

share|improve this answer

You don't have to.

Some older browsers and operating systems (these usually go hand-in-hand) do not have newer certificate root authorities, but they usually don't support newer HTTPS standards either, so nothing really is lost.

You may have a device which doesn't support HTTPS, custom script, etc.

No one can spoof HTTP, because the DNS record belongs to you and the A record points to your specific IP address (in a perfect world).

You do it just to maintain compatibility, that's it.

share|improve this answer
5  
"No one can't spoof http" — Do you mean "No one can" or "Everyone can"? "the DNS record belongs to you and the a record points to your specific IP address" — By that reasoning, man-in-the-middle attacks never happen, so there's no need for certificate authorities and chain of trust. – jwodder yesterday

Why should I offer http in addition to https?

Simply put, you shouldn't. HTTP is an insecure, unencrypted protocol. Using quantum injection (a technique known a QFIRE in the NSA), http sites can be changed in transit.

But, even if quantum computers aren't your concern, you should still listen to your gut instinct of using HSTS + HTTPS only.

If there's one thing Marlin Moxiespike taught us, it's that HTTP connections are stargates to MiTM attacks.

could someone spoof http://www.example.com if I don't set up HSTS?

No one can spoof a domain name. Your browser would automatically be redirected to the https version.

There is no reason to support http, in 2017, under any circumstances as far as I (and many others) are concerned. My sites are set specifically to reject http requests.

share|improve this answer
5  
What do you mean by quantum injection? Spoofing and the .htaccess file are completely unrelated. Yes should support HTTP in 2017 to redirect users to HTTPS. A threat model involving the NSA as an attacker is irrelevant in this question. – Ronny yesterday
8  
Yes, one can spoof a domain name, it depends on the threat model. And no your browser do not automatically redirect to the HTTPS version. You must configure your server to listen to port 80 and do a HTTP 301 redirection to the HTTPS version. – Ronny yesterday
3  
If you are ONLY serving HTTPS, then serving HSTS headers serves no purpose because a client won't be able to connect to the HTTP port anyway. – Michael Kjörling yesterday
5  
@MichaelKjörling. If you are only server HTTPS (unlikely for anything browser-facing, though I have seen it for one or two API endpoints), you may still want HSTS to prevent a MITM attack on attempted HTTP connections. – TRiG yesterday
7  
The NSA uses the codename QUANTUM INSERT for certain interception and manipulation attacks, which don't work for https since https has integrity protection. It''s completely unrelated to quantum physics/computers/key-exchange. – CodesInChaos yesterday

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.