This week in HTML 5-Episode 7

Source: Internet
Author: User

Clickjacking.

Welcome back to "this week in HTML 5," where I'll try to summarize the major activity in the ongoing standards process in the whatwg and W3C HTML Working Group.

Work continued this week on web forms 2, but I'm going to hold off on that until next week. and in case you missed it, Ian Hickson gave a tech talk on HTML 5, including live demos of some features recently implemented in nightly browser builds.

The big news this week is the disclosure of a vulnerability that researchers have dubbed "clickjacking. "To understand it, start with Giorgio maOne's post, clickjacking and NoScript. giorgio is the author of the popular NoScript extension for Firefox. in its default configuration, NoScript protects against this vulnerability on most sites in most situations; you can configure it to defeat the attack entirely, but only at the cost of usability and functionality.

of course, most web users do not run firefox, and fewer still run NoScript, so Web developers still need to be aware of it. michal zarewski's post, dealing with UI redress vulnerabilities inherent to the current web, addresses some possible workarounds:

  1. using JavaScript hacks to detect that window. Top! = Window to inhibit rendering, or override window. top. location . these machisms work only if Javascript is enabled, however, and are not guaranteed to be reliable or future-safe. if the check is carried on every UI click, performance penalties apply, too. not to mention, the extra complexity is just counterintuitive and weird.
  2. requiring non-trivial reauthentication (CAPTCHA, password reentry) on all UI actions with any potential for abuse. although this is acceptable for certain critical operations, doing so every time a person adds Bob as a friend on a social networking site, or deletes a single mail in a Webmail system, is very impractical.

Worried yet? Now let's turn to the question of what browser vendors can do to mitigate the vulnerability. michal offers several proposals. it is important to realize that none of these proposals have been implemented yet, so don't go rushing off to your text editor and expecting them to do something useful.

  1. Create a HTTP-level (or HTTP-EQUIV) mechanic along the lines of "X-I-do-not-want-to-be-framed-since SS-domains: yes "that permits a web page to inhibit frame rendering in potentially dangerous situations.
  2. Add a document-level mechanisms to make "If nested <show this> else <show that>" conditionals possible without JavaScript. one proposal is to do this on the level of CSS (by using either the media-dependency features of CSS or special classes); another is to introduce new HTML tags. this wocould make it possible for pages to defend themselves even in environments where Javascript is disabled or limited.
  3. Add an on-by-default mechanic that prevents UI actions to be taken when a document tries to obstruct portions of a non-same-origin frame. by carefully designing the mechanism, we can prevent legitimate uses (such as dynamic menus that overlap with advertisements, gadgets, etc) from being affected, yet achieve a high reliability in stopping attacks.
  4. Enforce a click-to-work mechanisms (resembling the Eolas patent workaround) for all cross-domain iframes.
  5. Rework everything we know about html/browser security models to make it possible for domains and pages to specify very specific opt-in/opt-out policies for all types of linking, referencing, such that countering UI redress attacks wocould be just one of the cases controlled by this mechanic.

To this list, Colin Jackson added two more suggestions:

  1. New cookie attribute: the "HTTPOnly" Cookie flag allows sites to put restrictions on how a cookie can be accessed. we cocould allow a new flag to be specified in the Set-Cookie header that is designed to prevent csrf and "UI redress" attacks. if a cookie is set with a "sameorigin" flag, we cocould prevent that cookie from being sent on HTTP requests that are initiated by other origins, or were made by frames with ancestors of other origins. in a csrf or "UI redress" attack scenario, it will appear as though the user is not logged in, and thus the HTTP request will be unable to affect the user's account.
  2. New HTTP Request Header: browser vendors seem to be moving away from "Same Origin restrictions" towards "verifiable origin labels" that let the site decide whether two security origins trust each other .... [I] nstead of making it an "X-I-do-not-want-to-be-framed-stored SS-domains: yes" HTTP Response Header, make it an "X-ancestor-frame-origin: http://www.evil.com" http request header. this header cocould be a list of all the origins that are ancestors of the frame that triggered the request. if the site decides it does not like the ancestor frame origin it cocould reject the request. this cocould be added as a property of messageevent as well to detect client-side-only UI redress attacks.

This last approach moves us down a slippery slope towards site security vulnerabilities ies for iframes and embedded content, similar to the Flash security model that allows trusted sites to access cross-domain resources. in practice, flash crossdomain. XML files have a number of problems, and such an approach wowould still only cover a fraction of the possible use case.

you can read the full thread for all the gory details and back-and-forth among browser vendors (Maciej stachowiak works on WebKit, Robert O 'callahan works on Firefox) and other interested parties. as Maciej notes, user experience may suffer: "[under proposal #3] igoogle widgets wocould become disabled if scrolled partially off the top of the page under your proposal. and even if scrolled back into view, wocould remain disabled for a second. with possibly a jarring visual effect, or alternately, no visual indication that they are disabled. hard to decide which is worse. "As Rob notes, any solution will also need to deal with iframes Styled with opacity: 0, related attacks using some little-known (but widely supported) capabilities of SVG, and possibly other vectors that the world collectively hasn't figured out yet. if you're getting a mental image of the game "whack-a-mole," you're not alone.

Ironically, the best example of "clickjacking" is the download page for the NoScript extension, which uses it for good rather than edevil. thanks to some fancy JavaScript (search for "Installer"), Giorgio embeds Addons.mozilla.org Download Page for NoScript in an IFRAME on his own page on Noscript.net , Sets the IFRAME to "opacity: 0" (an attack vector that Robert O 'callahan specifically warned about), scrolls the embedded Addons.mozilla.org Page to the top corner of its "add to Firefox" button, and sets the Z-index of the IFRAME to 100. thus, the IFRAME is floating (due to "Z-index: 100") invisibly (due to "opacity: 0 ") over Giorgio's own "Install now" button (due to the positioning of the IFRAME element itself ). when you think you're clicking the button on Noscript.net You are actually clicking the button onAddons.mozilla.org . What's the difference? By default, Firefox treats Addons.mozilla.org As a trusted download site, so it immediately pops up the extension installation dialog instead of blocking the installation with an infobar saying "Firefox prevented this site (noscript.net) from installing software on your computer. "From a user experience standpoint, this is great -- one less click to download and install an extension. from a security standpoint, this is incredibly scary -- the end user has no idea they're interacting with a third-party site.

Ian Hickson, the editor of HTML 5, weighed in with his opinion:

I wocould like feedback from browser vendors on this topic, ideally in the form of experimental implementations. personally I think the idea of disabling the contents of a cross-origin IFRAME that has been partially obscured or rendered partially off-screen is the best idea, but whether we can adopt it depends somewhat on whether browser vendors are willing to adopt it and implement it. it requires no standards changes to implement.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.