Abstract
Modern web security relies on the Same-Origin Policy (SOP), yet a fundamental architectural mismatch between the Document Object Model (DOM) and JavaScript engines creates critical vulnerabilities. This paper identifies "capability leaks"—where JavaScript pointers are inadvertently shared across security origins—allowing attackers to bypass SOP and hijack sensitive data. We present a graph-based detection algorithm to identify these leaks, demonstrate exploitation techniques using "laundry" functions, and propose a high-performance defense mechanism that integrates access control directly into the JavaScript engine with minimal overhead.
The Architectural Mismatch
The Same-Origin Policy (SOP) is the cornerstone of web security, intended to prevent malicious scripts from interfering with sensitive data on other domains. However, browsers implement this using two conflicting paradigms. The DOM acts as a gatekeeper using an Access Control model, checking permissions every time a script attempts to access a resource like a cookie or a document. In contrast, the JavaScript engine follows an Object-Capability model: if a script possesses a pointer to an object, it is generally assumed to have the authority to use it.
This paper identifies a class of vulnerabilities called cross-origin JavaScript capability leaks. These occur when a browser implementation error "leaks" a JavaScript pointer across security boundaries. Because of the architectural mismatch, once an attacker obtains that pointer, they can often bypass the DOM's gatekeeper entirely, gaining full control over the victim's security origin.
Detection via Heap Graph Analysis
To identify these leaks systematically, the researchers developed an algorithm that monitors the "points-to" relationships within the JavaScript heap. A key insight was that an object's security origin is fundamentally tied to its prototype chain. By following the __proto__ chain back to the Object.prototype of a specific document, the tool can reliably "color" the entire heap by origin.
The tool searches for "suspicious edges"—pointers that connect objects belonging to different origins. This approach was tested on complex, real-world applications like Gmail, requiring the analysis of massive heap graphs to ensure security boundaries remained intact.
Exploitation: The "Laundry" Attack
To prove the severity of these leaks, the authors introduced the concept of "laundries". These are powerful functions often found in common libraries (like Prototype.js) that an attacker can trick into acting as a "confused deputy." By passing a leaked pointer to a laundry function, the attacker can force the library to execute privileged DOM APIs on their behalf, effectively laundering the unauthorized access into a legitimate-looking operation within the victim's origin.
Principled Defense and Results
Rather than patching individual leaks, the authors proposed a structural defense: adding access control checks directly into the JavaScript engine for every property access (get and set). To prevent significant performance degradation, they optimized these checks using inline caches, which skip redundant security checks for frequently accessed objects.
Key results of the study include:
- Vulnerability Discovery: The detection tool uncovered two high-severity, previously unknown capability leaks in WebKit related to window navigation and "lazy" object instantiation.
- Exploitability: Researchers successfully demonstrated how an attacker could leverage these leaks to inject scripts into honest origins, bypassing standard web application firewalls and XSS filters.
- Low-Overhead Defense: The proposed defense proved remarkably efficient, with a performance hit of only 1% to 2% on standard benchmarks like SunSpider and V8. This demonstrates that principled, engine-level security does not have to sacrifice speed.
Conclusion
Capability leaks represent a significant threat because they exploit the browser's internal logic rather than errors in website code. By resolving the conflict between Access Control and Object-Capability models, browsers can provide a more robust foundation for web security. Future work includes extending these checks to delete operations and further optimizing the lexical scope checks to reach near-zero overhead.
Summary updated