I think websites should just stop using "www." entirely and host directly on their domain rather than a subdomain.
The spec says that a cookie flagged with the domain "domain.com" is supposed to only be valid for requests to "domain.com" and not "subdomain.domain.com". A cookie that is intended to be valid for all subdomains is supposed to have a preceding dot, like ".domain.com".
Older versions of IE (That may still be in use) will treat "domain.com" cookies like ".domain.com" cookies, allowing malicious.subdomain.domain.com to access cookies only intended for "domain.com".
[0] https://www.mxsasha.eu/blog/2014/03/04/definitive-guide-to-c...