Retrofitting Fine Grain Isolation in the Firefox Renderer

Retrofitting Fine Grain Isolation in the Firefox Renderer

Retrofitting Fine Grain Isolation in the Firefox Renderer Extended Version Shravan Narayan† Craig Disselkoen† Tal Garfinkel∗ Nathan Froyd Eric Rahm Sorin Lerner† Hovav Shacham?;† Deian Stefan† †UC San Diego ∗Stanford Mozilla ?UT Austin Abstract code [28]. Unfortunately, many remain—frequently in the Firefox and other major browsers rely on dozens of dozens of third-party libraries used by the renderer to decode third-party libraries to render audio, video, images, and other audio, images, fonts, and other content. For example, an content. These libraries are a frequent source of vulnerabil- out-of-bounds write in libvorbis was used to exploit Firefox at ities. To mitigate this threat, we are migrating Firefox to an Pwn2Own 2018 [7]. Both Chrome and Firefox were vulner- architecture that isolates these libraries in lightweight sand- able to an integer-overflow bug in the libvpx video decoding boxes, dramatically reducing the impact of a compromise. library [10]. Both also rely on the Skia graphics library, which Retrofitting isolation can be labor-intensive, very prone to had four remote code execution bugs until recently [12, 36]. security bugs, and requires critical attention to performance. To appreciate the impact of these vulnerabilities and the To help, we developed RLBox, a framework that minimizes difficulty of mitigating them, consider a typical web user, the burden of converting Firefox to securely and efficiently Alice, that uses Gmail to read email in her browser. Suppose use untrusted code. To enable this, RLBox employs static an intruder, Trudy, sends Alice an email that contains a link information flow enforcement, and lightweight dynamic to her malicious site, hosted on sites.google.com. If Alice checks, expressed directly in the C++ type system. clicks on the link, her browser will navigate her to Trudy’s RLBox supports efficient sandboxing through either site, which can embed an .ogg audio track or .webm video to software-based-fault isolation or multi-core process isolation. exploit vulnerabilities in libvorbis and libvpx and compromise Performance overheads are modest and transient, and have the renderer of Alice’s browser. Trudy now has total control only minor impact on page latency. We demonstrate this by of Alice’s Gmail account. Trudy can read and send emails sandboxing performance-sensitive image decoding libraries as Alice, for example, to respond to password reset requests (libjpeg and libpng), video decoding libraries (libtheora and from other sites Alice belongs to. In most cases, Trudy can libvpx), the libvorbis audio decoding library, and the zlib also attack cross site [14], i.e., she can access any other site decompression library. that Alice is logged into (e.g., Alice’s amazon.com account). RLBox, using a WebAssembly sandbox, has been inte- Recent version of Chrome (and upcoming versions of Fire- grated into production Firefox to sandbox the libGraphite font fox) support Site Isolation [40], which isolates different sites shaping library. from each other (e.g., *.google.com from *.amazon.com) 1 Introduction to prevent such cross-site attacks. Unfortunately, Trudy might still be able to access {drive,pay,cloud}.google.com, All major browsers today employ coarse grain privilege which manage Alice’s files, online payments, and cloud separation to limit the impact of vulnerabilities. To wit, infrastructure—since the renderer that loads the malicious they run renderers—the portion of the browser that handles arXiv:2003.00572v2 [cs.CR] 10 Mar 2020 .ogg and .webm content might still be running in the same untrusted user content from HTML parsing, to JavaScript process as those origins. execution, to image decoding and rendering—in separate sandboxed processes [3, 33, 39]. This stops web attackers For many sites, Trudy might not even need to up- that manage to compromise the renderer from abusing local load malicious content to the (trusted) victim origin OS resources to, say, install malware. (sites.google.com in our example). Most web applications Unfortunately, this is no longer enough: nearly every- load content, including images, fonts, and video, from thing we care about today is done through a website. By different origins. Of the Alexa top 500 websites, for example, compromising the renderer, an attacker gets total control of over 93% of the sites load at least one such cross-origin the current site and, often, any other sites the browser has resource (§7.1). And the libraries handling such content credentials for [14]. With services like Dropbox and Google are not isolated from the embedding origin, even with Site Drive, privilege separation is insufficient even to protect local Isolation [40]. files that sync with the cloud [24]. To mitigate these vulnerabilities, we need to harden the Browser vendors spend a huge amount of engineering renderer itself. To this end, we extend the Firefox renderer to effort trying to find renderer vulnerabilities in their own isolate third party libraries in fine grain sandboxes. Using this, 1 we can prevent a compromised library from gaining control Our evaluation shows that retrofitting fine grain isolation, of the current origin or any other origin in the browser. especially using SFI, is practical—and we’ve been integrating Making this practical poses three significant challenges RLBox into production Firefox [50].2 Since NaCl has been across three dimensions. First, engineering effort—we need to deprecated [17] in favor of WebAssembly (Wasm) [20], our minimize the upfront work required to change the renderer to production sandbox also uses Wasm. We used RLBox with use sandboxing, especially as this is multiplied across dozens this Wasm-based sandbox to isolate the libGraphite font of libraries; minimizing changes to libraries is also important shaping library and are in the process of migrating several as this can significantly increase the burden of tracking up- others [15, 50]. We describe this effort in Section9. stream changes. Second, security—the renderer was not built Though we developed RLBox to sandbox libraries in Fire- to protect itself from libraries; thus, we have to sanitize all data fox, RLBox is a general library-sandboxing framework that and regulate control flow between the library and renderer can be used outside Firefox. To demonstrate this, we use RL- to prevent libraries from breaking out of the sandbox. In our Box to sandbox libraries in two different contexts: the Apache experience, bugs at the library-renderer boundary are not only web server and Node.js runtime. For Apache, we sandbox easy to overlook, but can nullify any sandboxing effort—and the libmarkdown library that is used in the mod_markdown other developers, not just us, must be able to securely sandbox module [31]; we find that RLBox with the SFI sandbox new libraries. Finally, efficiency—the renderer is performance increases the tail latency of the Apache server by 10% (4ms) critical, so adding user-visible latency is not acceptable. and decreases the throughput by 27% (256 requests/second). To help us address these challenges, we develop a For Node.js, we sandbox the C bcrypt library that is used by framework called RLBox that makes data- and control-flow the JavaScript bcrypt module [37]; we measure RLBox with at the library-renderer interface explicit, using types. Unlike SFI to impose an overhead of 27% on hashing throughput. prior approaches to sandbox automation that rely on extensive Contributions. We present the case for sandboxing third 1 custom analysis frameworks (§8), RLBox is simply a library party libraries in the browser renderer, and potential archi- that leverages the C++ type system and is easy to incorporate tectural trade-offs, including our approach (§2). We offer a into Firefox’s predominantly C++ codebase. taxonomy of security pitfalls encountered while migrating Using type information, RLBox can identify where security the Firefox code base to this architecture that were largely checks are needed, automatically insert dynamic checks when overlooked by previous work (§3), and RLBox, a framework possible, and force compiler errors for any security checks we developed to prevent these pitfalls that leverages the that require additional user intervention. Our type-driven C++ type system to enforce safe data and control flow (§4), approach enables a systematic way to migrate Firefox’s and enables an incremental compiler-driven approach to renderer to use sandboxed libraries and allows RLBox to migrating code to a sandboxed architecture (§5). We describe support secure and efficient sharing of data structures between our implementation, including our software fault isolation the renderer and library (e.g., by making shared memory and multi-core process-based isolation mechanisms (§6), and operations safe and by lazily copying data out of the sandbox). evaluate the performance of RLBox (§7). We close with a To enable efficient sandboxing, we adapt and evaluate two discussion of related work (§8) and our effort upstreaming isolation mechanisms for library sandboxing: software-based RLBox into production Firefox (§9). fault isolation (SFI) leveraging Google’s Native Client (NaCl) [48, 64] and a multi-core process-based approach. We Availability. All work presented in this paper, including our modified Firefox builds, the RLBox library, and benchmarks also explore applying sandboxing at different granularities 3 (e.g., per-origin and per-library sandboxing) to find the ap- are available and open source. propriate balance between security and sandboxing overhead. 2 Fine grain sandboxing: how and why To evaluate RLBox, we sandbox several libraries in Firefox: the libjpeg and libpng image decoding libraries, the libvpx and Renderers rely on dozens of third-party libraries to support libtheora video decoding libraries, the libvorbis audio decod- media decoding and other tasks (e.g., decompression, ing library, and the zlib decompression library. Browsing a which sites use to optimize page load times and bandwidth representative sample of both popular and unpopular websites consumption). These are written almost exclusively in C (§7), we find the end-to-end memory overhead of RLBox to and tasked with parsing a wide range of complex inputs.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    20 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