Skip to content

Commit 2900f57

Browse files
committed
It looks like this works
1 parent e520ace commit 2900f57

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

lib/msf/core/exploit/remote/browser_exploit_server.rb

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,14 @@ class BESException < RuntimeError; end
6565
:mshtml_build, # mshtml build. Example: Returns "65535"
6666
:flash, # Example: Returns "12.0" (chrome/ff) or "12.0.0.77" (IE)
6767
:vuln_test, # Example: "if(window.MyComponentIsInstalled)return true;",
68-
:activex # Example: [{:clsid=>'String', :method=>'String'}]
68+
# :activex is a special case.
69+
# When you set this requirement in your module, this is how it should be:
70+
# [{:clsid=>'String', :method=>'String'}]
71+
# Where each Hash is a test case
72+
# But when BES receives this information, the JavaScript will return this format:
73+
# "{CLSID}=>Method=>Boolean;"
74+
# Also see: #has_bad_activex?
75+
:activex
6976
])
7077

7178
def initialize(info={})
@@ -188,8 +195,19 @@ def try_set_target(profile)
188195
end
189196

190197

198+
# Returns true if there's a bad ActiveX, otherwise false.
199+
# @param ax [String] The raw activex the JavaScript detection will return in this format:
200+
# "{CLSID}=>Method=>Boolean;"
201+
# @return [Boolean] True if there's a bad ActiveX, otherwise false
191202
def has_bad_activex?(ax)
192-
return true unless ax.split(';').empty?
203+
print_debug(ax)
204+
ax.split(';').each do |a|
205+
bool = a.split('=>')[2]
206+
if bool == 'false'
207+
return true
208+
end
209+
end
210+
193211
false
194212
end
195213

@@ -205,7 +223,7 @@ def get_bad_requirements(profile)
205223
vprint_debug("Comparing requirement: #{k}=#{expected} vs #{k}=#{profile[k.to_sym]}")
206224

207225
if k == :activex
208-
bad_reqs << k unless has_bad_activex?(profile[k.to_sym])
226+
bad_reqs << k if has_bad_activex?(profile[k.to_sym])
209227
elsif k == :vuln_test
210228
bad_reqs << k unless profile[k.to_sym].to_s == 'true'
211229
elsif v.is_a? Regexp
@@ -408,9 +426,11 @@ def get_detection_html(user_agent)
408426
method = a[:method]
409427
%>
410428
var ax = ie_addons_detect.hasActiveX('<%=clsid%>', '<%=method%>');
411-
d['activex'] = '';
412-
if (ax == false) {
413-
d['activex'] += "<%=clsid%>=<%=method%>;";
429+
d['activex'] = "";
430+
if (ax == true) {
431+
d['activex'] += "<%=clsid%>=><%=method%>=>true;";
432+
} else {
433+
d['activex'] += "<%=clsid%>=><%=method%>=>false;";
414434
}
415435
<% end %>
416436
<% end %>

0 commit comments

Comments
 (0)