Cookie Security Myths and Misconceptions - David Johansson - AppSecUSA 2017

Cookies are an integral part of any web application and secure management of cookies is essential to web security. However, during my years as a security consultant I've often encountered various myths and misconceptions regarding cookie security from both developers as well as other security professionals.

This talk will dive into the details of cookie security and highlight some of the lesser known facts about well-known cookie attributes. For example, we will see why the ‘Secure’ attribute doesn’t make a cookie immune against active man-in-the-middle attacks, how JavaScript can manipulate cookies marked with ‘HttpOnly’, why setting the ‘Domain’ attribute to the origin host may make it less secure and how other applications on the same host still can access cookies scoped to a path outside their application.

This talk will also cover many of the recent improvements to cookie security implemented in modern browsers, such as ‘Strict secure cookie’, ‘Cookie prefixes’, and the ‘SameSite’ attribute. This talk will give you a solid understanding of the pitfalls affecting cookie security, the risks associated with these, and how you can leverage modern security specifications to enhance the protection of cookies in your web application.

Watch on [YouTube](

Secure attribute

Attacker 可以利用 MiTM 拦截所有 http req, 让 https 直接通过. 然后在拦截的 http req, 增加一个 set cookies, 强制添加 cookie value 到他想要的 value.结果利用 double-submit cookie 的 anti-CSRF 就会被 bypass.

HttpOnly attribute

原则上, 只要 cookie set 了 HttpOnly, js 是无法访问它的. 但是演讲者通过运行一个 script, 将 cookie.jar 满泄, 将大量的 cookie 写入 cookie.jar, 旧 cookie 将从 cookie.jar 流出, 新增的 cookie 中没有了 httponly, js就可以访问它了.

NIN: 可惜 script 并没有公布.

Show Comments