Type-based Verification of JavaScript Sandboxing

Joe Gibbs Politz, Arjun Guha, and Shriram Krishnamurthi
Journal of Computer Security, 2014

Web pages routinely incorporate JavaScript code from third-party sources. However, all code in a page runs in the same security context, regardless of provenance. When Web pages incorporate third-party JavaScript without any checks, as many do, they open themselves to attack. A third-party can trivially inject malicious JavaScript into such a page, causing all manner of harm. Several such attacks have occurred in the wild on prominent, commercial Web sites.

A Web sandbox mitigates the threat of malicious JavaScript. Several Web sandboxes employ closely related language-based techniques to maintain backward- compatibility with old browsers and to provide fine-grained control. Unfortunately, due to the size and complexity of the Web platform and several subtleties of JavaScript, language-based sandboxing is hard and the Web sandboxes currently deployed on major Web sites do not come with any formal guarantees. Instead, they are routinely affected by bugs that violate their intended sandboxing properties.

This article presents a type-based approach to verifying Web sandboxes, using a JavaScript type-checker to encode and verify sandboxing properties. We demonstrate our approach by applying it to the ADsafe Web sandbox. Specifically, we verify several key properties of ADsafe, falsify one intended property, and find and fix several vulnerabilities, ultimately providing a proof of ADsafe’s safety.

We have written a blog post that summarizes this work.

PDF

@article{politz-jcs14,
    author = "Joe~Gibbs Politz and Arjun Guha and Shriram Krishnamurthi",
    title = "Typed-based verification of {Web} sandboxes",
    journal = "Journal of Computer Security",
    volume = 22,
    number = 4,
    year = 2014,
    pages = "511--565"
  }