{"id":102,"date":"2010-04-25T05:36:45","date_gmt":"2010-04-25T13:36:45","guid":{"rendered":"http:\/\/www.mantisbt.org\/blog\/?p=102"},"modified":"2015-01-16T09:49:58","modified_gmt":"2015-01-16T14:49:58","slug":"clickjacking-protection-in-mantisbt-1-2-1","status":"publish","type":"post","link":"https:\/\/mantisbt.org\/blog\/archives\/mantisbt\/102","title":{"rendered":"Clickjacking protection in MantisBT 1.2.1"},"content":{"rendered":"<p>Mantis Bug Tracker 1.2.1 includes initial support for <a title=\"IE8 Blog: Introducing X-Frame-Options\" href=\"http:\/\/blogs.msdn.com\/ie\/archive\/2009\/01\/27\/ie8-security-part-vii-clickjacking-defenses.aspx\">X-Frame-Options<\/a> and <a title=\"Design considerations for Content Security Policy (CSP)\" href=\"https:\/\/wiki.mozilla.org\/Security\/CSP\/Design_Considerations\">X-Content-Security-Policy<\/a>. These two browser security features aim to protect users against <a title=\"OWASP: Clickjacking\" href=\"http:\/\/www.owasp.org\/index.php\/Clickjacking\">clickjacking<\/a> attacks. If you&#8217;re unfamiliar with clickjacking, <a title=\"Paul Stone on &quot;Next generation clickjacking&quot; at Black Hat EU 2010\" href=\"https:\/\/media.blackhat.com\/bh-eu-10\/presentations\/Stone\/BlackHat-EU-2010-Stone-Next-Generation-Clickjacking-slides.pdf\">this presentation<\/a> by Paul Stone at Black Hat EU 2010 provides an introduction to the topic. Essentially these options prevent a MantisBT site from being embedded within an IFrame on another website.<!--more--><\/p>\n<p>X-Frame-Options is supported in the latest versions of Internet Explorer, Opera, Safari and Chrome. If you&#8217;re using Firefox, you&#8217;ll need to install the <a title=\"NoScript\" href=\"http:\/\/noscript.net\/\">NoScript<\/a> extension to gain support for X-Frame-Options. However, Firefox 3.7 (currently under development) will support a more advanced security system called Content Security Policy (CSP). Where X-Frame-Options lets you toggle framing between on and off states, CSP lets you define rules for which domains are allowed to frame your MantisBT installation. CSP goes beyond providing just clickjacking protection and will also block data (images, scripts, etc) that is hosted on a different domain. Again, rules can be configured to allow data to be loaded from external domains if necessary. This feature is useful as an added layer of security against cross site scripting (XSS) attacks as an attacker can no longer load scripts or data from malicious websites.<\/p>\n<p>At the moment there is no configuration options within MantisBT to disable this new clickjacking protection. If you know what you&#8217;re doing and understand the clickjacking threat to your MantisBT installation you can disable or reconfigure the clickjacking protection within <a title=\"The latest source of core\/http_api.php\" href=\"http:\/\/git.mantisbt.org\/?p=mantisbt.git;a=blob;f=core\/http_api.php;hb=HEAD\">core\/http_api.php<\/a>. If you want to insert your MantisBT installation within an IFrame from a page on the same domain (for instance, bugs.yourname.com contains an IFrame which loads bugs.yourname.com\/mantisbt\/) then you will need to change the http_security_headers() function as follows:<\/p>\n<p>Find:<\/p>\n<pre>header( 'X-Frame-Options: DENY' );<\/pre>\n<p>Replace:<\/p>\n<pre>header( 'X-Frame-Options: SAMEORIGIN' );<\/pre>\n<p>Find:<\/p>\n<pre>header( \"X-Content-Security-Policy: allow 'self'; options inline-script eval-script$t_avatar_img_allow; frame-ancestors 'none'\" );<\/pre>\n<p>Replace:<\/p>\n<pre>header( \"X-Content-Security-Policy: allow 'self'; options inline-script eval-script$t_avatar_img_allow; frame-ancestors 'self'\" );<\/pre>\n<p>If you&#8217;re wanting to load your MantisBT installation in an IFrame from a different domain then you&#8217;ll need to comment out (place two forward slashes in front of) this line:<\/p>\n<pre>header( 'X-Frame-Options: DENY' );<\/pre>\n<p>You&#8217;ll then also need to make the following change where somewhere.yourdomain.com is the domain containing the page which loads MantisBT within an IFrame:<\/p>\n<pre>header( \"X-Content-Security-Policy: allow 'self'; options inline-script eval-script$t_avatar_img_allow; frame-ancestors somewhere.yourdomain.com \" );<\/pre>\n<p>As mentioned earlier, CSP also restricts the domains from which you can load external content from (images, scripts, etc). If you&#8217;ve written any custom plugins for MantisBT that load data in the browser from different domains (and if your users are using Firefox 3.7 beta) then you&#8217;ll need to read the <a title=\"Content Security Policy specifications\" href=\"https:\/\/wiki.mozilla.org\/Security\/CSP\/Specification\">CSP specifications<\/a> and add the required headers within the http_security_headers() function within http_api.php.<\/p>\n<p>The addition of these clickjacking prevention measures to MantisBT 1.2.1 helps keep your MantisBT installation secure against the &#8220;latest&#8221; (clickjacking has been around for years already) web application attacks. We hope to enhance this protection in future versions of MantisBT as these experimental browser clickjacking specifications are further developed. MantisBT 1.2.0 includes robust <a title=\"OWASP: Cross site request forgery (CSRF)\" href=\"http:\/\/www.owasp.org\/index.php\/Cross-Site_Request_Forgery_%28CSRF%29\">cross site request forgery<\/a> (CSRF) protection and many improvements to preventing <a title=\"OWASP: Cross site scripting (XSS)\" href=\"http:\/\/www.owasp.org\/index.php\/Cross-site_Scripting_%28XSS%29\">cross site scripting<\/a> (XSS) attacks (including cookie protection with the <a title=\"OWASP: HTTPOnly cookie flag\" href=\"http:\/\/www.owasp.org\/index.php\/HTTPOnly\">HttpOnly flag<\/a>). If you&#8217;re still using MantisBT 1.1.8 or an earlier version you are <span style=\"font-weight: bold;\">strongly<\/span> encouraged to upgrade to MantisBT 1.2.1 to ensure that your bug tracker(s) are properly secured.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mantis Bug Tracker 1.2.1 includes initial support for X-Frame-Options and X-Content-Security-Policy. These two browser security features aim to protect users against clickjacking attacks. If you&#8217;re unfamiliar with clickjacking, this presentation by Paul Stone at Black Hat EU 2010 provides an introduction to the topic. Essentially these options prevent a MantisBT site from being embedded within &hellip; <a href=\"https:\/\/mantisbt.org\/blog\/archives\/mantisbt\/102\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Clickjacking protection in MantisBT 1.2.1&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-102","post","type-post","status-publish","format-standard","hentry","category-mantisbt"],"_links":{"self":[{"href":"https:\/\/mantisbt.org\/blog\/wp-json\/wp\/v2\/posts\/102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mantisbt.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mantisbt.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mantisbt.org\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/mantisbt.org\/blog\/wp-json\/wp\/v2\/comments?post=102"}],"version-history":[{"count":1,"href":"https:\/\/mantisbt.org\/blog\/wp-json\/wp\/v2\/posts\/102\/revisions"}],"predecessor-version":[{"id":365,"href":"https:\/\/mantisbt.org\/blog\/wp-json\/wp\/v2\/posts\/102\/revisions\/365"}],"wp:attachment":[{"href":"https:\/\/mantisbt.org\/blog\/wp-json\/wp\/v2\/media?parent=102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mantisbt.org\/blog\/wp-json\/wp\/v2\/categories?post=102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mantisbt.org\/blog\/wp-json\/wp\/v2\/tags?post=102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}