rapid7/metasploit-framework

View on GitHub

Showing 7,301 of 22,004 total issues

Function Int64 has 143 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Int64(v) {
    // The underlying byte array.
    var bytes = new Uint8Array(8);

    switch (typeof v) {
Severity: Major
Found in data/exploits/javascript_utils/int64.js - About 5 hrs to fix

    Method create_library has 143 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                    def self.create_library(constant_manager, library_path = 'ntdll')
                      dll = Library.new(library_path, constant_manager)
    
                      dll.add_function('NtAllocateVirtualMemory', 'DWORD', [
                        ['DWORD', 'ProcessHandle', 'in'],

      Method vyos_config_eater has 143 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def vyos_config_eater(thost, tport, config, store = true)
      
            credential_data = {
              address: thost,
              port: tport,
      Severity: Major
      Found in lib/msf/core/auxiliary/vyos.rb - About 5 hrs to fix

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

          def run
            def check_results(passwords, results, hash_type, method)
              passwords.each do |password_line|
                password_line.chomp!
                next if password_line.blank?
        Severity: Major
        Found in modules/auxiliary/analyze/crack_mobile.rb - About 5 hrs to fix

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

            def run_host(ip)
          
              path = datastore['PATH']
              check1 = [
                'iNotes/Forms5.nsf',
          Severity: Major
          Found in modules/auxiliary/scanner/lotus/lotus_domino_version.rb - About 5 hrs to fix

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

              def exploit
                # Display start time
                time1 = Time.new
                print_status("-------------------------------------------------")
                print_status("Start time : #{time1.inspect}")
            Severity: Major
            Found in modules/exploits/windows/mssql/mssql_linkcrawler.rb - About 5 hrs to fix

              Method query_current_connection has 142 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def query_current_connection(wlan_handle, guid)
                  connection = {}
                  conn_info = @wlanapi.WlanQueryInterface(wlan_handle, guid, 7, nil, 4, 4, nil)
                  # Grab the pointer to our data structure. We skip voer the Interface State since we already have it
                  # We interpret the connection mode used first
              Severity: Major
              Found in modules/post/windows/wlan/wlan_current_connection.rb - About 5 hrs to fix

                Method query_current_connection has 142 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def query_current_connection(wlan_handle, guid)
                    connection = {}
                    conn_info = @wlanapi.WlanQueryInterface(wlan_handle, guid, 7, nil, 4, 4, nil)
                
                    # Grab the pointer to our data structure. We skip voer the Interface State since we already have it
                Severity: Major
                Found in modules/post/windows/wlan/wlan_disconnect.rb - About 5 hrs to fix

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

                              if str(e).find('strongerAuthRequired') >= 0:
                                  # We need to try SSL
                                  ldapConnection = ldap.LDAPConnection('ldaps://%s' % self.__target, self.baseDN, self.__kdcIP)
                                  if self.__doKerberos is not True:
                                      ldapConnection.login(self.__username, self.__password, self.__domain, self.__lmhash, self.__nthash)
                  Severity: Major
                  Found in modules/auxiliary/gather/get_user_spns.py and 1 other location - About 5 hrs to fix
                  modules/auxiliary/gather/get_user_spns.py on lines 273..280

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

                  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 execve(filename, argv, envp):
                      from ctypes import cdll, c_char_p, POINTER
                  
                      libc = cdll.LoadLibrary("libc.so.6")
                      libc.execve.argtypes = c_char_p,POINTER(c_char_p),POINTER(c_char_p)
                  Severity: Major
                  Found in data/exploits/CVE-2021-3156/nss_u14.py and 1 other location - About 5 hrs to fix
                  data/exploits/CVE-2021-3156/nss_u16.py on lines 27..36

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

                  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

                          try:
                              ldapConnection = ldap.LDAPConnection('ldap://%s' % self.__target, self.baseDN, self.__kdcIP)
                              if self.__doKerberos is not True:
                                  ldapConnection.login(self.__username, self.__password, self.__domain, self.__lmhash, self.__nthash)
                              else:
                  Severity: Major
                  Found in modules/auxiliary/gather/get_user_spns.py and 1 other location - About 5 hrs to fix
                  modules/auxiliary/gather/get_user_spns.py on lines 282..290

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

                  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 execve(filename, argv, envp):
                      from ctypes import cdll, c_char_p, POINTER
                  
                      libc = cdll.LoadLibrary("libc.so.6")
                      libc.execve.argtypes = c_char_p,POINTER(c_char_p),POINTER(c_char_p)
                  Severity: Major
                  Found in data/exploits/CVE-2021-3156/nss_u16.py and 1 other location - About 5 hrs to fix
                  data/exploits/CVE-2021-3156/nss_u14.py on lines 29..38

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

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

                    def get_form_data(body)
                      print_status("Enumerating form data")
                      body = body.gsub("\r","")
                      body = body.gsub("\n","")
                      bodydata = body.downcase.split(/<form/)
                  Severity: Major
                  Found in modules/auxiliary/fuzzers/http/http_form_field.rb - About 5 hrs to fix

                    Method upload_exec has 141 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def upload_exec(session,rpath)
                        contents=''
                        name = Rex::Text.rand_text_alpha(8)
                    
                        # We must register this file early, that way the on_new_session method
                    Severity: Major
                    Found in modules/exploits/multi/http/axis2_deployer.rb - About 5 hrs to fix

                      Method build_payload_obj has 141 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def build_payload_obj(payload_data)
                          payload_obj = 'aced0005' # STREAM_MAGIC, STREAM_VERSION
                          payload_obj << '73720017' # TC_OBJECT, TC_CLASSDESC, class name length: 23
                          payload_obj << '6a6176612e7574696c2e5072696f726974795175657565' # java.util.PriorityQueue
                          payload_obj << '94da30b4fb3f82b1' # SerialVersionUID
                      Severity: Major
                      Found in modules/exploits/multi/misc/weblogic_deserialize_badattr_extcomp.rb - About 5 hrs to fix

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

                          def exploit
                        
                            # Step 1 - Establish a session with the target which will give us a PHP object we can
                            # work with.
                            begin
                        Severity: Major
                        Found in modules/exploits/linux/http/seagate_nas_php_exec_noauth.rb - About 5 hrs to fix

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

                            def initialize(info = {})
                              super(
                                update_info(
                                  info,
                                  'Name' => 'Cloud Lookup (and Bypass)',
                          Severity: Major
                          Found in modules/auxiliary/gather/cloud_lookup.rb - About 5 hrs to fix

                            Method parse_sddl_ace has 140 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  def parse_sddl_ace(ace, domain_sid:)
                                    parts = ace.upcase.split(';', -1)
                                    raise RuntimeError.new('SDDL parse error on too few ACE fields') if parts.length < 6
                                    raise RuntimeError.new('SDDL parse error on too many ACE fields') if parts.length > 7
                            
                            
                            Severity: Major
                            Found in lib/rex/proto/ms_dtyp.rb - About 5 hrs to fix

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

                                def run_host(ip)
                              
                                  #
                                  # Max string len
                                  #
                              Severity: Major
                              Found in modules/auxiliary/scanner/http/xpath.rb - About 5 hrs to fix

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

                                  def initialize(info = {})
                                    super(
                                      update_info(
                                        info,
                                        'Name' => 'Script Web Delivery',
                                Severity: Major
                                Found in modules/exploits/multi/script/web_delivery.rb - About 5 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language