Typically, HTTPS redirection happens like this:
- The user clicks or types an HTTP link, e.g. http://example.com/url.
- If the browser has seen a Permanent (301) redirect to HTTPS for that exact URL, it follows it, skipping steps 4 and 5.
- The browser does a DNS lookup for example.com (if not already cached).
- The browser connects to example.com's on port 80, and requests
/url
over HTTP. - The example.com HTTP server responds with a redirect to https://example.com/url
- The browser connects to example.com on port 443 and requests the
/url
again over HTTPS.
Steps 4 and 5 are not only inefficient, but pose at least two security problems:
- The user's request is sent in cleartext, and easily viewable by any intermediate parties
- A man in the middle can easily spoof the example.com HTTP server, and could force a permanent redirect to a malicious site, or just serve malicious content over the HTTP - e.g. a form that harvests login details.
If there were a mechanism on the DNS level, then the typical process could look like this:
- The user clicks or types an HTTP link, e.g. http://example.com/url.
- If not already cached, the browser does a DNS lookup for the IP address of example.com, and also checks a DNS record to discover that the domain has identified as HTTPS only.
- The browser connects to example.com on port 443 and requests
/url
over HTTPS.
You could imagine the DNS record itself could be something quite powerful that perhaps blacklists/whitelists particular paths, or it could just be a simple yes/no flag.
(Browser support would of course not be universal to start with, so for some time the HTTP server would still be needed to continue serving redirects.)
This new method might still be subject to any DNS vulnerabilities, but a DNS lookup is still needed for the IP address, which is the bigger vulnerability. So I would consider this method to be strongly more secure than the current method.
To my knowledge, there has been no initiative on the part of big web companies or browser manufacturers to support such a mechanism.
Why is this? Or if there has been, what became of it?