A recently discovered vulnerability in cookies could enable an attacker to access private information from HTTPS sessions.
According to the vulnerability note published by CERT on Thursday, cookies that have been established via HTTP requests represent a security flaw for HTTPS sessions, due to the fact that they do not provide “integrity guarantees for sibling domains”.
The advisory explains that web browsers do not always authenticate the domain that is setting a cookie, which could let an attacker set a cookie that could later be used via an HTTPS connection instead of the cookie set by the actual site. By exploiting other vulnerabilities in the server, the attacker-controlled cookie can be used to access private information.
“A malicious attacker can utilize this to set a cookie that is later used via an HTTPS connection instead of the cookie set by the actual site; for example, an attacker may set cookies for example.com that override the real cookie for www.example.com when the victim is loading HTTPS content,” the CERT advisory explains.
Details of the vulnerability were disclosed by researchers in a paper published at USENIX Security 2015, which warned that while there are cookies that contain a secure flag indicating that it should be sent only over an HTTPS connection, there is no flag to indicate how a cookie was set. As a result, attackers conducting man-in-the-middle attacks on an HTTP session can inject cookies that can be attached to subsequent HTTPS connections.
The vulnerability is said to have been found in popular websites such as Google and Bank of America, and to affect major web browsers, including Chrome, Firefox, Internet Explorer, and Safari. A solution to the issue would be safer handling of cookies through updating the same origin policy for cookies, CERT said.
To mitigate the attack, CERT advises website operators to deploy HSTS on the top-level domain they control, and to use the includeSubDomains option, which limits an attacker’s ability to set top-level cookies capable of overriding the subdomain ones. End-users should update their browsers to ensure that they have full HSTS support, CERT said.
Security vulnerabilities related to cookies are not new.
Another issue with cookies is the fact that they do not offer isolation by port, which means that, if a cookie is readable/writable by a service running on a port of a server, it is also readable/writable to services running on other ports. Moreover, cookies used with HTTP and HTTPS schemes for a given host can also be used with other schemes, including ftp and gopher.