|
20 | 20 | module Msf
|
21 | 21 | module Exploit::Remote::BrowserExploitServer
|
22 | 22 |
|
| 23 | + class BESException < RuntimeError; end |
| 24 | + |
23 | 25 | include Msf::Exploit::Remote::HttpServer::HTML
|
24 | 26 | include Msf::Exploit::RopDb
|
25 | 27 | include Msf::Exploit::JSObfu
|
@@ -521,7 +523,13 @@ def on_request_uri(cli, request)
|
521 | 523 | try_set_target(profile)
|
522 | 524 | bad_reqs = get_bad_requirements(profile)
|
523 | 525 | if bad_reqs.empty?
|
524 |
| - method(:on_request_exploit).call(cli, request, profile) |
| 526 | + begin |
| 527 | + method(:on_request_exploit).call(cli, request, profile) |
| 528 | + rescue BESException => e |
| 529 | + elog("BESException: #{e.message}\n#{e.backtrace * "\n"}") |
| 530 | + send_not_found(cli) |
| 531 | + print_error("BESException: #{e.message}") |
| 532 | + end |
525 | 533 | else
|
526 | 534 | print_warning("Exploit requirement(s) not met: #{bad_reqs * ', '}. For more info: http://r-7.co/PVbcgx")
|
527 | 535 | if bad_reqs.include?(:vuln_test)
|
@@ -586,7 +594,15 @@ def get_payload(cli, browser_info)
|
586 | 594 | platform = platform.gsub(/^Mac OS X$/, 'OSX')
|
587 | 595 | platform = platform.gsub(/^Windows.*$/, 'Windows')
|
588 | 596 |
|
589 |
| - regenerate_payload(cli, platform, arch).encoded |
| 597 | + p = regenerate_payload(cli, platform, arch) |
| 598 | + |
| 599 | + unless p.arch.include?(arch) |
| 600 | + err = "The payload arch (#{p.arch * ", "}) is incompatible with the #{arch} target. " |
| 601 | + err << "Please check your payload setting." |
| 602 | + raise BESException, err |
| 603 | + end |
| 604 | + |
| 605 | + return p.encoded |
590 | 606 | end
|
591 | 607 |
|
592 | 608 | # @return [String] custom Javascript to check if a vulnerability is present
|
|
0 commit comments