rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

Method check has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def check
    # We fingerprint devices using SHA1 hash of a web resource accessible to unauthenticated users.
    # We use lang_pack/EN.js because it's the one file that changes the most between versions.
    # Note that it's not a smoking gun given that some branches keep the exact same files in /www
    # (see RV110 branch 1.2.1.x/1.2.2.x, RV130 > 1.0.3.22, RV215 1.2.0.x/1.3.x)
Severity: Major
Found in modules/exploits/linux/http/cve_2019_1663_cisco_rmi_rce.rb - About 2 hrs to fix

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

      def initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'VMware Workspace ONE Access VMSA-2022-0011 exploit chain',

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

        def initialize(info = {})
          super(
            update_info(
              info,
              'Name' => 'VMware Workspace ONE Access CVE-2022-22954',

        Method do_decrypt has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def do_decrypt
            unless datastore['DISCLAIMER']
              decrypt_disclaimer
              return
            end
        Severity: Major
        Found in modules/post/multi/gather/firefox_creds.rb - About 2 hrs to fix

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

            def run
              unless is_rf?
                print_error('Not an RF Transceiver')
                return
              end
          Severity: Major
          Found in modules/post/hardware/rftransceiver/rfpwnon.rb - About 2 hrs to fix

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

              def run
                get_vcsa_version
            
                if check_cve_2022_22948
                  print_good('Vulnerable to CVE-2022-22948')
            Severity: Major
            Found in modules/post/linux/gather/vcenter_secrets_dump.rb - About 2 hrs to fix

              Method from_sddl_text has 69 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def self.from_sddl_text(sddl_text, domain_sid:)
                    sacl_set = dacl_set = false
                    sd = self.new
                    sddl_text = sddl_text.dup.gsub(/\s/, '')  # start by removing all whitespace
                    sddl_text.scan(/([OGDS]:(?:.(?!:))*)/).each do |part,|
              Severity: Major
              Found in lib/rex/proto/ms_dtyp.rb - About 2 hrs to fix

                Method cmd_run has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def cmd_run(*args, action: nil, opts: {})
                    if (args.include?('-r') || args.include?('--reload-libs')) && !opts[:previously_reloaded]
                      driver.run_single('reload_lib -a')
                    end
                
                
                Severity: Major
                Found in lib/msf/ui/console/command_dispatcher/auxiliary.rb - About 2 hrs to fix

                  Method parse_options has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def self.parse_options(mod)
                      action = 'run'
                      actions = ['run'] + mod.meta['capabilities']
                      args = mod.meta['options'].reduce({}) do |defaults, (n, opt)|
                        if opt['default'].nil?
                  Severity: Major
                  Found in lib/msf/core/modules/external/cli.rb - About 2 hrs to fix

                    Method connect has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def connect(opts={})
                        dossl = false
                        if(opts.has_key?('SSL'))
                          dossl = opts['SSL']
                        else
                    Severity: Major
                    Found in lib/msf/core/exploit/remote/http_client.rb - About 2 hrs to fix

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

                        def on_client_data(c)
                          data = c.get_once
                          return if not data
                      
                          cmd,arg = data.strip.split(/\s+/, 2)
                      Severity: Major
                      Found in lib/msf/core/exploit/remote/ftp_server.rb - About 2 hrs to fix

                        Method get_obd_standards has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def get_obd_standards(bus, src_id, dst_id, opt = {})
                            opt['MAXPKTS'] = 1
                            packets = get_current_data(bus, src_id, dst_id, 0x1C, opt)
                            return "" if packets.nil?
                            if packets.key? "error"
                        Severity: Major
                        Found in lib/msf/core/post/hardware/automotive/uds.rb - About 2 hrs to fix

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

                            def on_request_uri(cli, request)
                              print_status("handling request for #{request.uri}")
                          
                              case request.uri
                              when /\.jar$/i
                          Severity: Major
                          Found in modules/exploits/multi/browser/java_jre17_method_handle.rb and 2 other locations - About 2 hrs to fix
                          modules/exploits/multi/browser/java_jre17_glassfish_averagerangestatisticimpl.rb on lines 86..114
                          modules/exploits/multi/browser/java_jre17_jmxbean.rb on lines 87..115

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

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

                            def on_request_uri(cli, request)
                              print_status("handling request for #{request.uri}")
                          
                              case request.uri
                              when /\.jar$/i
                          modules/exploits/multi/browser/java_jre17_jmxbean.rb on lines 87..115
                          modules/exploits/multi/browser/java_jre17_method_handle.rb on lines 84..112

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

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

                            def on_request_uri(cli, request)
                              print_status("handling request for #{request.uri}")
                          
                              case request.uri
                              when /\.jar$/i
                          Severity: Major
                          Found in modules/exploits/multi/browser/java_jre17_jmxbean.rb and 2 other locations - About 2 hrs to fix
                          modules/exploits/multi/browser/java_jre17_glassfish_averagerangestatisticimpl.rb on lines 86..114
                          modules/exploits/multi/browser/java_jre17_method_handle.rb on lines 84..112

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

                          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

                          for segment in macho.segments
                            #next if segment.segname == MachO::LoadCommands::SEGMENT_NAMES[:SEG_PAGEZERO]
                            puts "segment: #{segment.segname} off: #{segment.offset.to_s(16)} vmaddr: #{segment.vmaddr.to_s(16)} fileoff: #{segment.fileoff.to_s(16)}"
                            for section in segment.sections
                              puts "section: #{section.sectname} off: #{section.offset.to_s(16)} addr: #{section.addr.to_s(16)} size: #{section.size.to_s(16)}"
                          Severity: Major
                          Found in external/source/exploits/CVE-2017-13861/create_bin.rb and 1 other location - About 2 hrs to fix
                          external/source/exploits/CVE-2016-4655/create_bin.rb on lines 29..44

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

                          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

                          for segment in macho.segments
                            #next if segment.segname == MachO::LoadCommands::SEGMENT_NAMES[:SEG_PAGEZERO]
                            puts "segment: #{segment.segname} off: #{segment.offset.to_s(16)} vmaddr: #{segment.vmaddr.to_s(16)} fileoff: #{segment.fileoff.to_s(16)}"
                            for section in segment.sections
                              puts "section: #{section.sectname} off: #{section.offset.to_s(16)} addr: #{section.addr.to_s(16)} size: #{section.size.to_s(16)}"
                          Severity: Major
                          Found in external/source/exploits/CVE-2016-4655/create_bin.rb and 1 other location - About 2 hrs to fix
                          external/source/exploits/CVE-2017-13861/create_bin.rb on lines 29..44

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

                          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

                              begin
                                ssh = nil
                                ::Timeout.timeout(datastore['SSH_TIMEOUT']) do
                                  ssh = Net::SSH.start(rhost, username, opts)
                                end
                          Severity: Major
                          Found in modules/exploits/linux/ssh/vyos_restricted_shell_privesc.rb and 1 other location - About 2 hrs to fix
                          modules/exploits/unix/ssh/arista_tacplus_shell.rb on lines 137..152

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

                          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

                              begin
                                ssh = nil
                                ::Timeout.timeout(datastore['SSH_TIMEOUT']) do
                                  ssh = Net::SSH.start(rhost, username, opts)
                                end
                          Severity: Major
                          Found in modules/exploits/unix/ssh/arista_tacplus_shell.rb and 1 other location - About 2 hrs to fix
                          modules/exploits/linux/ssh/vyos_restricted_shell_privesc.rb on lines 146..161

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

                          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

                          msfbase = __FILE__
                          while File.symlink?(msfbase)
                            msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
                          end
                          
                          
                          Severity: Major
                          Found in tools/exploit/exe2vba.rb and 1 other location - About 2 hrs to fix
                          tools/exploit/exe2vbs.rb on lines 12..48

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

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language