Safeguard
Security Guides•

What does a WebAssembly plugin sandbox not protect you from?

WebAssembly isolates plugin code from the host but cannot stop misuse of capabilities you grant. See what the sandbox covers and what it leaves to you.

Safeguard Security Team
4 min read

A WebAssembly sandbox stops a plugin from reaching memory and system resources you did not give it. It does not stop the plugin from misusing what you did give it, from leaking data through allowed calls, or from burning resources. Those risks stay with your host API design.

What the sandbox gives you

The WebAssembly security documentation states two goals: protect users from buggy or malicious modules, and give developers primitives for safe applications. Each module runs in a sandboxed environment separated from the host runtime. Modules cannot escape the sandbox except through the APIs the host provides. They must declare accessible functions and types at load time, indirect calls are type checked, and the call stack is protected from buffer overflows in the module heap. Traps stop execution on invalid operations such as out of bounds memory access.

WASI, the system interface for Wasm, describes itself as a secure standard interface and says every project with a plugin model should consider it.

What it leaves open

The documentation itself marks limits. Data in linear memory can overwrite adjacent objects within the module, because bounds checking is at the memory region level. The control flow protections prevent direct code injection, but a module with a memory bug can still misbehave inside its own memory. Applications are also subject to the security policies of the embedding, so the host's policy decides the rest.

RiskCovered by the sandbox?Who handles it
Reading host memoryYesRuntime
Calling an API you exposedNoYou
Leaking data through an allowed network callNoYou
Using too much CPU or memoryDepends on host limitsYou
Bugs in your host functionsNoYou
Malicious logic using granted accessNoYou

Design the host side with care

  1. Expose the fewest functions. Each one is a capability. Name them in a manifest.
  2. Validate every argument. Treat module input like network input.
  3. Set limits. Cap memory, execution time and call counts per plugin so a loop cannot starve the host.
  4. Scope data access. Hand the plugin only the records for the current task, not a handle to everything.
  5. Control outbound calls. Allow only declared destinations, and log them.
  6. Test with hostile modules. Write a deliberately bad plugin and run it through your host.

Keep supply chain in view

The module itself is built from source and libraries. A plugin written in one language can bundle dozens of packages that compile into the module. The sandbox does not make a vulnerable library harmless within the plugin's own logic. Inventory what goes into each module and scan it as you would any other build.

Try it yourself

Click through it at your own pace, or open it full screen.

See how reachability separates a vulnerable library that is actually called from one that is not. The same question applies to what a plugin can reach through your host API.

Quick check

Is Wasm safer than running plugins natively?

For isolation from the host, generally yes, because modules reach out only through provided APIs. It does not remove risks that come from the capabilities you grant.

Do I still need a permission model with Wasm?

Yes. The sandbox draws the outer boundary. A permission model decides what is allowed inside it.

Safeguard offers reachability analysis and SBOM and dependency scanning for the libraries compiled into plugins. The free scan takes a manifest to try.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.