rapid7/metasploit-framework

View on GitHub

Showing 7,301 of 22,004 total issues

File reverse_win_http.rb has 524 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Msf

###
#
# Complex payload generation for Windows ARCH_X86 that speak HTTP(S) using WinHTTP
Severity: Major
Found in lib/msf/core/payload/windows/reverse_win_http.rb - About 1 day to fix

    File reverse_win_http_x64.rb has 523 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Msf
    
    ###
    #
    # Complex payload generation for Windows ARCH_X86 that speak HTTP(S) using WinHTTP
    Severity: Major
    Found in lib/msf/core/payload/windows/x64/reverse_win_http_x64.rb - About 1 day to fix

      Method prepend_migrate_64 has 213 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def prepend_migrate_64(buf)
          payloadsize = "0x%04x" % buf.length
          procname = datastore['PrependMigrateProc'] || 'rundll32'
      
          # Prepare instructions to get address of block_api into ebp
      Severity: Major
      Found in lib/msf/core/payload/windows/prepend_migrate.rb - About 1 day to fix

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

            if (mytarget['OS'] =~ /2000/)
              txt[0, payload.encoded.length] = payload.encoded
        
              off = mytarget['Off']
              txt[ off ] = [mytarget.ret].pack('V')
        Severity: Major
        Found in modules/exploits/windows/dcerpc/ms07_029_msdns_zonename.rb and 1 other location - About 1 day to fix
        modules/exploits/windows/smb/ms07_029_msdns_zonename.rb on lines 158..240

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

        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

            if (target['OS'] =~ /2000/)
              txt[0, payload.encoded.length] = payload.encoded
        
              off = target['Off']
              txt[ off ] = [target.ret].pack('V')
        Severity: Major
        Found in modules/exploits/windows/smb/ms07_029_msdns_zonename.rb and 1 other location - About 1 day to fix
        modules/exploits/windows/dcerpc/ms07_029_msdns_zonename.rb on lines 175..257

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

        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

        Class Client has 59 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Client
        
          require 'net/ntlm'
        
        require 'rex/text'
        Severity: Major
        Found in lib/rex/proto/smb/client.rb - About 1 day to fix

          Method command_string has 212 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def command_string
              if (datastore['JOBNAME'] == "DUMMY") && !datastore['FTPUSER'].nil?
                datastore['JOBNAME'] = (datastore['FTPUSER'] + "1").strip.upcase
              end
              lhost = Rex::Socket.resolv_nbo(datastore['LHOST'])
          Severity: Major
          Found in modules/payloads/singles/cmd/mainframe/reverse_shell_jcl.rb - About 1 day to fix

            File bitbucket_env_var_rce.rb has 520 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            class MetasploitModule < Msf::Exploit::Remote
              Rank = ExcellentRanking
            
              include Msf::Exploit::Remote::HttpClient
              include Msf::Exploit::Git
            Severity: Major
            Found in modules/exploits/multi/http/bitbucket_env_var_rce.rb - About 1 day to fix

              File jetbrains_teamcity_rce_cve_2024_27198.rb has 520 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class MetasploitModule < Msf::Exploit::Remote
                Rank = ExcellentRanking
              
                prepend Msf::Exploit::Remote::AutoCheck
                include Msf::Exploit::Remote::HttpClient
              Severity: Major
              Found in modules/exploits/multi/http/jetbrains_teamcity_rce_cve_2024_27198.rb - About 1 day to fix

                File capture.rb has 518 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'uri'
                require 'rex/sync/event'
                require 'fileutils'
                
                module Msf
                Severity: Major
                Found in plugins/capture.rb - About 1 day to fix

                  File prometheus.rb has 518 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module Msf
                    ###
                    #
                    # This module provides methods for working with Prometheus node exporter
                    #
                  Severity: Major
                  Found in lib/msf/core/auxiliary/prometheus.rb - About 1 day to fix

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

                      def make_js(encoded_payload)
                    
                        # The following executes a ret2lib using BIB.dll
                        # The effect is to bypass DEP and execute the shellcode in an indirect way
                        stack_data = [
                    modules/exploits/windows/browser/adobe_flashplayer_newfunction.rb on lines 92..238

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

                    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 make_js(encoded_payload)
                    
                        # The following executes a ret2lib using BIB.dll
                        # The effect is to bypass DEP and execute the shellcode in an indirect way
                        stack_data = [
                    modules/exploits/windows/fileformat/adobe_flashplayer_newfunction.rb on lines 94..240

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

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

                      def parse_host(host, wspace, blacklist, allow_yaml, btag, args, &block)
                    
                        host_data = {}
                        host_data[:task] = args[:task]
                        host_data[:workspace] = wspace
                    Severity: Major
                    Found in lib/msf/core/db_manager/import/metasploit_framework/xml.rb - About 1 day to fix

                      File acunetix_document.rb has 513 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require "rex/parser/nokogiri_doc_mixin"
                      require 'rex'
                      require 'uri'
                      
                      module Rex
                      Severity: Major
                      Found in lib/rex/parser/acunetix_document.rb - About 1 day to fix

                        File def_ws2_32.rb has 513 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        module Rex
                        module Post
                        module Meterpreter
                        module Extensions
                        module Stdapi

                          File kiwi.rb has 512 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          require 'rex/post/meterpreter'
                          
                          module Rex
                          module Post
                          module Meterpreter
                          Severity: Major
                          Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.rb - About 1 day to fix

                            File syscall_inject.rb has 511 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            require 'metasploit/framework/compiler/mingw'
                            require 'metasploit/framework/compiler/windows'
                            class MetasploitModule < Msf::Evasion
                              RC4 = File.join(Msf::Config.data_directory, 'headers', 'windows', 'rc4.h')
                              BASE64 = File.join(Msf::Config.data_directory, 'headers', 'windows', 'base64.h')
                            Severity: Major
                            Found in modules/evasion/windows/syscall_inject.rb - About 1 day to fix

                              File net.rb has 510 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: Major
                              Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb - About 1 day to fix

                                File client.rb has 509 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                require 'rex/socket'
                                
                                require 'rex/text'
                                require 'digest'
                                
                                
                                Severity: Major
                                Found in lib/rex/proto/http/client.rb - About 1 day to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language