(In)Secure Usage of New Client-Side Primitives

(In)Secure Usage of New Client-Side Primitives

The Emperor’s New APIs: On the (In)Secure Usage of New Client-side Primitives Steve Hannax, Eui Chul Richard Shinz, Devdatta Akhawex, Arman Boehmz, Prateek Saxenax, Dawn Songx fsch, ricshin, devdatta, boehm, prateeks, dawnsongg [email protected] [email protected] University of California, Berkeley implicitly trust data arriving on this channel, a variety of Abstract—Several new browser primitives have been pro- attacks can result. We aim to study how consistently this posed to meet the demands of application interactivity API is used securely in practice, by analyzing two promi- while enabling security. To investigate whether applications consistently use these primitives safely in practice, we study nent client-side protocols using postMessage, namely the real-world usage of two client-side primitives, namely Facebook Connect and Google Friend Connect. To system- postMessage and HTML5’s client-side database storage. atically evaluate the security of these protocols, we first We examine new purely client-side communication protocols reverse engineer the protocol mechanics/semantics as their layered on postMessage (Facebook Connect and Google designs were not documented. In our evaluation, we find Friend Connect) and several real-world web applications (including Gmail, Buzz, Maps and others) which use client- that both protocol implementations use the postMessage side storage abstractions. We find that, in practice, these primitive unsafely, opening the protocol to severe confiden- abstractions are used insecurely, which leads to severe tiality and integrity attacks. Worse, we observed that several vulnerabilities and can increase the attack surface for web sites using this protocol further widen their attack surface— applications in unexpected ways. We conclude the paper by in one we were able to achieve arbitrary code injection . offering insights into why these abstractions can potentially be hard to use safely, and propose the economy of liabilities We were able to concretely demonstrate proof-of-concept principle for designing future abstractions. The principle exploits that allow unauthorized web sites to compromise recommends that a good design for a primitive should users protocol sessions, which can lead to stealing of minimize the liability that the user undertakes to ensure users data or even injection of arbitrary code into benign application security. web sites using Facebook Connect and Google Friend Connect protocols. In our evaluation, we also observed a I. INTRODUCTION strange inconsistency—developers, belonging to the same With the growing demand for interactivity from Web 2.0 organization and sometimes of the same application, used applications, web application logic is significantly shifting the primitives safely in some places while using them from the server to the browser. This need to support unsafely in others. The vulnerabilities in communication complex client-side logic and cross-domain interaction primitives have been alluded to in research literature [3], has led to a proliferation of new client-side abstractions, [11]. However, these new client-side protocols have not such as the proposals in HTML5. A number of major web been studied previously and we are first to demonstrate application providers (including Google and Facebook) the practicality and severity of these vulnerabilities in the have responded by offloading several security-critical parts context of real-world client-side communication protocols. of their functionality to the client. As a second representative of a purely client-side However, due to the nascence of these primitives, abstraction, we study client-side data storage primitives the security implications of using these new client-side and various applications that rely on these. We find that abstractions on the web application’s overall security have a large fraction (7 out of 11) of the web applications, received little evaluation thus far. To investigate this issue, including Google Buzz, Gmail and Google Maps, place we selected two primitives as case studies representative of excessive trust on data in client-side storage. As a result the class of emerging client-side constructs. First, we study of this reliance, transient attacks (such as a cross-site systems using postMessage, a primitive that enables cross- scripting vulnerability) can persist across sessions (even origin communication within the web browser. Specifically, up to months), while remaining invisible to the web we analyzed two new purely client-side protocols, namely server [5], [13]. In our results, as in the case of the Google Friend Connect and Facebook Connect, which are postMessage study, we observed a similar inconsistency layered on postMessage. As a second case study, we in developer’s sanitization of the dangerous data. Our analyze the usage of client-side storage primitives (such as results show that despite some prior knowledge of the HTML5 localStorage, webDatabase API and database storage vulnerabilities [13], in practice, applications find it storage in Google Gears) by popular applications such as difficult to sanitize dangerous data at all places. Gmail, Google Docs, Google Buzz and so on. We observe a common problem with these new client- The postMessage API is a message passing mechanism side primitives: to ensure security, every use of the primitive that can be used for secure communication of primitive needs to be accompanied by custom sanity checks. This strings between browser windows. However, if developers leads to repeated effort of developing sanity checks by do not use the security features of the primitive fully or each application that uses the primitive. And, often even within one application similar checks may be distributed II. ATTACKS ON CLIENT-SIDE MESSAGING throughout the application code, a practice which is prone The postMessage API is a client-side primitive to to errors. We propose the economy of liabilities principle in enable cross-origin communication at the browser side. designing security primitives—a primitive must minimize Originally introduced in HTML5, postMessage aims to the liability that the user undertakes to ensure application provide a simple, purely client-side cross-origin channel for security. For example, in this context, the principle of exchanging primitive strings [15]. Web browsers typically economy of liabilities implies that client-side primitives prevent documents with different origins from affecting should internally perform sanitization functionality critical each other [12]. A mashup specifically aims to overcome to achieve the intended security property, as much as this restriction and communicate with another web site in possible. New primitives today ignore this design principle, order to provide a richer experience to the user. Barth et al. achieving security only ‘in principle’ rather than ‘in [2] study various client-side cross-origin communication practice’1. We hope the economy of liabilities principle channels and recommend the postMessage mechanism, will guide the designs of future primitives. due to the security guarantees(detailed below) it is able to Retrofitting the economy of liabilities principle to the provide. existing primitive designs is challenging as they have been The postMessage primitive aims to provide the dual adopted by real-world applications already. Furthermore, guarantees of authenticity and confidentiality. Messages the exact sanitization policies vary significantly across can be sent to another window by invoking the window’s applications. However, we suggest enhancements to these postMessage method. Note that this message exchange primitives which we believe achieves a reasonable compro- happens completely over the client side and no data is sent mise between security and compatibility. In particular, we over the network. The security guarantees are achieved as suggest a declarative style, whitelist-based origin validation follows: scheme that should be provided by the postMessage • Confidentiality: The sender can specify the intended primitive and enforced by the browser to ensure channel recipient’s origin in the postMessage method call. integrity. For client-side database primitives, we suggest the The browser guarantees that the actual recipient’s browser database interface should automatically perform origin matches the origin given in the postMessage output sanitization to prevent persistent XSS attacks. We call, and code executing in any other origin’s context hope that these suggestions kick start discussion in the web is unable to see the message. The intended recipient’s community on refinements to reduce developer burden. origin, specified in the method call, is called the Summary of Contributions. targetOrigin parameter. For use cases in which confidentiality is not essential, a sender can specify • We systematically examine two representatives of the all-permissive ‘*’ literal as the targetOrigin. new client-side primitives which are in popular use by • Authenticity: The browser attributes each received real-world applications: (a) postMessage, a cross- message with the origin of the sender, as the origin domain message passing API, and (b) persistent property of the message event. The recipient is ex- client-side database storage (HTML5 localStorage, pected to validate the sender’s origin as coming from webDatabase APIs and database storage in Google a trusted source, thus achieving sender authenticity. Gears). Note that if these checks are missed by the application, • We present the first step towards

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    10 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us