diff --git a/core/main/client/browser.js b/core/main/client/browser.js index c32e0fd24..13ab2814b 100644 --- a/core/main/client/browser.js +++ b/core/main/client/browser.js @@ -988,6 +988,7 @@ return !!window.devicePixelRatio && !!window.history.replaceState && window.navi var has_googlegears=(beef.browser.hasGoogleGears())? "Yes":"No"; var has_web_socket=(beef.browser.hasWebSocket())? "Yes":"No"; var has_activex = (beef.browser.hasActiveX())? "Yes":"No"; + var has_silverlight = (beef.browser.hasSilverlight())? "Yes":"No"; var has_session_cookies = (beef.browser.cookie.hasSessionCookies("cookie"))? "Yes":"No"; var has_persistent_cookies = (beef.browser.cookie.hasPersistentCookies("cookie"))? "Yes":"No"; @@ -1016,6 +1017,7 @@ return !!window.devicePixelRatio && !!window.history.replaceState && window.navi if(has_web_socket) details['HasWebSocket'] = has_web_socket if(has_googlegears) details['HasGoogleGears'] = has_googlegears if(has_activex) details['HasActiveX'] = has_activex; + if(has_silverlight) details['HasSilverlight'] = has_silverlight; if(has_session_cookies) details["hasSessionCookies"] = has_session_cookies; if(has_persistent_cookies) details["hasPersistentCookies"] = has_persistent_cookies; @@ -1023,12 +1025,32 @@ return !!window.devicePixelRatio && !!window.history.replaceState && window.navi }, /** - * Returns boolean value depending on whether the browser support ActiveX + * Returns boolean value depending on whether the browser supports ActiveX */ hasActiveX: function() { return !!window.ActiveXObject; }, + /** + * Returns boolean value depending on whether the browser supports Silverlight + */ + hasSilverlight: function() { + var result = false; + + try { + if (beef.browser.isIE()) { + var slControl = new ActiveXObject('AgControl.AgControl'); + result = true; + } else if (navigator.plugins["Silverlight Plug-In"]) { + result = true; + } + } catch (e) { + result = false; + } + + return result; + }, + /** * Returns array of results, whether or not the target zombie has visited the specified URL */ diff --git a/core/main/handlers/browserdetails.rb b/core/main/handlers/browserdetails.rb index 3ac0b3409..743587b3a 100644 --- a/core/main/handlers/browserdetails.rb +++ b/core/main/handlers/browserdetails.rb @@ -255,6 +255,14 @@ module BeEF self.err_msg "Invalid value for HasActiveX returned from the hook browser's initial connection." end + # get and store the yes|no value for HasSilverlight + has_silverlight = get_param(@data['results'], 'HasSilverlight') + if BeEF::Filters.is_valid_yes_no?(has_silverlight) + BD.set(session_id, 'HasSilverlight', has_silverlight) + else + self.err_msg "Invalid value for Silverlight returned from the hook browser's initial connection." + end + # get and store the value for CPU cpu_type = get_param(@data['results'], 'CPU') if !cpu_type.nil? diff --git a/extensions/admin_ui/controllers/modules/modules.rb b/extensions/admin_ui/controllers/modules/modules.rb index 2a3daa27d..932128f62 100644 --- a/extensions/admin_ui/controllers/modules/modules.rb +++ b/extensions/admin_ui/controllers/modules/modules.rb @@ -405,6 +405,21 @@ class Modules < BeEF::Extension::AdminUI::HttpController 'from' => 'Initialization' } + summary_grid_hash['results'].push(page_name_row) # add the row + end + + # set and add the yes|no value for HasSilverlight + has_silverlight = BD.get(zombie_session, 'HasSilverlight') + if not has_silverlight.nil? + encoded_has_silverlight = CGI.escapeHTML(has_silverlight) + encoded_has_silverlight_hash = { 'Has Silverlight' => encoded_has_silverlight } + + page_name_row = { + 'category' => 'Browser', + 'data' => encoded_has_silverlight_hash, + 'from' => 'Initialization' + } + summary_grid_hash['results'].push(page_name_row) # add the row end diff --git a/extensions/console/lib/shellinterface.rb b/extensions/console/lib/shellinterface.rb index a84f7022a..7f2442ecd 100644 --- a/extensions/console/lib/shellinterface.rb +++ b/extensions/console/lib/shellinterface.rb @@ -617,6 +617,21 @@ class ShellInterface summary_grid_hash['results'].push(page_name_row) # add the row end + # set and add the yes|no value for HasSilverlight + has_silverlight = BD.get(zombie_session, 'HasSilverlight') + if not has_silverlight.nil? + encoded_has_silverlight = CGI.escapeHTML(has_silverlight) + encoded_has_silverlight_hash = { 'Has Silverlight' => encoded_has_silverlight } + + page_name_row = { + 'category' => 'Browser', + 'data' => encoded_has_silverlight_hash, + 'from' => 'Initialization' + } + + summary_grid_hash['results'].push(page_name_row) # add the row + end + # set and add the value for CPU cpu_type = BD.get(zombie_session, 'CPU') if not cpu_type.nil? diff --git a/modules/browser/detect_silverlight/command.js b/modules/browser/detect_silverlight/command.js new file mode 100644 index 000000000..a56d0c2bc --- /dev/null +++ b/modules/browser/detect_silverlight/command.js @@ -0,0 +1,14 @@ +// +// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net +// Browser Exploitation Framework (BeEF) - http://beefproject.com +// See the file 'doc/COPYING' for copying permission +// + +beef.execute(function() { + + var result = (beef.browser.hasSilverlight())? "Yes" : "No"; + + beef.net.send("<%= @command_url %>", <%= @command_id %>, "silverlight="+result); + +}); + diff --git a/modules/browser/detect_silverlight/config.yaml b/modules/browser/detect_silverlight/config.yaml new file mode 100644 index 000000000..93dbbbefc --- /dev/null +++ b/modules/browser/detect_silverlight/config.yaml @@ -0,0 +1,15 @@ +# +# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net +# Browser Exploitation Framework (BeEF) - http://beefproject.com +# See the file 'doc/COPYING' for copying permission +# +beef: + module: + detect_silverlight: + enable: true + category: "Browser" + name: "Detect Silverlight" + description: "This module will check if the browser has Silverlight support." + authors: ["bcoles"] + target: + working: ["ALL"] diff --git a/modules/browser/detect_silverlight/module.rb b/modules/browser/detect_silverlight/module.rb new file mode 100644 index 000000000..0565a18ed --- /dev/null +++ b/modules/browser/detect_silverlight/module.rb @@ -0,0 +1,14 @@ +# +# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net +# Browser Exploitation Framework (BeEF) - http://beefproject.com +# See the file 'doc/COPYING' for copying permission +# +class Detect_silverlight < BeEF::Core::Command + + def post_execute + content = {} + content['silverlight'] = @datastore['silverlight'] + save content + end + +end