rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

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

    public static short[] HexDecode(String s)
      {
          short[] data = new short[s.length()/2];
          
          for (int i = 0; i < s.length(); i += 2)
Severity: Major
Found in external/source/exploits/CVE-2009-3869/AppletX.java and 1 other location - About 2 hrs to fix
external/source/exploits/CVE-2009-3867/AppletX.java on lines 88..103

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

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

    public static short[] HexDecode(String s)
      {
          short[] data = new short[s.length()/2];
          
          for (int i = 0; i < s.length(); i += 2)
Severity: Major
Found in external/source/exploits/CVE-2009-3867/AppletX.java and 1 other location - About 2 hrs to fix
external/source/exploits/CVE-2009-3869/AppletX.java on lines 59..74

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

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

      def cmd_nessus_scan_list(*args)
        search_term = nil
        while (arg = args.shift)
          case arg
          when '-h', '--help'
Severity: Major
Found in plugins/nessus.rb - About 2 hrs to fix

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

      def on_client_data(c)
        data = c.get_once
        return unless data
        num, cmd, arg = data.strip.split(/\s+/, 3)
        cmd ||= ''
    Severity: Major
    Found in modules/auxiliary/server/capture/imap.rb - About 2 hrs to fix

      Method on_request_uri has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def on_request_uri(cli, request)
          my_host  = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(cli.peerhost) : datastore['SRVHOST']
      
          case request.method
          when 'OPTIONS'
      Severity: Major
      Found in modules/auxiliary/gather/ie_sandbox_findfiles.rb - About 2 hrs to fix

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

          def run
            res = send_request_cgi(
              'uri' => normalize_uri(target_uri.path, 'fm', 'fmrest', 'about', 'version'),
              'method' => 'GET'
            )
        Severity: Major
        Found in modules/auxiliary/admin/networking/cisco_dcnm_download.rb - About 2 hrs to fix

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

            def run
              print_status("Grabbing the SQL Server name and domain...")
              db_server_name = get_server_name
              if db_server_name.nil?
                print_error("Unable to grab the server name")
          Severity: Major
          Found in modules/auxiliary/admin/mssql/mssql_enum_domain_accounts_sqli.rb - About 2 hrs to fix

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

              def run
                if session
                  set_mssql_session(session.client)
                else
                  print_status("Attempting to connect to the database server at #{rhost}:#{rport} as #{datastore['USERNAME']}...")
            Severity: Major
            Found in modules/auxiliary/admin/mssql/mssql_escalate_execute_as.rb - About 2 hrs to fix

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

                def run
                  # Check connection and issue initial query
                  if session
                    set_mssql_session(session.client)
                  else
              Severity: Major
              Found in modules/auxiliary/admin/mssql/mssql_escalate_dbowner.rb - About 2 hrs to fix

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

                  def run_host(_ip)
                    soapenv = 'http://schemas.xmlsoap.org/soap/envelope/'
                    soapenvenc = 'http://schemas.xmlsoap.org/soap/encoding/'
                    xsi = 'http://www.w3.org/1999/XMLSchema-instance'
                    xsd = 'http://www.w3.org/1999/XMLSchema'
                Severity: Major
                Found in modules/auxiliary/admin/networking/cisco_secure_acs_bypass.rb - About 2 hrs to fix

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

                    def run
                      credentials = ::Aws::Credentials.new(datastore['ACCESS_KEY_ID'], datastore['SECRET_ACCESS_KEY'])
                      vprint_status "Checking #{datastore['REGION']}..."
                      client = ::Aws::SSM::Client.new(
                        region: datastore['REGION'],
                  Severity: Major
                  Found in modules/auxiliary/cloud/aws/enum_ssm.rb - About 2 hrs to fix

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

                      def run_host(ip)
                        cli = Rex::Proto::Http::Client.new(datastore['RHOSTS'], datastore['RPORT'], {}, datastore['SSL'], datastore['SSLVersion'], nil, '', '')
                        cli.set_config({ 'preferred_auth' => 'NTLM' })
                        cli.connect
                    
                    
                    Severity: Major
                    Found in modules/auxiliary/scanner/http/owa_ews_login.rb - About 2 hrs to fix

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

                        def run_host(ip)
                          uri = normalize_uri(target_uri.path)
                      
                          print_status("Verifying login exists at #{target_url}")
                          begin
                      Severity: Major
                      Found in modules/auxiliary/scanner/http/axis_login.rb - About 2 hrs to fix

                        Method check_hku_entry has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def check_hku_entry(key, ip, smbshare, cmd, text, bat)
                            begin
                              key = key.split("HKEY_USERS\\")[1].chomp
                              command = "#{cmd} /C echo reg.exe QUERY \"HKU\\#{key}\\Volatile Environment\" ^> %SYSTEMDRIVE%#{text} > #{bat} & #{cmd} /C start cmd.exe /C #{bat}"
                              out = psexec(command)
                        Severity: Major
                        Found in modules/auxiliary/scanner/smb/psexec_loggedin_users.rb - About 2 hrs to fix

                          Method smb_proto_info has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def smb_proto_info
                              info = {
                                capabilities: {},
                                versions: []
                              }
                          Severity: Major
                          Found in modules/auxiliary/scanner/smb/smb_version.rb - About 2 hrs to fix

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

                              def initialize(info = {})
                                super(
                                  update_info(
                                    info,
                                    'Name'        => 'pfSense authenticated graph status RCE',
                            Severity: Major
                            Found in modules/exploits/unix/http/pfsense_graph_injection_exec.rb - About 2 hrs to fix

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

                                def initialize(info = {})
                                  super(
                                    update_info(
                                      info,
                                      'Name' => 'Tiki Wiki unserialize() PHP Code Execution',
                              Severity: Major
                              Found in modules/exploits/unix/webapp/tikiwiki_unserialize_exec.rb - About 2 hrs to fix

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

                                  def exploit
                                    base = target_uri.path
                                    @fname = rand_text_alphanumeric(rand(10) + 6) + '.php'
                                    user = datastore['USERNAME']
                                    pass = datastore['PASSWORD']
                                Severity: Major
                                Found in modules/exploits/multi/http/glossword_upload_exec.rb - About 2 hrs to fix

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

                                    def initialize(info = {})
                                      super(update_info(info,
                                        'Name'           => 'PHPMailer Sendmail Argument Injection',
                                        'Description'    => %q{
                                          PHPMailer versions up to and including 5.2.19 are affected by a
                                  Severity: Major
                                  Found in modules/exploits/multi/http/phpmailer_arg_injection.rb - About 2 hrs to fix

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

                                      def initialize(info = {})
                                        super(
                                          update_info(
                                            info,
                                            'Name' => 'SPIP Unauthenticated RCE via porte_plume Plugin',
                                    Severity: Major
                                    Found in modules/exploits/multi/http/spip_porte_plume_previsu_rce.rb - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language