Hacking

WebAssembly Malware: AI That Runs in Browsers Silently

Published  ·  8 min read

WebAssembly Malware

You are browsing a news site. A page loads. You see the article. Everything looks normal. But behind the scenes, something else is happening. A WebAssembly module has just loaded. It is running in your browser. No process was created. No file was written to disk. Your EDR sees nothing.

This is the new reality. WebAssembly (WASM) is a low-level binary format that runs in modern browsers at near-native speed. It was designed for performance-critical applications like video editing and gaming. Attackers have noticed.

Let me show you how WASM malware works in practice, why it is so hard to detect, and what you can do about it.

⚠️ DISCLAIMER

This article is for educational and defensive purposes only.

The techniques described here are used by attackers in the wild. Understanding how they work is essential for defending against them. This information is intended for security professionals, researchers, and defenders, not for malicious use.

Do not use these techniques on systems you do not own or have explicit written permission to test. Unauthorized use of these techniques is illegal and unethical. The author and publisher are not responsible for any misuse of the information contained in this article.

Why WebAssembly Malware Is a Game Changer for Malware

Traditional browser attacks rely on JavaScript. Security tools have spent years learning to detect malicious JS. They look for eval(), atob(), and common payload patterns. They block known signatures. They inspect the code.

WASM changes everything.

A WASM binary is compiled bytecode. It has no trivial source decompilation. It is loaded via WebAssembly.instantiate() or import()  harder to fingerprint at rest than a JavaScript file. It runs in the browser's WASM sandbox, the same security boundary as JavaScript, but the detection surface is completely different.

Most importantly, WASM payloads do not spawn a native process. They do not load a driver. They do not make OS API calls. This makes them invisible to host-based EDR sensors that monitor process creation, DLL injection, or syscall activity.

How WebAssembly Malware Gets Delivered

Attackers have several ways to get WASM malware into your browser.

Stored XSS Injection

A stored XSS payload loads the WASM module via a <script type="module"> tag. Many applications lack a Content Security Policy (CSP) or have overly permissive policies, making this trivial.

Compromised Service Worker

A service worker with fetch event interception can modify every HTML response it serves. Injecting a <script type="module"> tag that loads the WASM payload turns a service worker compromise into persistent in-browser code execution for every page load.

MV3 Extension Update Injection

Attackers can compromise Chrome extension developers through phishing or credential theft. The extension's auto-update mechanism silently installs the malicious version. This mirrors real incidents where dozens of Chrome extensions were updated with malicious content scripts after developers were phished.

Last-Mile Reassembly Attacks

Instead of sending a malicious payload that a SASE stack can inspect in transit, attackers now send the instructions and let the browser assemble the payload locally. The network stack never sees a file to scan; the malicious artifact is created entirely inside the browser.

What WebAssembly Malware Can Do

Once loaded, WASM malware can perform a range of malicious activities.

Cryptojacking

This is the most common use case. WASM miners can use your CPU to mine cryptocurrency. Unlike JavaScript miners, WASM miners are more efficient and harder to detect. Your computer slows down. Your battery drains faster. The attacker gets the crypto.

Data Exfiltration

WASM modules can access browser storage, cookies, and form data. They have the capability of stealing credentials, session tokens, and personally identifiable information. The stolen data is then forwarded to servers controlled by the attackers.

Credential Harvesting

WASM malware has the capability of sniffing form submissions. This can lead to stealing of credentials such as passwords and credit card numbers.

Phishing Delivery

WASM modules can render fake login pages directly in the browser. The page looks legitimate. The user enters their credentials. The credentials are stolen.

Proxy and Pivot

WASM malware can use your browser as a proxy. The attacker routes traffic through your connection. Your IP address is used for malicious activities. You are the proxy.

Practical Example: Cryptojacking with WebAssembly Malware

A typical example is cryptojacking. A WASM miner will be injected into a legitimate website by the attacker.

Step 1: Injection

The script code of the WASM miner will be injected through XSS attacks.

<script type="module">
import { startMining } from './miner.wasm';
startMining();
</script>

Step 2: Loading

Loading of the WASM module takes place within the browser, and the process of executing the module commences.

Step 3: Mining

Mining of the crypto currency takes place by the WASM module using the processing power of the web browser’s CPU.

Step 4: Exfiltration

The mined coins are moved from the victim's account to the hacker’s wallet.

Detection Problems:

  • No process creation
  • No file writes
  • No network alarms (the mining traffic appears like a regular HTTPS traffic)
  • No anti-virus signatures (it is not a PE or an ELF file)

How to Detect WebAssembly Malware

Detection is difficult but not impossible. You need to look at the browser level, not the host level.

Browser Developer Tools

Use Developer Tools (F12). Click on the Performance tab. See if there is high CPU usage by the WebAssembly functions. It is a sign of cryptojacking.

Task Manager

Chrome's built-in Task Manager (Shift+Esc) shows CPU usage per tab. If a tab is using 100% CPU and you are not playing a game or editing video, investigate.

Network Monitoring

Watch out for loading of WebAssembly modules. WebAssembly modules are loaded using the .wasm file format. Network monitoring of .wasm files coming from unusual locations.

Content Security Policy (CSP)

Put in place a very restrictive CSP that allows only trusted sources to load WASM files.

<meta http-equiv="Content-Security-Policy" 
      content="script-src 'self'; 
               connect-src 'self'; 
               worker-src 'self'; 
               style-src 'unsafe-inline';">

 

Extension Auditing

Regularly audit your browser extensions. Remove any extensions you do not need. Only install extensions from trusted sources.

Methods to Protect Yourself from WebAssembly Malware

Protection against WASM malware involves a number of Layers.

Layer 1: Network

Detect attempts to load WASM files. Filter out known malicious WASM hashes. Subscribe to feeds of threats including WASM signatures.

Layer 2: Browser

Choose a browser that has some protection of its own. Activate Site Isolation.  Install an extension on the browser that blocks WASM for sites not known to you.

Layer 3: Browser Extensions

Use browser extensions only from trustworthy websites. Conduct audits for browser extensions. Uninstall browser extensions not required by you.

Layer 4: End User Training

Make end users aware of the potential dangers of accessing new web sites. Malware infections have occurred in phishing attacks or malvertising campaigns.

Layer 5: Incident Response

Create a response plan to WASM malware infection. This involves isolation of the infected computer, root cause analysis, and preventive measures.

The Future of WebAssembly Malware

WASM malware is still in its early stages. Attackers are experimenting. The capabilities are growing.

AI Integration

Future WASM malware may integrate AI. This malware could use this technique to learn about the environment and thus bypass any analysis.

Sandbox Escape

Researchers have demonstrated sandbox escapes in WASM runtimes. Future malware may escape the browser sandbox and run native code.

Persistence

Service workers can keep WASM modules running even after the tab is closed. This creates persistent in-browser backdoors.

Cross-Platform

WASM runs in all modern browsers. It runs on Windows, macOS, Linux, and mobile devices. A single WASM payload can target all platforms.

The Bottom Line

WebAssembly Malware is a real and growing threat. It runs in your browser without creating processes or writing files. It is invisible to traditional security tools.

Attackers are using WASM for cryptojacking, data theft, and credential harvesting. The delivery methods are diverse. The detection is difficult.

Defend against it by monitoring browser activity, implementing strict CSPs, auditing extensions, and training users.

The malware is already running in browsers. Make sure it is not running in yours.

FAQ Section

What is WebAssembly Malware?

WebAssembly malware is malicious code written as WebAssembly bytecode to run in your browser. The bytecode runs almost natively, making it hard to detect since it doesn’t generate processes or write to disk.

How do I get WebAssembly Malware in my browser?

There are techniques used by the attacker that could include stored cross-site scripting injection, compromised service worker, malicious browser extension, or last mile reassembly attack. You get the malware in your browser when you visit the hacked website.

What can WebAssembly Malware do?

WASM malware is capable of doing cryptojacking, stealing your data and credentials, deploying phishing pages, and using your browser as a proxy.

How will I know if there is WebAssembly Malware?

Chrome Task Manager allows you to track CPU utilization by tabs. Look at the Performance tab on Developer Tools to find WebAssembly. Inspect network requests for .wasm files.

How can I protect myself from malware attacks in WebAssembly Malware?

Content Security Policy, browser extension auditing, usage of a content blocker, browser updates, and user training for the dangers of visiting suspicious sites.

Professional Services

Explore Our Cybersecurity Services

Our insights are backed by hands-on service delivery. If your business needs professional cybersecurity support, our UK-based specialists are ready to help.

© 2016 – 2026 Red Secure Tech Ltd. Registered in England and Wales — Company No: 15581067