rapid7/metasploit-framework

View on GitHub
modules/exploits/osx/browser/safari_proxy_object_type_confusion.rb

Summary

Maintainability
F
3 days
Test Coverage

Method on_request_uri has 323 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def on_request_uri(cli, request)
    user_agent = request['User-Agent']
    print_status("Request from #{user_agent}")
    offsets = get_offsets(user_agent)
    unless offsets
Severity: Major
Found in modules/exploits/osx/browser/safari_proxy_object_type_confusion.rb - About 1 day to fix

    File safari_proxy_object_type_confusion.rb has 458 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Exploit::Remote
      Rank = ManualRanking
    
      include Msf::Post::File
      include Msf::Exploit::EXE
    Severity: Minor
    Found in modules/exploits/osx/browser/safari_proxy_object_type_confusion.rb - About 7 hrs to fix

      Method offset_table has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def offset_table
          {
            '10.12.6' => {
              jsc_vtab: '0x0000d8d8',
              dyld_stub_loader: '0x00001168',
      Severity: Minor
      Found in modules/exploits/osx/browser/safari_proxy_object_type_confusion.rb - About 1 hr to fix

        Method get_offsets has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          def get_offsets(user_agent)
            if user_agent =~ /Intel Mac OS X (.*?)\)/
              osx_version = $1.gsub("_", ".")
              if user_agent =~ /Version\/(.*?) /
                if Rex::Version.new($1) >= Rex::Version.new('11.1.1')
        Severity: Minor
        Found in modules/exploits/osx/browser/safari_proxy_object_type_confusion.rb - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method initialize has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def initialize(info = {})
            super(update_info(info,
              'Name'           => 'Safari Proxy Object Type Confusion',
              'Description'    => %q{
                  This module exploits a type confusion bug in the Javascript Proxy object in
        Severity: Minor
        Found in modules/exploits/osx/browser/safari_proxy_object_type_confusion.rb - About 1 hr to fix

          Method get_offsets has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def get_offsets(user_agent)
              if user_agent =~ /Intel Mac OS X (.*?)\)/
                osx_version = $1.gsub("_", ".")
                if user_agent =~ /Version\/(.*?) /
                  if Rex::Version.new($1) >= Rex::Version.new('11.1.1')
          Severity: Minor
          Found in modules/exploits/osx/browser/safari_proxy_object_type_confusion.rb - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status