Clickjacking Cheat Sheet
DRAFT CHEAT SHEET - WORK IN PROGRESS
This article is focused on providing developer guidance on Clickjack/UI Redress attack prevention. For more information on the risk of Clickjacking, please visit this page.
Defending with response headers
Thew X-FRAME-OPTIONS header is used to mark responses that should not be framed. There are three options with X-FRAME-OPTIONS.
- The first is DENY, which prevents everyone from framing the content.
- The second option is SAMEORIGIN, which only allows the current site to frame the content.
- The third, is the ALLOW-FROM 'sitename' header, which permits the specified 'sitename' to frame this page. (e.g., ALLOW-FROM http://www.foo.com) The ALLOW-FROM option is a relatively recent addition (circa 2012) and may not be supported by all browsers yet.
X-FRAME-OPTIONS has seen good adoption by major browsers, unfortunately studies have shown the header is not yet widely deployed by sites.
To implement this protection, you need to add the header to any page that you want to protect from being clickjacked. One way to do this is to add the header manually to every page. A possibly simpler way is to implement a filter that automatically adds the header to every page.
- OWASP has an article and some code that provides all the details for implementing this in the Java EE environment.
- The SDL blog has posted an article covering how to implement this in a .NET environment.
- In 2009, Microsoft implemented a header based defense in IE8 that allows developers to specify that pages should not be framed.
OWASP Cheat Sheets Project Homepage