Secure cookie

Secure cookies are a type of HTTP cookie that have Secure attribute set, which limits the scope of the cookie to "secure" channels (where "secure" is defined by the user agent, typically web browser).[1] When a cookie has the Secure attribute, the user agent will include the cookie in an HTTP request only if the request is transmitted over a secure channel (typically HTTPS).[1] Although seemingly useful for protecting cookies from active network attackers, the Secure attribute protects only the cookie's confidentiality. An active network attacker can overwrite Secure cookies from an insecure channel, disrupting their integrity. This issue is officially referred to as Weak Integrity.[1] However, some browsers, including Chrome 52 and higher and Firefox 52 and higher, forgo this specification in favor of better security and forbid insecure sites (HTTP) from setting cookies with the Secure directive.[2]

Even with Secure, sensitive information should never be stored in cookies, as they are inherently insecure and this flag can't offer real protection.[2] Secure attribute is not the only protection mechanism for cookies, there are also HttpOnly and SameSite attributes. The HttpOnly attribute restricts the cookie from being accessed by, for instance, JavaScript, while the SameSite attribute only allows the cookie to be sent to the application if the request originated from the same domain.

Background

An HTTP cookie is a small packet of data[3] that is sent from a web server to a user's web browser. There are two types of cookies:

Cookies could contain sensitive information, such as passwords and credit card numbers, which are sent over an HTTP connection and might be stored in web browsers as plain text. To prevent attackers from stealing this information, cookies can be secured with attributes.

Various cookie hijacking techniques exist.[4] All the methods are not difficult to implement and can do significant damage to a user or an organization. Cookies that contain sensitive information such as usernames, passwords, and session identifiers can be captured using these tools once they are downloaded from a site to a web browser or accessed through a computer hard drive.[5]

Network threats

Cookies that are sent over unencrypted channels can be subject to eavesdropping, i.e. the contents of the cookie can be read by the attacker. These types of threats can be prevented by the use of Secure Sockets Layer or SSL protocol in servers and Internet browsers although this works only if the cookies are on the network.[6] One might also use cookies with only the sensitive information encrypted instead of the entirety of a data payload exchanged.[7]

End system threats

Cookies can be stolen or copied from the user, which could either reveal the information in the cookies or allow the attacker to edit the contents of the cookies and impersonate the users. This happens when a cookie, which is in the browser's end system and stored in the local drive or memory in clear text, is altered or copied from one computer to another with or without the knowledge of the user.[6]

The attacker can try to impersonate a website by accepting cookies from the users. Once the attacker gets the cookies, he can use these harvested cookies for websites that accept third-party cookies. An example of this threat is the so-called Cross-Site Scripting attack, which involves the exploitation of the vulnerabilities of a website displaying data provided by the user that has underlying malicious intent.[8] An attacker, for instance, could embed a script in a URL he has posted in a discussion forum, message board, or email, which is then activated when the target opens the hyperlink.[8]

See also

References

  1. Barth, A. (April 2011). "RFC 6265 - HTTP State Management Mechanism". IETF RFC.
  2. "HTTP cookies". MDN Web Docs. Retrieved 2018-10-06.
  3. Bortz, Andrew; Barth, Adam; Czeskis, Alexei. "Origin Cookies: Session Integrity for Web Applications" (PDF). Archived (PDF) from the original on 2018-05-13. Retrieved 2018-05-13.
  4. Zheng, Xiaofeng; Jiang, Jian; Liang, Jinjin; Duan, Haixin; Chen, Shuo; Wan, Tao; Weaver, Nicholas (2016-08-12). "Cookies Lack Integrity: Real-World Implications" (PDF). Proceedings of the 24th USENIX Security Symposium. ISBN 978-1-931971-232. Archived (PDF) from the original on 2018-05-13. Retrieved 2018-05-13.
  5. Dubrawsky, Ido (2009). CompTIA Security+ Certification Study Guide: Exam SY0-201 3E. Burlington, MA: Syngress. p. 105. ISBN 9781597494267.
  6. Atluri, Vijay; Hale, John (2013). Research Advances in Database and Information Systems Security. Berlin: Springer Science+Business Media, LLC. pp. 52. ISBN 9781475764116.
  7. Benantar, Messaoud (2006). Access Control Systems: Security, Identity Management and Trust Models. Heidelberg: Springer Science+Business Media. pp. 127. ISBN 9780387004457.
  8. Jajodia, Sushil; Wijesekera, Duminda (2005). Data and Applications Security XIX. Berlin: Springer Science & Business Media. pp. 317. ISBN 9783540281382.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.