rapid7/metasploit-framework

View on GitHub

Showing 22,004 of 22,004 total issues

Method encode has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def encode
    # Get the minimum number of nops to use
    min = (reqs['MinNops'] || 0).to_i
    min = 0 if reqs['DisableNops']

Severity: Major
Found in lib/msf/core/encoded_payload.rb - About 4 hrs to fix

    Method asm_block_recv_rc4 has 104 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def asm_block_recv_rc4(opts={})
        xorkey = Rex::Text.to_dword(opts[:xorkey]).chomp
        reliable     = opts[:reliable]
        asm = %Q^
          recv:
    Severity: Major
    Found in lib/msf/core/payload/windows/x64/reverse_tcp_rc4_x64.rb - About 4 hrs to fix

      File cve_2022_21999_spoolfool_privesc.rb has 339 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class MetasploitModule < Msf::Exploit::Local
        Rank = NormalRanking
      
        prepend Msf::Exploit::Remote::AutoCheck
        include Msf::Post::File
      Severity: Minor
      Found in modules/exploits/windows/local/cve_2022_21999_spoolfool_privesc.rb - About 4 hrs to fix

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

          def initialize(info = {})
            super(update_info(info,
              'Name'        => 'HTTP Client Automatic Exploiter',
              'Description' => %q{
                  This module has three actions.  The first (and the default)
        Severity: Major
        Found in modules/auxiliary/server/browser_autopwn.rb - About 4 hrs to fix

          Method super_redacted_deobfuscation has 103 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def super_redacted_deobfuscation(ciphertext)
              input = ciphertext
              input = input.gsub('Z', '000')
          
              base = '0'.upto('9').to_a + 'a'.upto('z').to_a + 'A'.upto('G').to_a
          Severity: Major
          Found in modules/auxiliary/admin/http/webnms_cred_disclosure.rb - About 4 hrs to fix

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

              def initialize(info = {})
                super(merge_info(info,
                  'Name'          => 'Linux x64 Command Shell, Bind TCP Inline (IPv6)',
                  'Description'   => 'Listen for an IPv6 connection and spawn a command shell',
                  'Author'        => 'epi <epibar052[at]gmail.com>',
            Severity: Major
            Found in modules/payloads/singles/linux/x64/shell_bind_ipv6_tcp.rb - About 4 hrs to fix

              Method generate has 103 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def generate(_opts = {})
                  # Split the cmd string into arg chunks
                  cmd_str = datastore['CMD']
                  cmd_and_args = Shellwords.shellsplit(cmd_str).map { |s| "#{s}\x00" }
              
              
              Severity: Major
              Found in modules/payloads/singles/osx/aarch64/shell_bind_tcp.rb - About 4 hrs to fix

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

                  def initialize(info = {})
                    super(
                      update_info(
                        info,
                        'Name' => 'Adobe ColdFusion Unauthenticated Remote Code Execution',
                Severity: Major
                Found in modules/exploits/multi/http/adobe_coldfusion_rce_cve_2023_26360.rb - About 4 hrs to fix

                  Method send_file has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def send_file(traversal_path, filename, file_content)
                      #
                      # FileStorageService packet structure:
                      #
                      # @packet_header_pre_packet_size
                  Severity: Major
                  Found in modules/exploits/windows/http/trackit_file_upload.rb - About 4 hrs to fix

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

                      def check
                        # used to ensure cleanup only runs against flexdotnetcms targets
                        @skip_cleanup = true
                    
                        # visit login the page to get the necessary cookies
                    Severity: Major
                    Found in modules/exploits/windows/http/flexdotnetcms_upload_exec.rb - About 4 hrs to fix

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

                        def initialize(info={})
                          super(update_info(info,
                            'Name'           => "MS12-043 Microsoft XML Core Services MSXML Uninitialized Memory Corruption",
                            'Description'    => %q{
                                This module exploits a memory corruption flaw in Microsoft XML Core Services
                      Severity: Major
                      Found in modules/exploits/windows/browser/msxml_get_definition_code_exec.rb - About 4 hrs to fix

                        Method build_packet_and_layouts has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def build_packet_and_layouts(packet, function, args, arch)
                            case arch
                            when ARCH_X64
                              native = 'Q<'
                            when ARCH_X86
                        Severity: Major
                        Found in lib/rex/post/meterpreter/extensions/stdapi/railgun/library.rb - About 4 hrs to fix

                          Method juniper_junos_config_eater has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def juniper_junos_config_eater(thost, tport, config)
                                report_host({
                                  host: thost,
                                  os_name: 'Juniper JunOS'
                                })
                          Severity: Major
                          Found in lib/msf/core/auxiliary/juniper.rb - About 4 hrs to fix

                            Method identify_hash has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  def self.identify_hash(hash)
                                    # @param [str] a string of a hashed password
                                    # @return [String] the jtr type or empty string on no match
                                    hash = hash.to_s.strip
                                    case
                            Severity: Major
                            Found in lib/metasploit/framework/hashes.rb - About 4 hrs to fix

                              File sap_igs_xmlchart_xxe.rb has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              class MetasploitModule < Msf::Auxiliary
                              
                                include Msf::Exploit::Remote::HttpClient
                              
                                def initialize(info = {})
                              Severity: Minor
                              Found in modules/auxiliary/admin/sap/sap_igs_xmlchart_xxe.rb - About 4 hrs to fix

                                File client_ftp.rb has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                class MetasploitModule < Msf::Auxiliary
                                  include Exploit::Remote::TcpServer
                                
                                  def initialize()
                                    super(
                                Severity: Minor
                                Found in modules/auxiliary/fuzzers/ftp/client_ftp.rb - About 4 hrs to fix

                                  File ahsay_backup_fileupload.rb has 337 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
                                    include Msf::Exploit::FileDropper
                                  Severity: Minor
                                  Found in modules/exploits/windows/misc/ahsay_backup_fileupload.rb - About 4 hrs to fix

                                    File outlook.rb has 337 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    class MetasploitModule < Msf::Post
                                      include Msf::Post::Windows::Registry
                                      include Msf::Post::Windows::Priv
                                      include Msf::Auxiliary::Report
                                    
                                    
                                    Severity: Minor
                                    Found in modules/post/windows/gather/credentials/outlook.rb - About 4 hrs to fix

                                      Function run has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      def run(args):
                                          if dependencies_requests_missing:
                                              logging.error('Module dependency (requests) is missing, cannot continue')
                                              return
                                          
                                      Severity: Minor
                                      Found in modules/auxiliary/admin/http/grafana_auth_bypass.py - 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

                                      Method perform_sqli has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        def perform_sqli
                                          # NOTE: using run_sql because there is a limit on the length of our queries
                                          # will work only if we remove the casts, NULL value handling etc.
                                          digit_range = ('0'..'9')
                                          bit_range = ('0'..'1')
                                      Severity: Minor
                                      Found in modules/auxiliary/gather/peplink_bauth_sqli.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language