Abstract
As web applications evolve, attackers are increasingly leveraging WebAssembly (Wasm) to obfuscate malicious logic within JavaScript-based environments. This paper presents JWBinder, a novel framework designed to detect JavaScript-WebAssembly Multilingual Malware (JWMM) by reconstructing the static semantics of Wasm binaries back into high-level JavaScript. By bridging the semantic gap between these two languages, JWBinder enables existing security infrastructure to analyze previously opaque cross-language payloads. Our evaluation shows that JWBinder significantly improves the detection rate of commercial anti-virus engines from 49.1% to 86.2%.
1. Introduction
JavaScript (JS) remains the primary language of the web, and consequently, the primary vector for web-based malware. While security vendors have developed robust static analysis tools for JS, the introduction of WebAssembly (Wasm) in 2015 introduced a significant security blind spot. Wasm is a low-level binary instruction format that runs alongside JavaScript, offering near-native performance. However, its binary nature makes it an ideal "black box" for attackers. By moving malicious payloads—such as cryptominers or credential stealers—from JS into Wasm, attackers can bypass traditional scanners that are typically "monolingual" and unable to track data flow across the Foreign Language Interface (FFI).
2. The Challenge of Multilingual Malware
The core difficulty in detecting JWMM lies in the interoperation between the two languages. Current static analysis tools treat JS and Wasm as isolated entities. When a malicious script hands off execution or data to a Wasm module, the analysis chain is broken. To restore visibility, security tools must be able to understand the combined logic of both languages as a single, unified program.
3. Methodology: JWBinder and Static Semantics Reconstruction
The authors propose Static Semantics Reconstruction (SSR), a technique implemented in the tool JWBinder. The goal of JWBinder is to "de-wasm" the code, transforming a complex multilingual program into a functionally equivalent, pure JavaScript program that existing anti-virus (AV) engines can process.
3.1 Phase 1: Identifying the Bridge
JWBinder begins by performing a language-specific data-flow analysis on the host JavaScript code. It constructs a Program Dependency Graph (PDG) to pinpoint the exact locations where JS interacts with Wasm via the FFI. This identifies which JS functions are exported to Wasm and which Wasm functions are imported into the JS environment.
3.2 Phase 2: Logic Reconstruction
The core innovation of JWBinder is the observation of "homogeneity" between Wasm and JS. Despite their different formats, both languages share fundamental logical structures such as loops, branches, and variable assignments. JWBinder utilizes a set of abstraction rules to map low-level Wasm stack operations into high-level JavaScript (ES6) syntax.
3.3 Phase 3: The Inter-language Program Dependency Graph (IPDG)
The reconstructed Wasm logic is integrated into the original JS PDG to create a unified Inter-language Program Dependency Graph (IPDG). This graph represents the complete data and control flow of the multilingual application, effectively erasing the boundary between the two languages.
3.4 Phase 4: Code Generation
Finally, JWBinder traverses the IPDG to output a pure JavaScript program. This output mirrors the original malicious intent but expresses it in a format that standard static analysis tools can readily interpret.
4. Experimental Evaluation
To evaluate JWBinder, the authors developed JWBench, a dataset comprising 21,191 JWMM samples. These samples were generated by taking 44,369 real-world JS malware samples (from VirusTotal and the Hynek Petrak collection) and using the Wobfuscator tool to migrate their malicious logic into WebAssembly.
4.1 Detection Performance
The samples were tested against 74 commercial AV engines via VirusTotal. The results demonstrated a dramatic improvement in detection capabilities:
- Successful Detection Rate (SDR): Without JWBinder, the SDR was only 49.1%. After reconstruction by JWBinder, the SDR rose to 86.2%.
- Engine Consensus: The average number of engines flagging a sample as malicious doubled, increasing from 4.1 to 8.3.
- Precision: Testing on benign programs yielded a false positive rate of only 0.5%, indicating that the reconstruction process does not introduce artificial malicious patterns.
4.2 Efficiency
JWBinder proved practical for real-world deployment, with an average processing time of 25.6 seconds per program. This efficiency allows it to function as a high-throughput pre-processor for security pipelines.
5. Discussion and Limitations
JWBinder represents a significant step forward in multilingual malware detection by allowing security teams to reuse their existing, battle-tested JS detection patterns. However, two primary limitations remain:
- Dynamic Payloads: As a static analysis tool, JWBinder cannot detect malicious code generated or fetched dynamically at runtime.
- Advanced Obfuscation: Sophisticated obfuscation techniques that disrupt taint analysis can prevent the tool from accurately mapping the FFI interaction points.
6. Conclusion
By reconstructing the static semantics of WebAssembly into a high-level JavaScript representation, JWBinder effectively unmasks the hidden logic of multilingual malware. The significant boost in detection rates across dozens of commercial AV engines highlights the immediate utility of this approach in securing the modern web ecosystem.
Summary updated