stevespringett / disable-webassembly

Browser hacks to disable WebAssembly (WASM)
110 stars 7 forks source link

+ #8

Closed ghost closed 1 year ago

ghost commented 1 year ago

nice work,
here is more.

ff: javascript.options.asmjs false javascript.options.wasm false javascript.options.wasm_baselinejit false javascript.options.wasm_ionjit false


all browsers:

["WebAssembly", "webAssembly", "mozWebAssembly", "webkitWebAssembly"]
.forEach((item) => {

//its elderly __proto__ reference would be nullified
try{
Object.keys(self[item]["__proto__"]).forEach((key) => { self[item]["__proto__"][key] = undefined; });
}catch(err){}

//its prototype reference would be nullified
try{
Object.keys(self[item]["prototype"]).forEach((key) => { self[item]["prototype"][key] = undefined; });
}catch(err){}

//reference would result with an answer - undefined.
try{
Object.defineProperty(self, item
 ,{enumerable   : true
  ,configurable : true
  ,set(){}
  ,get(){return undefined;}
  }
);
}catch(err){}

delete self[item];
});

feel free to use or distribute
(part of API-Killer-WebAssembly)

note: the javascript can be blocked if the website has serves CSP content security policy that blocks javascript.


all browsers:

you can write a web extension that modify the existing (or add) the CSP headers,
with 'wasm-eval' none; with declarativeNetRequest and a pretty simple ruleset json file.
it will work regardless the website or javascript support.


all browsers:

"good old" uBlock network blocking rules:

*.wasm$important
/asm/*$important,script
/wasm/*$important,script

not 100% sure way,
but the combination of all those would help.