rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

Identical blocks of code found in 6 locations. Consider refactoring.
Open

  def make_pdf(js)

    xref = []
    eol = "\x0d\x0a"
    endobj = "endobj" << eol
Severity: Major
Found in modules/exploits/windows/fileformat/adobe_utilprintf.rb and 5 other locations - About 7 hrs to fix
modules/exploits/windows/browser/adobe_geticon.rb on lines 166..202
modules/exploits/windows/browser/adobe_media_newplayer.rb on lines 181..218
modules/exploits/windows/browser/adobe_utilprintf.rb on lines 145..182
modules/exploits/windows/fileformat/adobe_collectemailinfo.rb on lines 139..176
modules/exploits/windows/fileformat/adobe_media_newplayer.rb on lines 184..220

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 229.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 6 locations. Consider refactoring.
Open

  def make_pdf(js)

    xref = []
    eol = "\x0d\x0a"
    endobj = "endobj" << eol
Severity: Major
Found in modules/exploits/windows/browser/adobe_geticon.rb and 5 other locations - About 7 hrs to fix
modules/exploits/windows/browser/adobe_media_newplayer.rb on lines 181..218
modules/exploits/windows/browser/adobe_utilprintf.rb on lines 145..182
modules/exploits/windows/fileformat/adobe_collectemailinfo.rb on lines 139..176
modules/exploits/windows/fileformat/adobe_media_newplayer.rb on lines 184..220
modules/exploits/windows/fileformat/adobe_utilprintf.rb on lines 136..173

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 229.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 6 locations. Consider refactoring.
Open

  def make_pdf(js)

    xref = []
    eol = "\x0d\x0a"
    endobj = "endobj" << eol
Severity: Major
Found in modules/exploits/windows/browser/adobe_utilprintf.rb and 5 other locations - About 7 hrs to fix
modules/exploits/windows/browser/adobe_geticon.rb on lines 166..202
modules/exploits/windows/browser/adobe_media_newplayer.rb on lines 181..218
modules/exploits/windows/fileformat/adobe_collectemailinfo.rb on lines 139..176
modules/exploits/windows/fileformat/adobe_media_newplayer.rb on lines 184..220
modules/exploits/windows/fileformat/adobe_utilprintf.rb on lines 136..173

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 229.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method exploit has 176 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def exploit
    vprint_status('Trying to login...')
    # Application Login
    res_auth = send_request_cgi(
      'method' => 'POST',
Severity: Major
Found in modules/exploits/multi/http/uptime_file_upload_2.rb - About 7 hrs to fix

    Method run has 176 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def run
        @peer = "#{session.session_host}:#{session.session_port}"
    
        @creds = []
        @ssh_keys = []
    Severity: Major
    Found in modules/post/linux/gather/enum_nagios_xi.rb - About 7 hrs to fix

      Method asm_bind_named_pipe has 176 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def asm_bind_named_pipe(opts={})
      
          reliable       = opts[:reliable]
          timeout        = opts[:timeout] * 1000 # convert to millisecs
          retry_wait     = 500
      Severity: Major
      Found in lib/msf/core/payload/windows/bind_named_pipe.rb - About 7 hrs to fix

        File sap_host_control_cmd_exec.rb has 459 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class MetasploitModule < Msf::Exploit::Remote
          Rank = AverageRanking
        
          include Msf::Exploit::Remote::HttpClient
          include Msf::Exploit::Remote::HttpServer::HTML
        Severity: Minor
        Found in modules/exploits/windows/http/sap_host_control_cmd_exec.rb - About 7 hrs to fix

          Method to_executable_fmt has 175 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.to_executable_fmt(framework, arch, plat, code, fmt, exeopts)
              # For backwards compatibility with the way this gets called when
              # generating from Msf::Simple::Payload.generate_simple
              if arch.kind_of? Array
                output = nil
          Severity: Major
          Found in lib/msf/util/exe.rb - About 7 hrs 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

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

              require 'openssl'
              
              class MetasploitModule < Msf::Exploit::Remote
                Rank = ExcellentRanking
              
              
              Severity: Minor
              Found in modules/exploits/multi/misc/ibm_tm1_unauth_rce.rb - About 7 hrs to fix

                File rsh_stack_clash_priv_esc.rb has 457 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                class MetasploitModule < Msf::Exploit::Local
                  Rank = GoodRanking
                
                  include Msf::Post::File
                  include Msf::Post::Solaris::Priv
                Severity: Minor
                Found in modules/exploits/solaris/local/rsh_stack_clash_priv_esc.rb - About 7 hrs to fix

                  Method run has 173 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def run
                      # If we have a session make use of it
                      if session
                        print_status("Using existing session #{session.sid}")
                        self.mysql_conn = session.client
                  Severity: Major
                  Found in modules/auxiliary/admin/mysql/mysql_enum.rb - About 6 hrs to fix

                    Method try_user_pass has 173 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def try_user_pass(opts)
                        user = opts[:user]
                        pass = opts[:pass]
                        auth_path = opts[:auth_path]
                        inbox_path = opts[:inbox_path]
                    Severity: Major
                    Found in modules/auxiliary/scanner/http/owa_login.rb - About 6 hrs to fix

                      Method on_client_data has 173 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def on_client_data(c)
                          # get the client data
                          data = c.get_once
                          return if not data
                          # split data into command and arguments
                      Severity: Major
                      Found in modules/auxiliary/fuzzers/ftp/client_ftp.rb - About 6 hrs to fix

                        Method exploit has 173 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def exploit
                            @uri = normalize_uri(target_uri.path)
                            @uri << '/' if @uri[-1, 1] != '/'
                        
                            # Create user with empty credentials
                        Severity: Major
                        Found in modules/exploits/multi/http/hp_sitescope_uploadfileshandler.rb - About 6 hrs to fix

                          Method icmp_listener has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def icmp_listener
                              # start icmp listener
                          
                              print_status("ICMP Listener started on #{@interface} (#{@iface_ip}). Monitoring for trigger packet containing #{datastore['START_TRIGGER']}")
                              if datastore['FNAME_IN_PACKET']
                          Severity: Minor
                          Found in modules/auxiliary/server/icmp_exfil.rb - About 6 hrs 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 exploit has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def exploit
                              # Keep track of results (successful connections)
                              results = []
                          
                              # Random string for password
                          Severity: Minor
                          Found in modules/exploits/unix/misc/polycom_hdx_auth_bypass.rb - About 6 hrs 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 extract_vault_and_iterations has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def extract_vault_and_iterations(account_map)
                              account_map.each_pair do |account, browser_map|
                                browser_map.each_pair do |browser, lp_data|
                                  lp_data['lp_creds'].each_pair do |username, _user_data|
                                    if browser.match(/Firefox|IE/)
                          Severity: Minor
                          Found in modules/post/multi/gather/lastpass_creds.rb - About 6 hrs 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 enum_vm_cust_spec has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def enum_vm_cust_spec
                              vpx_customization_specs = get_vpx_customization_spec(shell_vcdb_pass, vcdb_user, vcdb_name)
                          
                              if vpx_customization_specs.nil?
                                print_warning('No vpx_customization_spec entries evident')
                          Severity: Minor
                          Found in modules/post/linux/gather/vcenter_secrets_dump.rb - About 6 hrs 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

                          File browser_autopwn2.rb has 453 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          require 'date'
                          
                          module Msf
                            module Exploit::Remote::BrowserAutopwn2
                          
                          
                          Severity: Minor
                          Found in lib/msf/core/exploit/remote/browser_autopwn2.rb - About 6 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language