rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

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

  def exploit
    # Need to grab the PHP session cookie value first to pass to application
    vprint_status('Gathering PHP session cookie')
    if datastore['SSL'] == true
      vprint_status('SSL is true, changing protocol to HTTPS')
Severity: Major
Found in modules/exploits/multi/http/churchinfo_upload_exec.rb - About 3 hrs to fix

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

      def initialize(info = {})
        super(
          update_info(
            info,
            'Name'           => 'Service Persistence',
    Severity: Major
    Found in modules/exploits/linux/local/service_persistence.rb - About 3 hrs to fix

      Method import_libpcap has 92 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def import_libpcap(args={}, &block)
          data = args[:data]
          wspace = Msf::Util::DBManager.process_opts_workspace(args, framework).name
          bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []
          # seen_hosts is only used for determining when to yield an address. Once we get
      Severity: Major
      Found in lib/msf/core/db_manager/import/libpcap.rb - About 3 hrs to fix

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

          def bruteforce(ip)
            @scanner.scan! do |result|
              case result.status
              when Metasploit::Model::Login::Status::SUCCESSFUL
                print_brute(:level => :good, :ip => ip, :msg => "Success: '#{result.credential}'")
        modules/auxiliary/scanner/nessus/nessus_rest_login.rb on lines 92..123

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

        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 bruteforce(ip)
            @scanner.scan! do |result|
              case result.status
              when Metasploit::Model::Login::Status::SUCCESSFUL
                print_brute :level => :good, :ip => ip, :msg => "Success: '#{result.credential}'"
        Severity: Major
        Found in modules/auxiliary/scanner/nessus/nessus_rest_login.rb and 1 other location - About 3 hrs to fix
        modules/auxiliary/scanner/http/manageengine_desktop_central_login.rb on lines 80..111

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

        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

          # @return [String] Hex digest of file contents
          def file_remote_digestmd5(file_name, util: nil)
            if session.type == 'meterpreter'
              begin
                return session.fs.file.md5(file_name)&.unpack('H*').flatten.first
        Severity: Major
        Found in lib/msf/core/post/file.rb and 1 other location - About 3 hrs to fix
        lib/msf/core/post/file.rb on lines 410..445

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

        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

          # @return [String] Hex digest of file contents
          def file_remote_digestsha1(file_name, util: nil)
            if session.type == 'meterpreter'
              begin
                return session.fs.file.sha1(file_name)&.unpack('H*').flatten.first
        Severity: Major
        Found in lib/msf/core/post/file.rb and 1 other location - About 3 hrs to fix
        lib/msf/core/post/file.rb on lines 361..397

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

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

          def listfiles(rhost)
            print_status("[SAP] Connecting to SAP Management Console SOAP Interface on #{rhost}:#{rport}")
            success = false
            soapenv = 'http://schemas.xmlsoap.org/soap/envelope/'
            xsi = 'http://www.w3.org/2001/XMLSchema-instance'
        Severity: Major
        Found in modules/auxiliary/scanner/sap/sap_mgmt_con_listlogfiles.rb - About 3 hrs to fix

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

            def generate(_opts = {})
              encoded_port = [datastore['LPORT'].to_i, 2].pack('vv').unpack('N').first
              encoded_host = Rex::Socket.addr_aton(datastore['LHOST'] || '127.127.127.127').unpack('V').first
              retry_count = datastore['StagerRetryCount']
              seconds = datastore['StagerRetryWait']
          Severity: Major
          Found in modules/payloads/stagers/osx/aarch64/reverse_tcp.rb - About 3 hrs to fix

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

              def on_request_uri(cli, request)
                print_status("Sending #{request.uri} to #{request['User-Agent']}")
                shellcode = Rex::Text.to_num(payload.encoded).gsub(/\r\n/, '')
                jscript = <<~JS
                  var wasm_code = new Uint8Array([0,97,115,109,1,0,0,0,1,133,128,128,128,0,1,96,0,1,127,3,130,128,128,128,0,1,0,4,132,128,128,128,0,1,112,0,0,5,131,128,128,128,0,1,0,1,6,129,128,128,128,0,0,7,145,128,128,128,0,2,6,109,101,109,111,114,121,2,0,4,109,97,105,110,0,0,10,138,128,128,128,0,1,132,128,128,128,0,0,65,42,11])

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

                def initialize(info = {})
                  super(update_info(info,
                    'Name'           => 'HTTPDX tolog() Function Format String Vulnerability',
                    'Description'    => %q{
                        This module exploits a format string vulnerability in HTTPDX FTP server.
              Severity: Major
              Found in modules/exploits/windows/ftp/httpdx_tolog_format.rb - About 3 hrs to fix

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

                  def exploit
                    factory = ssh_socket_factory
                
                    opts = {
                      auth_methods: ['password', 'keyboard-interactive'],
                Severity: Major
                Found in modules/exploits/linux/ssh/vyos_restricted_shell_privesc.rb - About 3 hrs to fix

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

                    def run
                      @credentials = Rex::Text::Table.new(
                        'Header' => 'MSCACHE Credentials',
                        'Indent' => 1,
                        'Columns' =>
                  Severity: Major
                  Found in modules/post/windows/gather/cachedump.rb - About 3 hrs to fix

                    Method do_request_cert has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def do_request_cert(icpr, opts)
                        private_key = OpenSSL::PKey::RSA.new(2048)
                        user = opts[:username] || datastore['SMBUser']
                        status_msg = "Requesting a certificate for user #{user}"
                        alt_dns = opts[:alt_dns] || (datastore['ALT_DNS'].blank? ? nil : datastore['ALT_DNS'])
                    Severity: Major
                    Found in lib/msf/core/exploit/remote/ms_icpr.rb - About 3 hrs to fix

                      Method http_fingerprint has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def http_fingerprint(opts={})
                          res    = nil
                          uri    = opts[:uri] || '/'
                          method = opts[:method] || 'GET'
                      
                      
                      Severity: Major
                      Found in lib/msf/core/exploit/remote/http_client.rb - About 3 hrs to fix

                        Method fingerprint_user_agent has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def fingerprint_user_agent(ua_str)
                        
                            fp = { :ua_string => ua_str }
                        
                            # Guess the browser type based on the user agent
                        Severity: Major
                        Found in lib/msf/core/exploit/remote/http_server.rb - About 3 hrs to fix

                          Method adaudit_plus_login has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def adaudit_plus_login(auth_domain, user = '', pass = '', only_get_cookie = false)
                              cookie_jar.clear # let's start fresh
                          
                              # Visit the default homepage to retrieve some of the baseline cookies needed to authenticate.
                              res_initial_cookies = send_request_cgi({
                          Severity: Major
                          Found in lib/msf/core/exploit/remote/http/manage_engine_adaudit_plus/login.rb - About 3 hrs to fix

                            Method asm_reverse_sctp has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def asm_reverse_sctp(opts={})
                                # TODO: reliability is coming
                                retry_count  = opts[:retry_count]
                                reliable     = opts[:reliable]
                                encoded_port = "%.8x" % [opts[:port].to_i,2].pack("vn").unpack("N").first
                            Severity: Major
                            Found in lib/msf/core/payload/linux/x64/reverse_sctp_x64.rb - About 3 hrs to fix

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

                                def run
                                  last_str = nil
                                  last_inp = nil
                                  last_err = nil
                              
                              
                              Severity: Major
                              Found in modules/auxiliary/fuzzers/smb/smb_negotiate_corrupt.rb and 2 other locations - About 3 hrs to fix
                              modules/auxiliary/fuzzers/smb/smb2_negotiate_corrupt.rb on lines 34..75
                              modules/auxiliary/fuzzers/smb/smb_ntlm1_login_corrupt.rb on lines 37..78

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

                              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 3 locations. Consider refactoring.
                              Open

                                def run
                                  last_str = nil
                                  last_inp = nil
                                  last_err = nil
                              
                              
                              Severity: Major
                              Found in modules/auxiliary/fuzzers/smb/smb2_negotiate_corrupt.rb and 2 other locations - About 3 hrs to fix
                              modules/auxiliary/fuzzers/smb/smb_negotiate_corrupt.rb on lines 33..74
                              modules/auxiliary/fuzzers/smb/smb_ntlm1_login_corrupt.rb on lines 37..78

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

                              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