rapid7/metasploit-framework

View on GitHub
modules/exploits/linux/http/apache_nifi_h2_rce.rb

Summary

Maintainability
C
1 day
Test Coverage

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

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Apache NiFi H2 Connection String Remote Code Execution',
Severity: Major
Found in modules/exploits/linux/http/apache_nifi_h2_rce.rb - About 2 hrs to fix

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

      def exploit
        # Check whether login is required and set/fetch token
        if supports_login?
          validate_config
          @token = if datastore['BEARER-TOKEN'].to_s.empty?
    Severity: Minor
    Found in modules/exploits/linux/http/apache_nifi_h2_rce.rb - About 1 hr to fix

      Method configure_dbconpool has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def configure_dbconpool
          # our base64ed payload can't have = in it, so we'll pad out with spaces to remove them
          b64_pe = ::Base64.strict_encode64(payload.encoded)
          equals_count = b64_pe.count('=')
          if equals_count > 0
      Severity: Minor
      Found in modules/exploits/linux/http/apache_nifi_h2_rce.rb - About 1 hr to fix

        Method configure_processor has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def configure_processor
            vprint_status("Configuring processor #{@processor}")
            body = {
              # "disconnectedNodeAcknowledged"=> false,
              'component' => {
        Severity: Minor
        Found in modules/exploits/linux/http/apache_nifi_h2_rce.rb - About 1 hr to fix

          Method exploit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def exploit
              # Check whether login is required and set/fetch token
              if supports_login?
                validate_config
                @token = if datastore['BEARER-TOKEN'].to_s.empty?
          Severity: Minor
          Found in modules/exploits/linux/http/apache_nifi_h2_rce.rb - About 1 hr 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 configure_dbconpool has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def configure_dbconpool
              # our base64ed payload can't have = in it, so we'll pad out with spaces to remove them
              b64_pe = ::Base64.strict_encode64(payload.encoded)
              equals_count = b64_pe.count('=')
              if equals_count > 0
          Severity: Minor
          Found in modules/exploits/linux/http/apache_nifi_h2_rce.rb - About 35 mins 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 check has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def check
              # see apache_nifi_processor_rce check method for details on why this is difficult
          
              @cleanup_required = false
          
          
          Severity: Minor
          Found in modules/exploits/linux/http/apache_nifi_h2_rce.rb - About 35 mins 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

          There are no issues that match your filters.

          Category
          Status