Horizon Pages Loadable in Third-Party HTML Frames

Bug #1118327 reported by Jesse Pretorius
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
High
Jesse Pretorius

Bug Description

It is possible to load the web application in HTML FRAMES from third-party web sites, which makes Horizon vulnerable to various client-side attacks such as Clickjacking [1].

The following code on another webserver will load the page from Horizon:

<html>
  <title>XFS test</title>
  <body>
    <iframe src="https://horizonwebserver/nova/" width="100%" height="100%"></iframe>
  </body>
</html>

An attacker would need to load the web application in an HTML frame located on a third-party website. By applying an opaque overlay containing other content over the target web application and coercing the user to interact with the overlay, user mouse events and key presses can be directed through to the target web application.

A successful attack could allow a malicious user to post fraudulent transactions.

Horizon should ensure that all pages include a JavaScript Frame Killer to ensure that the page is only loaded within frames from authorised third-party domains or hosts. An example of such a Frame Killer is included below.

<style> htmls{display : none}; </style>
<script> if (self == top) { document.documentElement.style.display = ?block?; } else { top.location = self.location; } </script>

Other options rely on adding the X-Frame-Options in the header. This could be done in the web server's configuration [2], or in Django itself [3].

[1] https://www.owasp.org/index.php/Clickjacking
[2] https://developer.mozilla.org/en-US/docs/The_X-FRAME-OPTIONS_response_header
[3] https://docs.djangoproject.com/en/dev/ref/clickjacking/

Tags: security
Revision history for this message
Thierry Carrez (ttx) wrote :

Adding PTL

I guess that combined will long-lived cookies, that could be abused in a rather convoluted attack. Not totally convinced we need an advisory for this. Thoughts ?

Changed in horizon:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Gabriel Hurley (gabriel-hurley) wrote :

Django actually has a middleware for exactly this purpose: https://docs.djangoproject.com/en/dev/ref/clickjacking/

It sets the X-FRAME_OPTIONS header. We should use it. A patch to enable it by default is more than welcome. The patch would ideally include mention of why this is important in the "Deployment Considerations" section of the docs, too.

I definitely don't see this as something that requires a security release or advisory, but shipping Grizzly with it in the default recommended settings is definitely the way to go.

Changed in horizon:
milestone: none → grizzly-3
importance: Medium → High
milestone: grizzly-3 → none
milestone: none → grizzly-3
Changed in horizon:
assignee: nobody → Jesse Pretorius (jesse-pretorius)
Revision history for this message
Jesse Pretorius (jesse-pretorius) wrote :

Note that the Django Clickjacking Middleware was only introduced in Django v1.4, so it's likely that Essex Deployments from linux distributions like Ubuntu will not be able to make use of the middleware.

Revision history for this message
Thierry Carrez (ttx) wrote :

Unless someone complains in the next hours i'll be opening up this bug publicly, I see no reason to keep it under cover.

Revision history for this message
Jesse Pretorius (jesse-pretorius) wrote :

I agree - no reason to keep it private.

information type: Private Security → Public Security
Thierry Carrez (ttx)
information type: Public Security → Public
tags: added: security
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/21860

Changed in horizon:
status: Confirmed → In Progress
Changed in horizon:
assignee: Jesse Pretorius (jesse-pretorius) → Kieran Spear (kspear)
Revision history for this message
Kieran Spear (kspear) wrote :

Sorry, launchpad assigned this to me after I updated the commit message in your review, and I can't reassign it.

Changed in horizon:
assignee: Kieran Spear (kspear) → nobody
Changed in horizon:
assignee: nobody → Jesse Pretorius (jesse-pretorius)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/21860
Committed: http://github.com/openstack/horizon/commit/2b3d829de447930d8b33a12feb387a983a2e91dd
Submitter: Jenkins
Branch: master

commit 2b3d829de447930d8b33a12feb387a983a2e91dd
Author: Jesse Pretorius <email address hidden>
Date: Wed Feb 13 11:43:11 2013 +0200

    Add X-FRAME_OPTIONS header to protect against Clickjacking

    Enables the django.middleware.clickjacking.XFrameOptionsMiddleware
    middleware class with the default X-Frame-Options header SAMEORIGIN.
    More details here: https://docs.djangoproject.com/en/dev/ref/clickjacking/

    Change-Id: Ic06fdf0b79c9cd245c12ed1f4438af9a4b52ad03
    Fixes: bug #1118327

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: grizzly-3 → 2013.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.