---
title: "WebAssembly and Back Again: Fine-Grained Sandboxing in Firefox 95"
description: "Firefox 95 ships RLBox, a fine-grained sandboxing technique that compiles third-party C/C++ libraries (Graphite, Hunspell, Ogg, with Expat and Woff2 following in 96) to WebAssembly and then back to native code, so untrusted code runs in-process but cannot jump to unexpected code or touch memory outside its region."
url: "https://swe.quest/articles/webassembly-and-back-again-fine-grained-sandboxing-in-firefox-95-d23a4c9673130b46"
canonical: "https://hacks.mozilla.org/2021/12/webassembly-and-back-again-fine-grained-sandboxing-in-firefox-95/"
source: "Mozilla Hacks"
published: "2021-12-06"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 4
tags: ["sandboxing","webassembly","browsers","memory-safety","supply-chain-security"]
---

# WebAssembly and Back Again: Fine-Grained Sandboxing in Firefox 95

A post on [Mozilla Hacks](https://swe.quest/sources/mozilla-hacks.md), published 2021-12-06, 4 min read, Deep dive. Original: [https://hacks.mozilla.org/2021/12/webassembly-and-back-again-fine-grained-sandboxing-in-firefox-95/](https://hacks.mozilla.org/2021/12/webassembly-and-back-again-fine-grained-sandboxing-in-firefox-95/)

## Summary

Firefox 95 ships RLBox, a fine-grained sandboxing technique that compiles third-party C/C++ libraries (Graphite, Hunspell, Ogg, with Expat and Woff2 following in 96) to WebAssembly and then back to native code, so untrusted code runs in-process but cannot jump to unexpected code or touch memory outside its region. This avoids the asynchrony refactoring and memory overhead of process-based isolation, needing only sanitization of values crossing the boundary via RLBox's tainting layer. The production pipeline replaced the Cranelift prototype with wasm2c, translating wasm to C and feeding it back into Clang, which preserves PGO, cross-boundary inlining, crash reporting and debugger support. Mozilla now pays bug bounties for sandbox escapes even without a library vulnerability.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Sandboxing & isolation](https://swe.quest/tags/sandboxing.md) (Security)
- [WebAssembly](https://swe.quest/tags/webassembly.md) (Languages)
- [Browsers](https://swe.quest/tags/browsers.md) (Web & mobile)
- [Memory safety](https://swe.quest/tags/memory-safety.md) (Security)
- [Supply chain security](https://swe.quest/tags/supply-chain-security.md) (Security)

## Prerequisites

- process sandboxing ([easy posts on Sandboxing & isolation](https://swe.quest/tags/sandboxing.md?difficulty=easy))
- WebAssembly basics ([easy posts on WebAssembly](https://swe.quest/tags/webassembly.md?difficulty=easy))
- C/C++ compilation ([easy posts on C & C++](https://swe.quest/tags/c-cpp.md?difficulty=easy))

## Keywords

RLBox, Firefox, wasm2c, Clang, Cranelift, Hunspell, Expat

## Related posts

- [Server-side sandboxing: An introduction](https://swe.quest/articles/server-side-sandboxing-an-introduction-7a8a0dd3442f4e4f.md): Figma · 2023-10-24 · Easy · 9 min read · Sandboxing & isolation, Security, Virtualization, Containers, Linux
  Server-side workloads like image processing, parsing and thumbnailing often depend on memory-unsafe C++ libraries with histories of exploitable bugs (e.g. ImageTragick), so Figma isolates them with sandboxing rather than relying solely on preventing vulnerabilities.
- [Extensible Language Support in Zed - Part 1](https://swe.quest/articles/extensible-language-support-in-zed-part-1-13bc037c6f5096a9.md): Zed · 2024-04-18 · Medium · 7 min read · WebAssembly, Developer tools, Sandboxing & isolation, Compilers, Rust
  Zed loads third-party Tree-sitter grammars as WebAssembly modules using a hybrid design.
- [New WebKit Features in Safari 15.2](https://swe.quest/articles/new-webkit-features-in-safari-15-2-c701531c4db0aaf6.md): WebKit · 2021-12-13 · Easy · 2 min read · Browsers, WebAssembly, Application security
  Safari 15.2 expands WebAssembly addressable memory to 4GB and adds zero-cost exception handling for Wasm.
- [The V8 Sandbox](https://swe.quest/articles/the-v8-sandbox-705346b1934809ad.md): V8 · 2024-04-04 · Hard · 11 min read · Sandboxing & isolation, Runtimes & VMs, Memory safety, Browsers, Vulnerability research
  The V8 Sandbox is a lightweight, in-process software sandbox that isolates the V8 heap so memory corruption from engine bugs cannot spread to the rest of the renderer process.
- [Making Claude Code safer with sandboxing](https://swe.quest/articles/making-claude-code-safer-with-sandboxing-927e34fb9dfe9ca9.md): Anthropic Engineering · 2025-10-20 · Medium · 5 min read · Sandboxing & isolation, AI agents, AI for coding, Security
  Claude Code now sandboxes its bash tool using OS-level primitives (Linux bubblewrap, macOS seatbelt) to enforce filesystem isolation (writes limited to the working directory) and network isolation (traffic forced through a Unix domain socket to an external proxy that allowlists domains), covering all spawned subprocesses.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
