rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

Method get_version_info_impl has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

  def get_version_info_impl
    if session.type == 'meterpreter'
      result = session.railgun.ntdll.RtlGetVersion(input_os_version_info_ex)
      os_version_info_ex = unpack_version_info(result['VersionInformation'])
      major = os_version_info_ex[1]
Severity: Minor
Found in lib/msf/core/post/windows/version.rb - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File get_user_spns.py has 371 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# modules
dependencies_missing = False
Severity: Minor
Found in modules/auxiliary/gather/get_user_spns.py - About 4 hrs to fix

    File drupal_drupageddon.rb has 371 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Exploit::Remote
      Rank = ExcellentRanking
    
      include Msf::Exploit::Remote::HttpClient
    
    
    Severity: Minor
    Found in modules/exploits/multi/http/drupal_drupageddon.rb - About 4 hrs to fix

      File trackit_file_upload.rb has 371 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class MetasploitModule < Msf::Exploit::Remote
        Rank = ExcellentRanking
      
        include Msf::Exploit::Remote::HttpClient
        include Msf::Exploit::EXE
      Severity: Minor
      Found in modules/exploits/windows/http/trackit_file_upload.rb - About 4 hrs to fix

        Method frfxdmp has 122 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def frfxdmp(usrnm)
          sitesvisited = []
          dnldsmade = []
          bkmrks = []
          cookies = []
        Severity: Major
        Found in scripts/meterpreter/enum_firefox.rb - About 4 hrs to fix

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

            def run
              # check if we already have a socket, if not, create one
              unless @sock
                # create a socket
                res_code, sock_or_msg = create_socket_for_xnode(rhost, rport)
          Severity: Major
          Found in modules/auxiliary/gather/manageengine_datasecurity_plus_xnode_enum.rb - About 4 hrs to fix

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

              def run
                # check if we already have a socket, if not, create one
                unless @sock
                  # create a socket
                  res_code, sock_or_msg = create_socket_for_xnode(rhost, rport)
            Severity: Major
            Found in modules/auxiliary/gather/manageengine_adaudit_plus_xnode_enum.rb - About 4 hrs to fix

              File ui.rb has 370 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'rex/post/meterpreter'
              require 'rex/post/meterpreter/extensions/stdapi/command_ids'
              
              module Rex
              module Post
              Severity: Minor
              Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/ui.rb - About 4 hrs to fix

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

                  def self.create_library(constant_manager, library_path = 'libc.dylib')
                    lib = Library.new(library_path, constant_manager)
                
                    lib.add_function(
                      'calloc',

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

                    def run
                      host = datastore['HOST']
                      port = datastore['PORT']
                      local_host = datastore['SRVHOST']
                      local_port = datastore['SRVPORT']
                  Severity: Major
                  Found in modules/auxiliary/server/openssl_altchainsforgery_mitm_proxy.rb - About 4 hrs to fix

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

                      def run
                        print_status('Attempting to leak the password of the admin user...')
                        res = send_request_cgi(
                          'uri' => '/setup.cgi',
                          'method' => 'GET',

                      Method run has 121 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_aix.rb - About 4 hrs to fix

                        Method mount_internal_database has 121 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def mount_internal_database
                            # use cve-2023-39265 bypass to mount superset's internal sqlite db
                            res = send_request_cgi(
                              'uri' => normalize_uri(target_uri.path, 'api', 'v1', 'database/'),
                              'method' => 'POST',
                        Severity: Major
                        Found in modules/exploits/linux/http/apache_superset_cookie_sig_rce.rb - About 4 hrs to fix

                          Class WmapCommandDispatcher has 37 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                              class WmapCommandDispatcher
                          
                                # @!attribute wmapmodules
                                #   @return [Array] Enabled WMAP modules
                                # @!attribute targets
                          Severity: Minor
                          Found in plugins/wmap.rb - About 4 hrs to fix

                            Class MetasploitModule has 37 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            class MetasploitModule < Msf::Auxiliary
                              include Msf::Exploit::Remote::Tcp
                              include Msf::Auxiliary::Scanner
                              include Msf::Auxiliary::Report
                            
                            
                            Severity: Minor
                            Found in modules/auxiliary/scanner/ssl/openssl_heartbleed.rb - About 4 hrs to fix

                              Class Core has 37 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              class Console::CommandDispatcher::Core
                              
                                include Console::CommandDispatcher
                              
                                #
                              Severity: Minor
                              Found in lib/rex/post/hwbridge/ui/console/command_dispatcher/core.rb - About 4 hrs to fix

                                Class RPC_Module has 37 methods (exceeds 20 allowed). Consider refactoring.
                                Open

                                class RPC_Module < RPC_Base
                                
                                  # Returns a list of exploit names. The 'exploit/' prefix will not be included.
                                  #
                                  # @return [Hash] A list of exploit names. It contains the following key:
                                Severity: Minor
                                Found in lib/msf/core/rpc/v10/rpc_module.rb - About 4 hrs to fix

                                  File adobe_cooltype_sing.rb has 368 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  require 'zlib'
                                  
                                  class MetasploitModule < Msf::Exploit::Remote
                                    Rank = GreatRanking # aslr+dep bypass, js heap spray, rop, stack bof
                                  
                                  
                                  Severity: Minor
                                  Found in modules/exploits/windows/fileformat/adobe_cooltype_sing.rb - About 4 hrs to fix

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

                                      def run
                                        return if not check_dependencies
                                    
                                        name  = Rex::Text.rand_text_alpha_upper(rand(10) + 1)
                                        rand1 = Rex::Text.rand_text_alpha_upper(rand(10) + 1)
                                    Severity: Major
                                    Found in modules/auxiliary/sqli/oracle/lt_mergeworkspace.rb and 1 other location - About 4 hrs to fix
                                    modules/auxiliary/sqli/oracle/lt_removeworkspace.rb on lines 32..94

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

                                    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 run
                                        return if not check_dependencies
                                    
                                        name  = Rex::Text.rand_text_alpha_upper(rand(10) + 1)
                                        rand1 = Rex::Text.rand_text_alpha_upper(rand(10) + 1)
                                    Severity: Major
                                    Found in modules/auxiliary/sqli/oracle/lt_removeworkspace.rb and 1 other location - About 4 hrs to fix
                                    modules/auxiliary/sqli/oracle/lt_mergeworkspace.rb on lines 35..97

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

                                    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