Skip to content

Commit 577bd7c

Browse files
committed
Land rapid7#3146, @wchen-r7's flash version detection code
2 parents e9c7866 + a173fcf commit 577bd7c

File tree

3 files changed

+72
-19
lines changed

3 files changed

+72
-19
lines changed

data/js/detect/misc_addons.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,53 @@ window.misc_addons_detect.hasSilverlight = function () {
4646
return found;
4747
}
4848

49+
/**
50+
* Returns the Adobe Flash version
51+
**/
52+
window.misc_addons_detect.getFlashVersion = function () {
53+
var foundVersion = null;
54+
55+
//
56+
// Gets the Flash version by using the GetVariable function via ActiveX
57+
//
58+
try {
59+
var ax = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').toString();
60+
foundVersion = ax.match(/[\d,]+/g)[0].replace(/,/g, '.')
61+
} catch (e) {}
62+
63+
//
64+
// This should work fine for most non-IE browsers
65+
//
66+
if (foundVersion == null) {
67+
var mimes = window.navigator.mimeTypes;
68+
for (var i=0; i<mimes.length; i++) {
69+
var pluginDesc = mimes[i].enabledPlugin.description.toString();
70+
var m = pluginDesc.match(/Shockwave Flash [\d\.]+/g);
71+
if (m != null) {
72+
foundVersion = m[0].match(/\d.+/g)[0];
73+
break;
74+
}
75+
}
76+
}
77+
78+
//
79+
// Detection for Windows + Firefox
80+
//
81+
if (foundVersion == null) {
82+
var pluginsCount = navigator.plugins.length;
83+
for (i=0; i < pluginsCount; i++) {
84+
var pluginName = navigator.plugins[i].name;
85+
var pluginVersion = navigator.plugins[i].version;
86+
if (/Shockwave Flash/.test(pluginName) && pluginVersion != undefined) {
87+
foundVersion = navigator.plugins[i].version;
88+
break;
89+
}
90+
}
91+
}
92+
93+
return foundVersion;
94+
}
95+
4996
/**
5097
* Returns the Java version
5198
**/

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

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,21 @@ module Exploit::Remote::BrowserExploitServer
4242

4343
# Requirements a browser module can define in either BrowserRequirements or in targets
4444
REQUIREMENT_KEY_SET = {
45-
:source => 'source', # Either 'script' or 'headers'
46-
:ua_name => 'ua_name', # Example: MSIE
47-
:ua_ver => 'ua_ver', # Example: 8.0, 9.0
48-
:os_name => 'os_name', # Example: Microsoft Windows
49-
:os_flavor => 'os_flavor', # Example: XP, 7
50-
:language => 'language', # Example: en-us
51-
:arch => 'arch', # Example: x86
52-
:proxy => 'proxy', # 'true' or 'false'
53-
:silverlight => 'silverlight', # 'true' or 'false'
54-
:office => 'office', # Example: "2007", "2010"
55-
:java => 'java', # Example: 1.6, 1.6.0.0
56-
:clsid => 'clsid', # ActiveX clsid. Also requires the :method key
57-
:method => 'method', # ActiveX method. Also requires the :clsid key
58-
:mshtml_build => 'mshtml_build' # mshtml build. Example: "65535"
45+
:source => 'source', # Either 'script' or 'headers'
46+
:ua_name => 'ua_name', # Example: MSIE
47+
:ua_ver => 'ua_ver', # Example: 8.0, 9.0
48+
:os_name => 'os_name', # Example: Microsoft Windows
49+
:os_flavor => 'os_flavor', # Example: XP, 7
50+
:language => 'language', # Example: en-us
51+
:arch => 'arch', # Example: x86
52+
:proxy => 'proxy', # 'true' or 'false'
53+
:silverlight => 'silverlight', # 'true' or 'false'
54+
:office => 'office', # Example: "2007", "2010"
55+
:java => 'java', # Example: 1.6, 1.6.0.0
56+
:clsid => 'clsid', # ActiveX clsid. Also requires the :method key
57+
:method => 'method', # ActiveX method. Also requires the :clsid key
58+
:mshtml_build => 'mshtml_build', # mshtml build. Example: "65535"
59+
:flash => 'flash' # Example: "12.0" (chrome/ff) or "12.0.0.77" (IE)
5960
}
6061

6162
def initialize(info={})
@@ -222,9 +223,12 @@ def get_bad_requirements(profile)
222223
# For more info about what the actual value might be for each key, see HttpServer.
223224
#
224225
# If the source is 'script', the profile might have even more information about plugins:
225-
# 'office' : The version of Microsoft Office (IE only)
226-
# 'activex' : Whether a specific method is available from an ActiveX control (IE only)
227-
# 'java' : The Java version
226+
# 'office' : The version of Microsoft Office (IE only)
227+
# 'activex' : Whether a specific method is available from an ActiveX control (IE only)
228+
# 'java' : The Java version
229+
# 'mshtml_build' : The MSHTML build version
230+
# 'flash' : The Flash version
231+
# 'silverlight' : The Silverlight version
228232
#
229233
# @param tag [String] Either a cookie or IP + User-Agent
230234
# @return [Hash] The profile found. If not found, returns nil
@@ -375,7 +379,8 @@ def get_detection_html(user_agent)
375379
"<%=REQUIREMENT_KEY_SET[:ua_ver]%>" : osInfo.ua_version,
376380
"<%=REQUIREMENT_KEY_SET[:arch]%>" : osInfo.arch,
377381
"<%=REQUIREMENT_KEY_SET[:java]%>" : window.misc_addons_detect.getJavaVersion(),
378-
"<%=REQUIREMENT_KEY_SET[:silverlight]%>" : window.misc_addons_detect.hasSilverlight()
382+
"<%=REQUIREMENT_KEY_SET[:silverlight]%>" : window.misc_addons_detect.hasSilverlight(),
383+
"<%=REQUIREMENT_KEY_SET[:flash]%>" : window.misc_addons_detect.getFlashVersion()
379384
};
380385
381386
<% if os == OperatingSystems::WINDOWS and client == HttpClients::IE %>

modules/exploits/multi/browser/firefox_svg_plugin.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def initialize(info = {})
7575
'BrowserRequirements' => {
7676
:source => 'script',
7777
:ua_name => HttpClients::FF,
78-
:ua_ver => /17\..*/
78+
:ua_ver => /17\..*/,
79+
:flash => /[\d.]+/
7980
}
8081
))
8182

0 commit comments

Comments
 (0)