| ▲ | pizlonator 18 hours ago | |||||||||||||||||||||||||
Wasm is just sandboxing. Say your C program has sensitive information in module A and a memory safety bug in module B. Running that program in wasm won’t prevent the attacker from using the bug in B to get read/write access to the data in A. In practice what the attacker will really do is use the memory safety bug to achieve weird execution: even without control over the program counter, the fact that a memory safety bug inside the wasm memory gives read write access to all of that memory means the attacker can make the program do whatever they want, subject to the wasm sandbox limits (ie whatever the host allows the wasm guest to do). Basically wasm amounts to a lightweight and portable replacement for running native code in a sufficiently sandboxed process | ||||||||||||||||||||||||||
| ▲ | azakai 17 hours ago | parent [-] | |||||||||||||||||||||||||
Your general point stands - wasm's original goal was mainly sandboxing - but 1. Wasm does provide some amount of memory safety even to compiled C code. For example, the call stack is entirely protected. Also, indirect calls are type-checked, etc. 2. Wasm can provide memory safety if you compile to WasmGC. But, you can't really compile C to that, of course... | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||