Does “www.” Mean Better Transport Layer Security?
eprint.iacr.org
eprint.iacr.org
What's often going on is that the www domain is delegated via DNS to a thirdparty service provider, while the apex domain is hosted on some appliance and just does a simple redirect. The reason for that is that you can't do DNS delegation for an apex domain.
During our ROBOT investigations we found a particularly weird example: We found a particularly severe variant of our vulnerability in old versions of Cisco ACE load balancers. Cisco told us that these were out of support, so they're not gonna get fixed. Turns out: they used one of them to redirect cisco.com to www.cisco.com.
Not only DNS entries, but 3rd-parties can wiretap/modify arbitrary content in all web pages if you use a CDN. That's essentially how CDNs work, you have to trust a 3rd-party if you detegate your request to a 3rd-party. I'm not saying it's necessarily bad, but there is no other way around. And in case of CloudFlare, the DNS is already fully controlled by CloudFlare.
DNS is hierarchical. If your DNS server manages example.com then you can set a delegation for a subdomain - e.g. www.example.com - to someone else. I.e. you could say "for this subdomain the nameservers from google's cloud service are responsible". You can go further and e.g. configure the google cloud service so that abc.www.example.com goes yet to another DNS service.
So a company could say "we manage the DNS for our domain inhouse, but for www. we let some other company do it and pay them for it". This is pretty standard.
Which means, a latest and greatest TLSv1.3 server you see may be ultimately backed by a vulnerable TLSv1.0 upstream server (or even unencrypted HTTP!).
Great news for the NSA indeed!
What does this mean for SSL termination? E.g. SSL terminates at cloudflare, internal (behind firewall) all http-sans-s?
https://support.cloudflare.com/hc/en-us/articles/200170416-E...
1 - https://www.ssllabs.com/ssltest/analyze.html?d=nvidia.com
2 - https://www.ssllabs.com/ssltest/analyze.html?d=www.nvidia.co...
3 - https://www.ssllabs.com/ssltest/analyze.html?d=us.download.n...
One problem I've found is that if you have a redirect from HTTP to HTTPS, then you don't notice an extra redirect from HTTPS to HTTP (e.g. redirect from HTTPS plain domain to HTTP www, which then in the next request get upgraded from HTTP www to HTTPS www).
Combine that with the fact that it is surprisingly difficult to prevent the AWS load balancer from redirecting from HTTPS to HTTP. Literally Apache, Nginx, Tomcat, Jetty all get it wrong out of the box. I had to write this blog post to prevent myself from getting it wrong in the future: https://www.databasesandlife.com/jetty-redirect-keep-https/
The particular application I discovered that on did not accept HTTP traffic, so I discovered the extra redirect. Most people don't.
Absolutely correct, it's surprisingly difficult to get a really good working configuration with no weird fallbacks or side effects and have working http2. I have five server blocks per domain name when using nginx, some are reusable though, here:
* Port 80 with wrong domain - close connection, nothing legit does this
* Port 80 with right (www. and .) domain - redirect to https://
* Port 443 with no SNI - close connection, nothing legit does this
* Port 443 with www. SNI (http2 enabled) - redirect
* Port 443 with . SNI (http2 enabled) - display proper page
Not surprisingly it tremendously cut down the amount of exploit scanners and bad bots from logs (they seem to rely on everyone not enforcing SNI) and managed to hide the server from Shodan :D. This is of course not to diss nginx, other servers e.g. caddy and apache were worse or even impossible to configure to the same point.
Hm? What about TLS is difficult with Caddy?
I wasn't aware that one could test for the existence of SNI in the server block.
server {
listen {replace_with_some_ip} ssl;
listen {replace_with_some_ipv6} ssl;
ssl_certificate /etc/ssl/snakeoil.pem;
ssl_certificate_key /etc/ssl/snakeoil.key;
server_name _ {replace_with_some_ip} {replace_with_some_ipv6};
return 444;
}
Should catch all TLS connections that have no SNI or try to connect straight with just IP and if snakeoil is generated right then it doesn't instantly reveal what's the real hostname.Also something I observe daily: When I tell someone to go to "example.com" some will punch in "www.example.com", others will simply do "example.com". There is also the ultra rare occurrence of someone typing in "http://www.example.com".
Personally I just configure www to point at the same as the regular domain and have the www as a "subject alternative name" in the certificates. And in Nginx it's as easy as just adding it to the "server_name". I suspect it's the same for all other major HTTPDs.
I could imagine that this might be different among non-technical users, where the exact meaning of domains, subdomains and the "https" and "www" prefixes are less well-known.
I have no data to back that up, though.
When I was a kid in the early 2000's, most web addresses were "www.domain.com", that's what you'd see on written material like advertising or articles. These days if an ad has a web address it usually doesn't include the `www.` subdomain.
I’ve had people tell me things are broken when I send them to foo.example.com and they insist on typing the nonexistent www.foo.example.com.
Obviously it's a separator, I just found writing "" and "www" too weird. Not to mention that in this context where you're not really a recursive DNS resolver it really doesn't matter how one specifies the existence or lack of it of a subdomain. In addition to that some things use "@" (instead of the dot I used).
The hostname-as-tld example is sort of against the rules:
https://serverfault.com/questions/907226/is-it-possible-to-c...
Either way, "." by itself can only meaningfully refer to the root, not some arbitrary enclosing domain name. There is no way you will convince me that using "." as a shorthand for "parent domain" is a good idea, for that and all the other reasons.
Of note to me is that they didn't comment on why they might be configured differently. As in, does following a popular tutorial to configure Apache or Nginx neglect the plain domain? You couldn't determine the reason through a web scan so I don't blame the researchers for offering the reason. They also don't offer any way to fix the disparity. Obviously, the best practice is to just configure your server's www and plain domains correctly, but clearly most of the internet isn't following their best practices checklist.
So www gets put behind a nicely configured CDN with decent TLS settings, whereas the apex gets a crappy HTTP redirection service or maybe worse, the actual origin itself, serving up a half baked config.
https://blog.cloudflare.com/introducing-cname-flattening-rfc...
Cloudflare also puts cookies on the root domain.
I definitely agree though.
> Setting a cookie for the www subdomain ensures that it’s only available for that subdomain and not globally across all subdomains.
No, www is not more secure because of cookies. As you said, it depends on how cookies are set, which is up to the host, as this is defined in the HTTP headers coming from the server. It's possible to access a cookie from "www.example.com" on "example.com" or "sub.example.com" if it's configured like that on the backend. Also the browser needs to comply. (Protip: most browsers do)
Ok but to my knowledge it is impossible to set a cookie on example.com and make it inaccessible to subdomain.example.com.
Try document.cookie = 'a=b' in a browser console on non-www domain and then do document.cookie on the www variant.
You'll see it not set. (The cookie will only be accessible on subdomains if you include the domain explicitly, like document.cookie = 'a=b;domain=toplevel.domain')
And Chrome still wants to fool the user into thinking these two domains are the same.[0]
Great job, Google.
https://security.stackexchange.com/q/91717/78662
However, if these are hosted on the same server, there is a long-standing bug in Apache that forces the same protocol and cipher suite for all virtual hosts: