Skip to content

Instantly share code, notes, and snippets.

@moriczgergo moriczgergo/bsod.js
Created Nov 13, 2018

Embed
What would you like to do?
invoke BSOD via JS
var ref = require('ref');
var ffi = require('ffi'); // npm install https://github.com/node-ffi/node-ffi
var dword = ref.types.ulong;
var dwordPtr = ref.refType(dword);
var bool = ref.types.byte;
var boolPtr = ref.refType(bool);
var ntdll = new ffi.Library('ntdll', {
"RtlAdjustPrivilege": ["void", ["ulong", "ulong", "byte", boolPtr]],
"NtRaiseHardError": ["void", ["ulong", "ulong", "ulong", "ulong", "ulong", dwordPtr]]
});
var boolO = ref.alloc(boolPtr);
ntdll.RtlAdjustPrivilege(19, 1, 0, boolO);
var boolVal = boolO.deref();
console.log(boolVal);
var dwordO = ref.alloc(dwordPtr);
ntdll.NtRaiseHardError(0xc0000022, 0, 0, 0, 6, dwordO);
var dwordVal = dwordO.deref();
console.log(dwordVal);
console.log("If you still see this, it didn't work.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.