Skip to content

Instantly share code, notes, and snippets.

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

What would you like to do?
invoke BSOD via JS
var ref = require('ref');
var ffi = require('ffi'); // npm install
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();
var dwordO = ref.alloc(dwordPtr);
ntdll.NtRaiseHardError(0xc0000022, 0, 0, 0, 6, dwordO);
var dwordVal = dwordO.deref();
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.