Skip to main content
All Terms Glossary

Web Assembly (Wasm)

Definition

Web Assembly is a binary instruction format for stack-based virtual machines that enables high-performance execution of code in web browsers. While it runs in a sandboxed environment, security considerations include proper input validation and memory safety. Wasm modules should be treated with the same security scrutiny as other client-side code.

What WebAssembly is

WebAssembly, often shortened to Wasm, is a portable binary instruction format for a stack-based virtual machine that runs in web browsers alongside JavaScript. Languages such as C, C++, and Rust compile to compact Wasm modules that execute at near-native speed, which makes it well suited to CPU-intensive work like video processing, games, cryptography, and CAD tools in the browser. Wasm does not replace JavaScript; the two interoperate, with JavaScript typically loading a module and calling its exported functions while the module calls back into imported host functions. Modules run inside the same browser sandbox as page script and, by design, have no direct access to the DOM, the filesystem, or the network except through JavaScript and browser APIs.

Why it matters for security

The sandbox and linear-memory model give WebAssembly a strong baseline: a module cannot reach outside its own memory or call arbitrary host capabilities without an explicit import. But Wasm is still code, and its binary form makes it far harder for humans and many scanners to review than readable JavaScript, which attackers exploit to hide logic such as cryptominers or obfuscated skimming routines. Memory-safety bugs in the original C or C++ can survive compilation and be corrupted within the module's own memory. And because Wasm reaches the outside world only through its JavaScript bindings, weak or unvalidated glue code between the two is a common place for injection and misuse to slip in.

How to use it safely

Treat Wasm modules with the same scrutiny as any other client-side code: build them from source you trust, pin and verify what you ship, and apply Subresource Integrity when loading modules from a CDN so a tampered binary is rejected. Validate all data crossing the JavaScript-to-Wasm boundary in both directions, and keep the surrounding page under a strict Content Security Policy, which governs where Wasm can be instantiated from. Compile with the memory-safety mitigations your toolchain offers. WebAssembly is a neutral web-platform technology, so cside is not tied to it specifically; where a malicious or hidden Wasm payload arrives via a third-party script, cside's proxy and payload analysis can detect and block that script's behaviour.

Definition

Is WebAssembly safer than JavaScript?

It runs in the same browser sandbox with a memory model that limits what a module can reach, which is a solid baseline. But its binary format is harder to audit than JavaScript, so malicious logic can hide more easily, and memory bugs from the source language can persist. Safer in some respects, not universally.

Definition

Can WebAssembly access the DOM or make network requests directly?

No. A Wasm module has no direct DOM, filesystem, or network access. It reaches the outside world only through JavaScript and browser APIs it is explicitly given as imports. That boundary is a security strength, but the JavaScript glue around it must still validate what passes through.

Got more questions

Talk to a security expert

We answer client-side security questions every day. Bring yours.

Book a demo

Want to walk through this with an engineer?

Thirty minutes, on your own site. Not a slide deck.

We'll show you:

Which third-party scripts are running on your site right now
Where you stand on PCI DSS 6.4.3 and 11.6.1
How much of your traffic is bots and AI agents

Rather just send a question?

Finding open slots…

Real humans only. We'd know.

Having trouble booking? Open scheduler in a new tab

What are you trying to solve?

Tell us in a line and we'll come back with something useful, not a generic pitch.

We usually help with:

Seeing which third-party scripts run on your site
PCI DSS 6.4.3 and 11.6.1 evidence
Bots, AI agents and account takeover

Prefer to just book a time? Pick a slot instead