Skip to content

Commit 21e44f2

Browse files
committed
Example of doing Flash detection with Flash
1 parent a12c84d commit 21e44f2

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ def initialize(info={})
9090
@info_receiver_page = rand_text_alpha(5)
9191
@exploit_receiver_page = rand_text_alpha(6)
9292
@noscript_receiver_page = rand_text_alpha(7)
93+
@flash_receiver_page = rand_text_alpha(8)
94+
@flash_swf = rand_text_alpha(9)
9395

9496
register_options(
9597
[
@@ -331,6 +333,11 @@ def process_browser_info(source, cli, request)
331333

332334
# Gathering target info from the detection stage
333335
case source
336+
when :flash
337+
# Flash version detection
338+
parsed_body = CGI::parse(Rex::Text.decode_base64(request.body) || '')
339+
version_info = 'FLASH VERSION HERE'
340+
update_profile(target_info, :flash, version_info)
334341
when :script
335342
# Gathers target data from a POST request
336343
parsed_body = CGI::parse(Rex::Text.decode_base64(request.body) || '')
@@ -411,6 +418,15 @@ def get_detection_html(user_agent)
411418
"vuln_test" : <%= js_vuln_test %>
412419
};
413420
421+
if (d["flash"]) {
422+
// Load SWF for accurate Flash detection
423+
// This SWF needs to send the Flash version info as a POST request to BES sort of like this:
424+
// <%=get_resource.chomp("/")%>/<%=@info_receiver_page%>/
425+
var flashObject = document.createElement("object");
426+
flashObject.setAttribute("data", "Flash location from the @flash_swf instance variable");
427+
document.body.appendChild(flashObject); // Do you actually need to do this?
428+
}
429+
414430
<% if os.match(OperatingSystems::Match::WINDOWS) and client == HttpClients::IE %>
415431
d['office'] = ie_addons_detect.getMsOfficeVersion();
416432
d['mshtml_build'] = ScriptEngineBuildVersion().toString();
@@ -468,6 +484,11 @@ def cookie_header(tag)
468484
cookie
469485
end
470486

487+
def load_swf_detection
488+
# Your SWF loads here
489+
''
490+
end
491+
471492

472493
# Handles exploit stages.
473494
#
@@ -492,6 +513,15 @@ def on_request_uri(cli, request)
492513
html = get_detection_html(ua)
493514
send_response(cli, html, {'Set-Cookie' => cookie_header(tag)})
494515

516+
when /#{@flash_swf}/
517+
swf = load_swf_detection
518+
send_response(cli, swf)
519+
520+
when /#{@flash_receiver_page}/
521+
vprint_status("Received information from Flash")
522+
process_browser_info(:flash, cli, request)
523+
send_not_found(cli)
524+
495525
when /#{@info_receiver_page}/
496526
#
497527
# The detection code will hit this if Javascript is enabled

0 commit comments

Comments
 (0)