Skip to main content
QUICK REVIEW

[Paper Review] ADsafety: Type-Based Verification of JavaScript Sandboxing

Joe Gibbs Politz, Spiridon Eliopoulos|arXiv (Cornell University)|Jun 25, 2015
Web Application Security VulnerabilitiesComputer Science33 references74 citations
TL;DR

This paper presents ADsafety, a type system for verifying JavaScript sandboxing properties in ADsafe, a language-based Web sandbox. By encoding security properties directly into a lightweight, sound type system, the authors formally verify ADsafe's safety guarantees and uncover previously undetected bugs and weaknesses in its implementation.

ABSTRACT

Web sites routinely incorporate JavaScript programs from several sources into a single page. These sources must be protected from one another, which requires robust sandboxing. The many entry-points of sandboxes and the subtleties of JavaScript demand robust verification of the actual sandbox source. We use a novel type system for JavaScript to encode and verify sandboxing properties. The resulting verifier is lightweight and efficient, and operates on actual source. We demonstrate the effectiveness of our technique by applying it to ADsafe, which revealed several bugs and other weaknesses.

Motivation & Objective

  • To address the critical need for formal verification of JavaScript sandboxing mechanisms, which are essential for securing mashup web applications.
  • To develop a lightweight, scalable type system that can verify security properties in actual JavaScript source code, rather than relying on informal code reviews.
  • To formally define and verify ADsafe’s safety properties using a type system that captures runtime checks and capability attenuation.
  • To identify and fix previously undetected bugs and design weaknesses in the ADsafe framework through systematic type-based verification.

Proposed method

  • Design a novel, sound type system for general JavaScript that supports patterns common in sandboxing libraries, including dynamic checks and object wrapping.
  • Formally specify ADsafe’s security properties—such as capability attenuation and prevention of direct DOM access—within the type system.
  • Integrate the type system with a static verifier that operates directly on source code, enabling lightweight yet precise verification.
  • Use the type system to detect flaws in ADsafe’s runtime library, such as incorrect wrapping of DOM references and unsafe callback handling.
  • Leverage flow typing and object modeling techniques adapted from ML-ART and prior JavaScript type systems to handle JavaScript’s dynamic features like prototypes and function objects.
  • Prove the soundness of the type system relative to the full JavaScript language, ensuring that all type-checking guarantees hold across all possible executions.

Experimental results

Research questions

  • RQ1Can a type system be designed to formally verify the security properties of real-world JavaScript sandboxing frameworks like ADsafe?
  • RQ2How can a type system effectively encode and enforce capability attenuation and runtime checks in JavaScript without sacrificing scalability or expressiveness?
  • RQ3What specific security weaknesses in ADsafe’s implementation can be uncovered through formal type-based verification?
  • RQ4To what extent can type-based verification replace manual code review in securing complex sandboxing libraries?

Key findings

  • The ADsafety type system successfully verified all intended security properties of ADsafe, including proper wrapping of DOM references and prevention of direct capability access.
  • During verification, the system uncovered multiple previously undetected bugs and design flaws in ADsafe’s runtime library, such as incorrect handling of event callbacks and improper object wrapping.
  • The type system was able to detect that ADsafe fails to enforce a desirable information flow property, indicating a potential security gap in data leakage.
  • The verification process revealed that ADsafe’s static checker (JSLint) is insufficient on its own, as it does not catch certain dynamic safety violations.
  • The type system proved sound for the full JavaScript language, providing a formal guarantee that all programs passing type checking are secure under the defined safety model.
  • The approach demonstrated that type-based verification is both practical and effective for real-world sandboxing code, offering a scalable alternative to manual review.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.