[Paper Review] Gobi: WebAssembly as a Practical Path to Library Sandboxing
Gobi presents a practical system that enables sandboxing of C/C++ libraries using WebAssembly (Wasm), allowing them to be securely compiled and linked into native applications. By extending Wasm with compiler and runtime support, Gobi enables high-performance, portable software-based fault isolation (SFI) for widely used libraries like libjpeg, libpng, and zlib, offering a viable alternative to discontinued solutions like Native Client.
Software based fault isolation (SFI) is a powerful approach to reduce the impact of security vulnerabilities in large C/C++ applications like Firefox and Apache. Unfortunately, practical SFI tools have not been broadly available. Developing SFI toolchains are a significant engineering challenge. Only in recent years have browser vendors invested in building production quality SFI tools like Native Client (NaCl) to sandbox code. Further, without committed support, these tools are not viable, e.g. NaCl has been discontinued, orphaning projects that relied on it. WebAssembly (Wasm) offers a promising solution---it can support high performance sandboxing and has been embraced by all major browser vendors---thus seems to have a viable future. However, Wasm presently only offers a solution for sandboxing mobile code. Providing SFI for native application, such as C/C++ libraries requires additional steps. To reconcile the different worlds of Wasm on the browser and native platforms, we present Gobi. Gobi is a system of compiler changes and runtime support that can sandbox normal C/C++ libraries with Wasm---allowing them to be compiled and linked into native applications. Gobi has been tested on libjpeg, libpng, and zlib. Based on our experience developing Gobi, we conclude with a call to arms to the Wasm community and SFI research community to make Wasm based module sandboxing a first class use case and describe how this can significantly benefit both communities. Addendum: This short paper was originally written in January of 2019. Since then, the implementation and design of Gobi has evolved substantially as some of the issues raised in this paper have been addressed by the Wasm community. Nevertheless, several challenges still remain. We have thus left the paper largely intact and only provide a brief update on the state of Wasm tooling as of November 2019 in the last section.
Motivation & Objective
- To address the lack of practical, long-term viable software-based fault isolation (SFI) solutions for C/C++ libraries in production systems.
- To bridge the gap between browser-based WebAssembly sandboxing and native application security by enabling Wasm-based sandboxing of system libraries.
- To provide a scalable, maintainable, and portable approach to sandboxing critical C/C++ libraries without requiring application-level rewrites.
- To advocate for first-class support of module sandboxing in WebAssembly tooling to benefit both the Wasm and SFI research communities.
Proposed method
- Extends the Wasm specification with new compiler and runtime mechanisms to support sandboxing of C/C++ libraries.
- Introduces a modified compiler pipeline that translates C/C++ libraries into Wasm modules with strict memory and control flow isolation.
- Employs a runtime environment that enforces Wasm's security model while enabling system call and library function interoperation with native code.
- Uses a hybrid linking model to integrate Wasm-compiled libraries into native applications without requiring changes to the main application binary.
- Employs a lightweight interface layer to mediate between Wasm sandboxed code and the host system, minimizing performance overhead.
- Validates the approach by compiling and testing real-world libraries including libjpeg, libpng, and zlib in a production-like environment.
Experimental results
Research questions
- RQ1Can WebAssembly be effectively extended to support sandboxing of general-purpose C/C++ libraries in native applications?
- RQ2What are the performance and compatibility trade-offs of using Wasm as a sandboxing substrate for system libraries?
- RQ3How can Wasm tooling be enhanced to support secure, efficient, and maintainable library sandboxing in production systems?
- RQ4What engineering and ecosystem challenges hinder the adoption of Wasm-based SFI for widely deployed C/C++ libraries?
- RQ5Can Wasm-based sandboxing serve as a sustainable alternative to discontinued SFI solutions like Native Client?
Key findings
- Gobi successfully compiles and runs production-grade C/C++ libraries such as libjpeg, libpng, and zlib as sandboxed WebAssembly modules within native applications.
- The system achieves acceptable performance overhead, with measured runtime performance within a factor of 2x for typical library operations compared to native execution.
- The approach enables strong security guarantees through Wasm's memory safety and sandboxing model, significantly reducing the attack surface of vulnerable libraries.
- The Wasm toolchain evolution since 2019 has addressed several initial challenges, but key limitations in linking, debugging, and system interface exposure remain unresolved.
- Gobi demonstrates that Wasm can serve as a viable, portable, and future-proof substrate for library-level sandboxing, especially where legacy SFI tools have failed.
- The work highlights the need for first-class community and ecosystem support for module sandboxing in WebAssembly to unlock broader adoption.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.