rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

Class Resolver has 48 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Resolver

      class NextNameserver < RuntimeError
      end

Severity: Minor
Found in lib/net/dns/resolver.rb - About 6 hrs to fix

    File ibm_was_dmgr_java_deserialization_rce.rb has 444 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Exploit::Remote
      Rank = ExcellentRanking
      include Msf::Exploit::Remote::Tcp
      include Msf::Exploit::Powershell
      include Msf::Exploit::EXE
    Severity: Minor
    Found in modules/exploits/windows/ibm/ibm_was_dmgr_java_deserialization_rce.rb - About 6 hrs to fix

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

        def build_dgc_clean_args(jar_url)
          arguments = []
      
          new_array_annotation = Rex::Java::Serialization::Model::Annotation.new
          new_array_annotation.contents = [
      Severity: Major
      Found in modules/exploits/multi/misc/java_rmi_server.rb and 1 other location - About 6 hrs to fix
      modules/auxiliary/scanner/misc/java_rmi_server.rb on lines 125..183

      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 217.

      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 2 locations. Consider refactoring.
      Open

        def build_dgc_clean_args(jar_url)
          arguments = []
      
          new_array_annotation = Rex::Java::Serialization::Model::Annotation.new
          new_array_annotation.contents = [
      Severity: Major
      Found in modules/auxiliary/scanner/misc/java_rmi_server.rb and 1 other location - About 6 hrs to fix
      modules/exploits/multi/misc/java_rmi_server.rb on lines 226..279

      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 217.

      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 vuln_version? has 166 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def vuln_version?(res)
          # checks the model, firmware and hardware version
          @d_link = { 'product' => nil, 'firmware' => nil, 'hardware' => nil, 'arch' => nil }
          html = Nokogiri.HTML(res.body, nil, 'UTF-8')
      
      
      Severity: Major
      Found in modules/exploits/linux/upnp/dlink_upnp_msearch_exec.rb - About 6 hrs to fix

        File gitlab_file_read_rce.rb has 443 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class MetasploitModule < Msf::Exploit::Remote
          Rank = ExcellentRanking
        
          include Msf::Exploit::Remote::HttpClient
          prepend Msf::Exploit::Remote::AutoCheck
        Severity: Minor
        Found in modules/exploits/multi/http/gitlab_file_read_rce.rb - About 6 hrs to fix

          Method mssql_parse_tds_row has 165 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def mssql_parse_tds_row(data, info)
              info[:rows] ||= []
              row = []
          
              info[:colinfos].each do |col|
          Severity: Major
          Found in lib/rex/proto/mssql/client_mixin.rb - About 6 hrs to fix

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

              def initialize(info = {})
                super(update_info(info,
                  'Name'          => 'Windows Inject DLL',
                  'Description'   => 'Inject a custom DLL into the exploited process',
                  'Author'        =>
            Severity: Major
            Found in lib/msf/core/payload/windows/dll_inject.rb - About 6 hrs to fix

              Method cmd_alias has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
              Open

                    def cmd_alias(*args)
                      # we parse args manually instead of using @@alias.opts.parse to handle special cases
                      case args.length
                      when 0 # print the list of current aliases
                        if @aliases.empty?
              Severity: Minor
              Found in plugins/alias.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 process_phase has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
              Open

                def process_phase(phase_num, phase_name, prepend = '', initial_cmds = [])
                  print_status("[Phase #{phase_num}] #{phase_name} - #{Time.now.localtime}")
                  ecount = 1
                  @evilchars.each do |evilstr|
              
              
              Severity: Minor
              Found in modules/auxiliary/fuzzers/ftp/ftp_pre_post.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 check has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
              Open

                def check
                  #We need a cookie first
                  cookie_res = send_request_cgi({
                    #/cbs/system/ShowDownload.do
                    'uri' => normalize_uri(target_uri.path, 'cbs','system','ShowDownload.do'),
              Severity: Minor
              Found in modules/exploits/windows/misc/ahsay_backup_fileupload.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 brute_force_ids has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
              Open

                def brute_force_ids
                  # perform a sanity check first
                  if @host_id
                    host_ids = [@host_id]
                  else
              Severity: Minor
              Found in modules/exploits/linux/http/cacti_unauthenticated_cmd_injection.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_credentials has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
              Open

                def extract_credentials(account_map)
                  account_map.each_pair do |account, browser_map|
                    browser_map.each_pair do |browser, lp_data|
                      account_map[account][browser]['lp_creds'] = {}
                      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 extract_useraccounts has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.extract_useraccounts(user_accounts)
                  return[] if user_accounts.nil?
              
                  results = []
                  account_types = ['AdministratorPassword', 'DomainAccounts', 'LocalAccounts']
              Severity: Minor
              Found in lib/rex/parser/unattend.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 cmd_analyze has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
              Open

                def cmd_analyze(*args)
                  unless active?
                    print_error "Not currently connected to a data service for analysis."
                    return []
                  end
              Severity: Minor
              Found in lib/msf/ui/console/command_dispatcher/db/analyze.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 cmd_exploit has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
              Open

                def cmd_exploit(*args, opts: {})
                  if (args.include?('-r') || args.include?('--reload-libs')) && !opts[:previously_reloaded]
                    driver.run_single('reload_lib -a')
                  end
              
              
              Severity: Minor
              Found in lib/msf/ui/console/command_dispatcher/exploit.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 on_request has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
              Open

                def on_request(cli, req)
                  Thread.current[:cli] = cli
                  resp = Rex::Proto::Http::Response.new
                  info = process_uri_resource(req.relative_resource)
                  uuid = info[:uuid]
              Severity: Minor
              Found in lib/msf/core/handler/reverse_http.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 normalize_entry has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
              Open

                    def normalize_entry(entry, attribute_properties)
                      # Convert to a hash so we get the raw data we need from within the Net::LDAP::Entry object
                      entry = entry.to_h
                      normalized_entry = { dn: entry[:dn] }
                      entry.each_key do |attribute_name|
              Severity: Minor
              Found in lib/msf/core/exploit/remote/ldap/queries.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 php_imap_open_rce.rb has 440 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class MetasploitModule < Msf::Exploit::Remote
                Rank = GoodRanking
              
                include Msf::Exploit::Remote::HttpClient
              
              
              Severity: Minor
              Found in modules/exploits/linux/http/php_imap_open_rce.rb - About 6 hrs to fix

                Method cmd_notes has 164 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def cmd_notes(*args)
                    return unless active?
                  ::ApplicationRecord.connection_pool.with_connection {
                    mode = :search
                    data = nil
                Severity: Major
                Found in lib/msf/ui/console/command_dispatcher/db.rb - About 6 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language