rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

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

  def check
    res = send_request_cgi(
      'uri' => normalize_uri(target_uri.path, '/get_global_variables'),
      'method' => 'GET'
    )
Severity: Major
Found in modules/exploits/unix/http/syncovery_linux_rce_2022_36534.rb and 1 other location - About 2 hrs to fix
modules/auxiliary/scanner/http/syncovery_linux_token_cve_2022_36536.rb on lines 68..93

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

              wepkey1 = snmp.get_value('1.3.6.1.4.1.4684.38.2.2.2.1.5.4.2.2.1.2.12.1')
              key1 = "#{wepkey1}".unpack('H*')
              print_good("WEP KEY1: #{key1}")
              wifiinfo << "WEP KEY1: #{key1}" << "\n"
              wepkey2 = snmp.get_value('1.3.6.1.4.1.4684.38.2.2.2.1.5.4.2.2.1.2.12.2')
Severity: Major
Found in modules/auxiliary/scanner/snmp/ubee_ddw3611.rb and 1 other location - About 2 hrs to fix
modules/auxiliary/scanner/snmp/ubee_ddw3611.rb on lines 60..78

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

  def check_host(_ip)
    res = send_request_cgi(
      'uri' => normalize_uri(target_uri.path, '/get_global_variables'),
      'method' => 'GET'
    )
modules/exploits/unix/http/syncovery_linux_rce_2022_36534.rb on lines 67..92

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/exe2vbs.rb and 1 other location - About 2 hrs to fix
tools/exploit/exe2vba.rb on lines 13..49

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

              wepkey1 = snmp.get_value('1.3.6.1.4.1.4684.38.2.2.2.1.5.4.2.3.1.2.12.1')
              key1 = "#{wepkey1}".unpack('H*')
              print_good("WEP KEY1: #{key1}")
              wifiinfo << "WEP KEY1: #{key1}" << "\n"
              wepkey2 = snmp.get_value('1.3.6.1.4.1.4684.38.2.2.2.1.5.4.2.3.1.2.12.2')
Severity: Major
Found in modules/auxiliary/scanner/snmp/ubee_ddw3611.rb and 1 other location - About 2 hrs to fix
modules/auxiliary/scanner/snmp/ubee_ddw3611.rb on lines 81..99

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

Method scheduleme has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def scheduleme(session,schtype,cmd,tmmod,cmdopt,username,password)
  execmd = ""
  success = false
  taskname = "syscheck#{rand(100)}"
  if cmdopt != nil
Severity: Major
Found in scripts/meterpreter/scheduleme.rb - About 2 hrs to fix

    Method get_node_info has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def get_node_info
        vprint_status('Querying node information...')
        request = {
          'uri' => normalize_uri(target_uri.path, '_cat', 'nodes'),
          'method' => 'GET',
    Severity: Major
    Found in modules/auxiliary/gather/elasticsearch_enum.rb - About 2 hrs to fix

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

        def initialize(info = {})
          super(
            update_info(
              info,
              'Name' => 'GitStack Unauthenticated REST API Requests',
      Severity: Major
      Found in modules/auxiliary/admin/http/gitstack_rest.rb - About 2 hrs to fix

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

          def initialize(info = {})
            super(
              update_info(
                info,
                'Name' => 'Cisco IOX XE unauthenticated OS command execution',
        Severity: Major
        Found in modules/auxiliary/admin/http/cisco_ios_xe_os_exec_cve_2023_20273.rb - About 2 hrs to fix

          Method run_host has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def run_host(ip)
          
              print_status("[SAP] #{ip}:#{rport} - Sending request to SAP Application Server")
              uri = normalize_uri(target_uri.path, '/sap/public/info')
              begin
          Severity: Major
          Found in modules/auxiliary/scanner/sap/sap_icf_public_info.rb - About 2 hrs to fix

            Method run_host has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def run_host(ip)
                extensions = [
                  '.null',
                  '.backup',
                  '.bak',
            Severity: Major
            Found in modules/auxiliary/scanner/http/file_same_name_dir.rb - About 2 hrs to fix

              Method run_host has 68 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def run_host(target_host)
                  tpath = normalize_uri(datastore['PATH'])
                  if tpath[-1,1] != '/'
                    tpath += '/'
                  end
              Severity: Major
              Found in modules/auxiliary/scanner/http/trace_axd.rb - About 2 hrs to fix

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

                  def run
                    password = datastore['PASSWORD']
                    if datastore['PASSWORD'].blank?
                      password = Rex::Text.rand_text_alphanumeric(10..15)
                    end
                Severity: Major
                Found in modules/auxiliary/scanner/http/wp_woocommerce_payments_add_user.rb - About 2 hrs to fix

                  Method run_host has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def run_host(ip)
                      print_brute :ip => ip, :msg => 'Starting bruteforce'
                  
                      # Perform a sanity check to ensure that our target is vmauthd before
                      # attempting to brute force it.
                  Severity: Major
                  Found in modules/auxiliary/scanner/vmware/vmauthd_login.rb - About 2 hrs to fix

                    Method run_host has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def run_host(_ip)
                        begin
                          connect
                        rescue Rex::ConnectionError => e
                          fail_with(Failure::Unreachable, e.message)
                    Severity: Major
                    Found in modules/auxiliary/scanner/dcerpc/petitpotam.rb - About 2 hrs to fix

                      Method run_host has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def run_host(ip)
                          epm = dcerpc_endpoint_list
                          if !epm
                            print_status("Could not contact the endpoint mapper on #{ip}")
                            return
                      Severity: Major
                      Found in modules/auxiliary/scanner/dcerpc/hidden.rb - About 2 hrs to fix

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

                          def initialize(info = {})
                            super(
                              update_info(
                                info,
                                'Name' => 'Vagrant Synced Folder Vagrantfile Breakout',

                          Method exec_php has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def exec_php(php_code, is_check = false)
                              print_status('Checking access to MantisBT...')
                              res = send_request_cgi({
                                'method'   => 'GET',
                                'uri'      => normalize_uri(target_uri.path)
                          Severity: Major
                          Found in modules/exploits/multi/http/mantisbt_php_exec.rb - About 2 hrs to fix

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

                              def exploit
                                res = send_request_cgi({
                                  'uri' => normalize_uri(target_uri.path, 'admin', 'login.php'),
                                  'method' => 'POST',
                                  'vars_post' => {
                            Severity: Major
                            Found in modules/exploits/multi/http/cmsms_upload_rename_rce.rb - About 2 hrs to fix

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

                                def check
                                  auth_res = check_auth
                                  unless auth_res
                                    return CheckCode::Unknown('Authentication failed!')
                                  end
                              Severity: Major
                              Found in modules/exploits/multi/http/solr_velocity_rce.rb - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language