metaSafer: A Technique to Detect Heap Metadata Corruption in WebAssembly
Open Access
- 26 October 2023
- journal article
- research article
- Published by Institute of Electrical and Electronics Engineers (IEEE) in IEEE Access
- Vol. 11, 124887-124898
Abstract
WebAssembly (Wasm), a technology enabling efficient native code execution in web browsers, has seen a significant rise in adoption as a popular compilation target. This has led to the emergence of lightweight web services powered by Wasm, characterized by their small binary size and reduced data transfer overhead, thanks to the inherent efficiency of Wasm. Despite their lightweight nature, these services can deliver powerful features like image/video processing, AI and graphical application that surpass the capabilities of JavaScript. To ensure lightweight web services and enhance the overall web experience,Wasm has been extensively optimized. However, these optimizations have raised concerns about memory safety, leading to memory-related vulnerabilities. Wasm’s characteristic memory structure, linear memory, has vulnerabilities that provide various attack vectors to attackers. In particular, it presents various attack possibilities through metadata modification containing memory structure information. Attackers can exploit heap memory overflow in Wasm applications, allowing them to target arbitrary memory addresses, modify data, or execute arbitrary code. Such overflows can corrupt memory metadata, resulting in incorrect memory behavior. While research has mitigate memory-related weaknesses in languages such as C and C++ and architectures like X86 in recent decades, the direct application of security solutions designed for different domains to Wasm is not a practical approach. Consequently, allocators in Wasm remain vulnerable to issues like heap overflow and metadata corruption. Thus, there is a pressing need for tailored memory safety techniques and solutions that accommodateWasm’s architecture-agnostic and linear memory structures. In this paper, we propose metaSafer as a solution. By shadowing metadata from Wasm linear memory to JavaScript virtual machine memory and conducting metadata verification, metaSafer effectively blocks attack attempts and vectors. Notably, our solution achieves fast memory shadowing and validation while maintaining a small code size. Through various verification processes, we measured the performance and code size of metaSafer, revealing that it is a software-only security solution with no additional hardware requirements. metaSafer demonstrates robust metadata protection forWasm applications with an acceptable performance overhead of up to 8% in SQLite [1] speed tests and Polybench [2] benchmarks.Keywords
Funding Information
- National Research Foundation of Korea
- Korea Government [Ministry of Science and ICT (MSIT)] (RS-2023-00217689)
- MSIT, Korea, through the Information Technology Research Center
- Institute for Information communications Technology Planning Evaluation (IITP-2023-RS-2023-00259967)
This publication has 14 references indexed in Scilit:
- The Security Risk of Lacking Compiler Protection in WebAssembly2021
- VIP: Safeguard Value Invariant Property for Thwarting Critical Memory Corruption Attacks2021
- An Empirical Study of Real-World WebAssembly Binaries2021
- Twine: An Embedded Trusted Runtime for WebAssembly2021
- Compositional Information Flow Analysis for WebAssembly Programs2020
- AccTEE2019
- CRAWLING AJAX-BASED WEB APPLICATIONS: EVOLUTION AND STATE-OF-THE-ARTMalaysian Journal of Computer Science, 2018
- Bringing the web up to speed with WebAssembly2017
- Control-Flow IntegrityACM Computing Surveys, 2017
- On the effectiveness of address-space randomization2004