rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

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

  def run
    @port = datastore['SRVPORT'].to_i

    @log_console  = false
    @log_database = false
Severity: Major
Found in modules/auxiliary/server/fakedns.rb - About 5 hrs to fix

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

      def self.create_library(constant_manager, library_path = 'netapi32')
        dll = Library.new(library_path, constant_manager)
    
        dll.add_function('NetApiBufferFree','DWORD',[
          ["LPVOID","Buffer","in"]

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

        def init
          payload = "\x00\x5a\x00\x02"
          sendframe(makeframe(payload))
          payload = "\x00\x5a\x00\x01\x00"
          sendframe(makeframe(payload))
      Severity: Major
      Found in modules/auxiliary/admin/scada/modicon_stux_transfer.rb and 1 other location - About 5 hrs to fix
      modules/auxiliary/admin/scada/modicon_command.rb on lines 75..150

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

      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

            case ntlm_ver
            when NTLM_CONST::NTLM_V1_RESPONSE
              if NTLM_CRYPT::is_hash_from_empty_pwd?({:hash => [nt_hash].pack("H*"),:srv_challenge => @challenge,
                      :ntlm_ver => NTLM_CONST::NTLM_V1_RESPONSE, :type => 'ntlm' })
                print_status("NLMv1 Hash correspond to an empty password, ignoring ... ")
      Severity: Major
      Found in modules/auxiliary/server/capture/http_ntlm.rb and 1 other location - About 5 hrs to fix
      modules/auxiliary/server/capture/mssql.rb on lines 177..224

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

      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

            case ntlm_ver
            when NTLM_CONST::NTLM_V1_RESPONSE
              if NTLM_CRYPT::is_hash_from_empty_pwd?({:hash => [nt_hash].pack("H*"),:srv_challenge => @challenge,
                :ntlm_ver => NTLM_CONST::NTLM_V1_RESPONSE, :type => 'ntlm' })
                print_status("NLMv1 Hash correspond to an empty password, ignoring ... ")
      Severity: Major
      Found in modules/auxiliary/server/capture/mssql.rb and 1 other location - About 5 hrs to fix
      modules/auxiliary/server/capture/http_ntlm.rb on lines 232..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 196.

      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 init
          payload = "\x00\x5a\x00\x02"
          sendframe(makeframe(payload))
          payload = "\x00\x5a\x00\x01\x00"
          sendframe(makeframe(payload))
      Severity: Major
      Found in modules/auxiliary/admin/scada/modicon_command.rb and 1 other location - About 5 hrs to fix
      modules/auxiliary/admin/scada/modicon_stux_transfer.rb on lines 111..186

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

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

        def get_upload_data(opts = {})
          boundary = opts[:boundary]
          version = opts[:version]
          war = opts[:war]
          app_base = opts[:app_base]
      Severity: Major
      Found in modules/exploits/multi/http/glassfish_deployer.rb - About 5 hrs to fix

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

          def exploit
            # first let's check if SRVHOST is valid
            if datastore['SRVHOST'] == '0.0.0.0'
              fail_with(Failure::Unknown, 'Please enter a valid IP address for SRVHOST')
            end
        Severity: Major
        Found in modules/exploits/multi/misc/ibm_tm1_unauth_rce.rb - About 5 hrs to fix

          Method vbs_prepare has 148 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def vbs_prepare()
              code = %Q|
          dim   aa()
          dim   ab()
          dim   a0
          Severity: Major
          Found in modules/exploits/windows/browser/ms14_064_ole_code_execution.rb - About 5 hrs to fix

            Method run has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

              def run
                packet = prepare_packet(true)
            
                sock = connect
                if sock.nil?
            Severity: Minor
            Found in modules/auxiliary/gather/trackit_sql_domain_creds.rb - About 5 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 start_listener has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

              def start_listener(dsthosts_cache, srchosts_cache)
            
                if datastore['BIDIRECTIONAL']
                  args = {:BIDIRECTIONAL => true,  :dhosts => dsthosts_cache.dup, :shosts => srchosts_cache.dup}
                else
            Severity: Minor
            Found in modules/auxiliary/spoof/arp/arp_poisoning.rb - About 5 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 run has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

              def run
                if ! @telephony_loaded
                  print_error("The Telephony module is not available: #{@telephony_error}")
                  raise RuntimeError, "Telephony not available"
                end
            Severity: Minor
            Found in modules/auxiliary/scanner/telephony/wardial.rb - About 5 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 exploit has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

              def exploit
                unless [CheckCode::Vulnerable].include? check
                  fail_with Failure::NotVulnerable, 'Target is most likely not vulnerable!'
                end
            
            
            Severity: Minor
            Found in modules/exploits/multi/http/solr_velocity_rce.rb - About 5 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 exploit has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

              def exploit
                vprint_status('Trying to login...')
                # Application Login
                res_auth = send_request_cgi(
                  'method' => 'POST',
            Severity: Minor
            Found in modules/exploits/multi/http/uptime_file_upload_2.rb - About 5 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 exploit has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

              def exploit
                # first let's check if SRVHOST is valid
                if datastore['SRVHOST'] == '0.0.0.0'
                  fail_with(Failure::Unknown, 'Please enter a valid IP address for SRVHOST')
                end
            Severity: Minor
            Found in modules/exploits/multi/misc/ibm_tm1_unauth_rce.rb - About 5 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 get_enable has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

              def get_enable(enable_pass, pass_file)
                if enable_pass
                  found = false
                  session.shell_command('enable').to_s.strip
                  en_out = session.shell_command(enable_pass)
            Severity: Minor
            Found in modules/post/networking/gather/enum_cisco.rb - About 5 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 run has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

              def run
                fail_with(Failure::BadConfig, 'Please specify an action.') if action.nil?
            
                if datastore['XCHAT']
                  get_paths('XCHAT').each do |base|
            Severity: Minor
            Found in modules/post/multi/gather/enum_hexchat.rb - About 5 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 get_secret has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

              def get_secret(lsa_key)
                output = "\n"
            
                # LSA Secret key location within the registry
                root_regkey = 'HKLM\\Security\\Policy\\Secrets\\'
            Severity: Minor
            Found in modules/post/windows/gather/lsa_secrets.rb - About 5 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 match_processes has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

              def match_processes(processes, args, quiet: false)
            
                search_proc = nil
                search_user = nil
                exact_match = false
            Severity: Minor
            Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb - About 5 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 valid_rpc_response? has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

                def valid_rpc_response?(response)
                  # validate response is an object
                  return false unless response.is_a?(Hash)
            
                  JSON_RPC_RESPONSE_REQUIRED_MEMBERS.each do |member|
            Severity: Minor
            Found in lib/msf/core/rpc/json/request.rb - About 5 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