rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

Method execute has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def Process.execute(path, arguments = nil, opts = nil)
    request = Packet.create_request(COMMAND_ID_STDAPI_SYS_PROCESS_EXECUTE)
    flags   = 0

    # If we were supplied optional arguments...
Severity: Major
Found in lib/rex/post/meterpreter/extensions/stdapi/sys/process.rb - About 2 hrs to fix

    Method transform has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.transform(buf, fmt = "ruby", var_name = 'buf', encryption_opts={})
        default_wrap = 60
    
        unless encryption_opts.empty?
          buf = encrypt_buffer(buf, encryption_opts)
    Severity: Major
    Found in lib/msf/base/simple/buffer.rb - About 2 hrs to fix

      Method start_handler has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def start_handler
          queue = ::Queue.new
      
          local_port = bind_port
      
      
      Severity: Major
      Found in lib/msf/core/handler/reverse_udp.rb - About 2 hrs to fix

        Method send_message has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def send_message(data)
            mailfrom = datastore['MAILFROM'].strip
            if bad_address(mailfrom)
              print_error "Bad from address, not sending: #{mailfrom}"
              return nil
        Severity: Major
        Found in lib/msf/core/exploit/remote/smtp_deliver.rb - About 2 hrs to fix

          Method generate_addon_xpi has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def generate_addon_xpi(cli)
              zip = Rex::Zip::Archive.new
              xpi_guid = Rex::Text.rand_guid
              p = regenerate_payload(cli).encoded
              bootstrap_script = 'function startup(data, reason) {'
          Severity: Major
          Found in lib/msf/core/exploit/remote/firefox_addon_generator.rb - About 2 hrs to fix

            Method parse has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def parse(pkt)
                # We want to return immediatly if we do not have a packet which is handled by us
                return unless pkt.is_tcp?
                return if (pkt.tcp_sport != 21 and pkt.tcp_dport != 21)
                s = find_session((pkt.tcp_sport == 21) ? get_session_src(pkt) : get_session_dst(pkt))
            Severity: Major
            Found in data/exploits/psnuffle/ftp.rb - About 2 hrs to fix

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

                def login(user, pass)
                  vprint_status "Authenticating as user '#{user}'"
              
                  vars_post = {
                    username: user,
              Severity: Major
              Found in modules/exploits/unix/webapp/fusionpbx_exec_cmd_exec.rb and 1 other location - About 2 hrs to fix
              modules/exploits/unix/webapp/fusionpbx_operator_panel_exec_cmd_exec.rb on lines 71..106

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

              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

                  vprint_status "Authenticating as user '#{user}'"
              
                  vars_post = {
                    username: user,
                    password: pass,
              modules/exploits/unix/webapp/fusionpbx_exec_cmd_exec.rb on lines 66..101

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

              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 trigger_urlclassloader
                  # Here we construct a XSLT transform to load a Java payload via URLClassLoader.
                  url = get_uri
              
                  vars = Rex::RandomIdentifier::Generator.new({ language: :java })
              modules/exploits/windows/http/manageengine_endpoint_central_saml_rce_cve_2022_47966.rb on lines 145..178

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

              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 trigger_urlclassloader
                  # Here we construct a XSLT transform to load a Java payload via URLClassLoader.
                  url = get_uri
              
                  vars = Rex::RandomIdentifier::Generator.new({ language: :java })
              modules/exploits/multi/http/manageengine_servicedesk_plus_saml_rce_cve_2022_47966.rb on lines 165..198

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

              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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                  begin
                    res = send_request_raw({
                      'uri'      => normalize_uri(datastore['URI']),
                      'method'   => 'POST',
                      'data'     => data,
              Severity: Major
              Found in modules/auxiliary/scanner/sap/sap_mgmt_con_listlogfiles.rb and 2 other locations - About 2 hrs to fix
              modules/auxiliary/scanner/sap/sap_mgmt_con_getaccesspoints.rb on lines 71..106
              modules/auxiliary/scanner/sap/sap_mgmt_con_getenv.rb on lines 71..107

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

              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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                  begin
                    res = send_request_raw({
                      'uri'      => normalize_uri(datastore['URI']),
                      'method'   => 'POST',
                      'data'     => data,
              Severity: Major
              Found in modules/auxiliary/scanner/sap/sap_mgmt_con_getenv.rb and 2 other locations - About 2 hrs to fix
              modules/auxiliary/scanner/sap/sap_mgmt_con_getaccesspoints.rb on lines 71..106
              modules/auxiliary/scanner/sap/sap_mgmt_con_listlogfiles.rb on lines 78..113

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

              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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                  begin
                    res = send_request_raw({
                      'uri'      => normalize_uri(datastore['URI']),
                      'method'   => 'POST',
                      'data'     => data,
              modules/auxiliary/scanner/sap/sap_mgmt_con_getenv.rb on lines 71..107
              modules/auxiliary/scanner/sap/sap_mgmt_con_listlogfiles.rb on lines 78..113

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

              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

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

                def stager_jsp_with_payload(app_base, encoded_payload)
                  decoded_var = Rex::Text.rand_text_alpha(8+rand(8))
                  file_path_var = Rex::Text.rand_text_alpha(8+rand(8))
                  jboss_home_var = Rex::Text.rand_text_alpha(8+rand(8))
                  fos_var = Rex::Text.rand_text_alpha(8+rand(8))
              lib/msf/core/exploit/remote/http/jboss/bean_shell_scripts.rb on lines 27..55

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

              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

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

                def stager_jsp(app_base)
                  decoded_var = Rex::Text.rand_text_alpha(8+rand(8))
                  file_path_var = Rex::Text.rand_text_alpha(8+rand(8))
                  jboss_home_var = Rex::Text.rand_text_alpha(8+rand(8))
                  fos_var = Rex::Text.rand_text_alpha(8+rand(8))
              Severity: Major
              Found in lib/msf/core/exploit/remote/http/jboss/bean_shell_scripts.rb and 1 other location - About 2 hrs to fix
              lib/msf/core/exploit/remote/http/jboss/deployment_file_repository_scripts.rb on lines 45..71

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

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

              def abuse(session,targets,commands,username,password,delay)
                #for each target
                targets.each do |t|
                  next if t.strip.length < 1
                  next if t[0,1] == "#"
              Severity: Major
              Found in scripts/meterpreter/schtasksabuse.rb - About 2 hrs to fix

                Method fingerprint has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def fingerprint(response)
                
                    if(response.headers.has_key?('Server') )
                      if(response.headers['Server'] =~ /IIS/ or response.headers['Server'] =~ /\(Windows/)
                        os = "Windows (#{response.headers['Server']})"
                Severity: Major
                Found in modules/auxiliary/gather/coldfusion_pwd_props.rb - About 2 hrs to fix

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

                    def run
                      filename = ""
                  
                      url = '/CFIDE/administrator/index.cfm'
                      # print_status("Getting index...")
                  Severity: Major
                  Found in modules/auxiliary/gather/coldfusion_pwd_props.rb - About 2 hrs to fix

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

                      def run
                        proto    = datastore['PROTOCOL']
                        domain   = datastore['DOMAIN']
                        map_name = nick_to_map(datastore['MAP'])
                    
                    
                    Severity: Major
                    Found in modules/auxiliary/gather/nis_ypserv_map.rb - About 2 hrs to fix

                      Method calculate_race has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def calculate_race(server, domain, num=50)
                      
                          q_beg_t = nil
                          q_end_t = nil
                          cnt     = 0
                      Severity: Major
                      Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language