rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

Consider simplifying this complex logical expression.
Open

    return CheckCode::Safe("Detected Magento #{edition} edition version #{version} which is not vulnerable") unless
      version <= (Rex::Version.new('2.4.7')) ||
      version <= (Rex::Version.new('2.4.6-p5')) ||
      version <= (Rex::Version.new('2.4.5-p7')) ||
      version <= (Rex::Version.new('2.4.4-p8')) ||
Severity: Major
Found in modules/auxiliary/gather/magento_xxe_cve_2024_34102.rb - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

        if res && res.code == 200 && res.body &&
           res.body.to_s =~ /ManageEngine Password Manager Pro/ &&
           (
             res.body.to_s =~ /login\.css\?([0-9]+)/ ||                            # PMP v6
             res.body.to_s =~ /login\.css\?version=([0-9]+)/ ||                    # PMP v6
    Severity: Major
    Found in modules/auxiliary/admin/http/manageengine_pmp_privesc.rb - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

          if xmlResponse.include?('NET5501') || xmlResponse.include?('NET5501-I') || xmlResponse.include?('NET5501-XT') || xmlResponse.include?('NET5504') || xmlResponse.include?('NET5500') || xmlResponse.include?('NET5516') || xmlResponse.include?('NET5508')
            return Exploit::CheckCode::Appears
          end
      Severity: Major
      Found in modules/exploits/unix/http/schneider_electric_net55xx_encoder.rb - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

              if (version[0].to_i < 11) or
              (version[0].to_i == 11 and version[1].to_i <= 3) or
              (version[0].to_i == 11 and version[1].to_i == 3 and version[2].to_i == 0 and version[3].to_i < 999)
                ctx = { 'Msf' => framework, 'MsfExploit' => self }
                sock = Rex::Socket.create_tcp({ 'PeerHost' => rhost, 'PeerPort' => datastore['RPORT_REMOTING'], 'Context' => ctx })
        Severity: Major
        Found in modules/exploits/windows/http/trackit_file_upload.rb - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                    elsif (error[0].empty? or (error[0].unpack('C')[0] & 3) == 0) and # fd_nextsize
                          (error[1].empty? or (error[1].unpack('C')[0] & 3) == 0) and # fd
                          (error[2] =~ /\A503 [^s].?\z/mn) and ((error[2].unpack('C*')[4] & 7) == PREV_INUSE) and # size
                          (error[3] == "177") # the last \x7F of our BAD1 command, encoded as \\177 by string_printing()
                      leaked_arch = ARCH_X86
          Severity: Major
          Found in modules/exploits/linux/smtp/exim_gethostbyname_bof.rb - About 1 hr to fix

            Method initialize has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def initialize(year=0, month=0, day=0, hour=0, minute=0, second=0, neg=false, second_part=0)
            Severity: Major
            Found in lib/rbmysql.rb - About 1 hr to fix

              Method initialize has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      def initialize(host, port = 21, ssl = nil, ssl_version = nil, proxies = nil, username = '', password = '', verbose = false)
              Severity: Major
              Found in lib/rex/proto/ftp/client.rb - About 1 hr to fix

                Method initialize has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def initialize(host, port = 80, context = {}, ssl = nil, ssl_version = nil, proxies = nil, username = '', password = '', kerberos_authenticator: nil, comm: nil, subscriber: nil)
                Severity: Major
                Found in lib/rex/proto/http/client.rb - About 1 hr to fix

                  Method map_port has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def map_port(udp_sock, host, port, int_port, ext_port, protocol, lifetime, timeout=1)
                  Severity: Major
                  Found in lib/rex/proto/natpmp/packet.rb - About 1 hr to fix

                    Method trans_maxzero has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      def trans_maxzero(pipe, param = '', body = '', setup_count = 0, setup_data = '', no_response = false, do_recv = true, ignore_errors = false)
                    Severity: Major
                    Found in lib/rex/proto/smb/client.rb - About 1 hr to fix

                      Method list_path has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        def list_path(path, columns, sort, order, short, recursive = false, depth = 0, search_term = nil)
                      Severity: Major
                      Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb - About 1 hr to fix

                        Method initialize has 8 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          def initialize(recnum, timegen, timewri, id, type, cat, strs, data)

                          Method store_loot has 8 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            def store_loot(ltype, ctype, host, data, filename=nil, info=nil, service=nil, &block)
                          Severity: Major
                          Found in lib/msf/core/auxiliary/report.rb - About 1 hr to fix

                            Method handle_nessus has 8 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              def handle_nessus(wspace, hobj, port, nasl, plugin_name, severity, data,task=nil)
                            Severity: Major
                            Found in lib/msf/core/db_manager/import/nessus.rb - About 1 hr to fix

                              Function oracle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                              def oracle(target, pms, cke_2nd_prefix, cipher_handshake=ch_def, messageflow=False, timeout=5):
                                  try:
                                      s, cke_version = tls_connect(target, timeout)
                                      s.send(bytearray(b'\x16') + cke_version)
                                      s.send(cke_2nd_prefix)
                              Severity: Minor
                              Found in modules/auxiliary/scanner/ssl/bleichenbacher_oracle.py - About 55 mins 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

                              Function run_scanner has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                              def run_scanner(args, login_callback):
                                  userpass = args['userpass'] or []
                                  rhost = args['rhost']
                                  rport = int(args['rport'])
                                  sleep_interval = float(args['sleep_interval'] or 0)
                              Severity: Minor
                              Found in lib/msf/core/modules/external/python/metasploit/login_scanner.py - About 55 mins 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_nessus_plugin_details has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def cmd_nessus_plugin_details(*args)
                                      search_term = nil
                                      plugin_id = nil
                                      while (arg = args.shift)
                                        case arg
                              Severity: Minor
                              Found in plugins/nessus.rb - About 55 mins 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_openvas_connect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def cmd_openvas_connect(*args)
                                      # Is the database configured?
                                      if !database?
                                        print_error('No database has been configured.')
                                        return
                              Severity: Minor
                              Found in plugins/openvas.rb - About 55 mins 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_nessus_policy_del has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def cmd_nessus_policy_del(*args)
                                      if args[0] == '-h'
                                        print_status('nessus_policy_del <policy ID>')
                                        print_status('Example:> nessus_policy_del 1')
                                        print_status('You must be an admin to delete policies.')
                              Severity: Minor
                              Found in plugins/nessus.rb - About 55 mins 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 transform_params has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def transform_params(options)
                                      # If we've been given a specific IP to listen on, use that as our poisoning IP
                                      if options[:spoof_ip].nil? && Rex::Socket.is_ip_addr?(options[:srvhost]) && Rex::Socket.addr_atoi(options[:srvhost]) != 0
                                        options[:spoof_ip] = options[:srvhost]
                                      end
                              Severity: Minor
                              Found in plugins/capture.rb - About 55 mins 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

                              Severity
                              Category
                              Status
                              Source
                              Language