WebAssembly is a new binary instruction format that allows targeted compiled code written in high-level languages to be executed with near-native speed by the browser's JavaScript engine. However, given that WebAssembly binaries can be compiled from unsafe languages like C/C++, classical code vulnerabilities such as buffer overflows or format strings can be transferred over from the original programs down to the cross-compiled binaries. As a result, this possibility of incorporating vulnerabilities in WebAssembly modules has widened the attack surface of modern web applications. This paper presents Wasmati, a static analysis tool for finding security vulnerabilities in WebAssembly binaries. It is based on the generation of a code property graph (CPG), a program representation previously adopted for detecting vulnerabilities in various languages but hitherto unapplied to WebAssembly. We formalize the definition of CPG for WebAssembly, introduce techniques to generate CPG for complex WebAssembly, and present four different query specification languages for finding vulnerabilities by traversing a program's CPG. We implemented ten queries capturing different vulnerability types and extensively tested Wasmati on four heterogeneous datasets. We show that Wasmati can scale the generation of CPGs for large real-world applications and can efficiently find vulnerabilities for all our query types. We have also tested our tool on WebAssembly binaries collected in the wild and identified several potential vulnerabilities, some of which we have manually confirmed to exist unless the enclosing application properly sanitizes the interaction with such affected binaries.
翻译:WebAssembly 是一种新的二进制指导格式, 它允许浏览器的 JavaScript 引擎以近本地速度使用浏览器 JavaScript 引擎以近本地速度执行以高语言撰写的有目标的编译代码。 但是, 鉴于 WebAs 的二进制文件可以用C/C++ 等不安全语言编译, 缓冲溢出或格式字符串等古典代码脆弱性可以从原始程序向下传输到交叉兼容的二进制文件。 因此, 将脆弱性纳入 WebAs 模块的可能性扩大了现代网络应用程序的攻击面面。 本文展示了Wasmati, 这是在网络大会的二进制数据中查找安全脆弱性的静态分析工具。 它基于一个代码属性图(CPG)的生成, 这是先前为检测各种语言的脆弱性而采用的程序, 但迄今为止尚未被应用到网络大会。 我们正式定义了 CPGS的定义, 为复杂的网络大会引入了四种不同的查询规格语言来查找脆弱性。 我们实施了十种不同的弱点, 并且广泛测试了四个混杂数据集。 我们在Wamatti 可以在网络上正确测试了某些版本的版本的变式的变式的变式的变式的变式的变式的变式的变式计算机工具, 。