rapid7/metasploit-framework

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

Summary

Maintainability
D
1 day
Test Coverage

File centreon_pollers_auth_rce.rb has 290 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::CmdStager
  include Msf::Exploit::Remote::HttpClient
Severity: Minor
Found in modules/exploits/linux/http/centreon_pollers_auth_rce.rb - About 2 hrs to fix

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

      def initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'Centreon Poller Authenticated Remote Command Execution',
    Severity: Major
    Found in modules/exploits/linux/http/centreon_pollers_auth_rce.rb - About 2 hrs to fix

      Method execute_command has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def execute_command(command, _opts = {})
          cmd_name = rand_text_alpha(8..42)
          params = { 'p' => '60803', 'type' => '3' }
          poller_name = rand_text_alpha(8..42)
      
      
      Severity: Minor
      Found in modules/exploits/linux/http/centreon_pollers_auth_rce.rb - About 1 hr to fix

        Method create_new_poller has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def create_new_poller(poller_name, command_id)
            params = { 'p' => '60901' }
        
            print_status('Create new poller entry on the target.')
            token = get_token(normalize_uri(target_uri.path, 'main.get.php'), params)
        Severity: Minor
        Found in modules/exploits/linux/http/centreon_pollers_auth_rce.rb - About 1 hr to fix

          Method restart_exportation has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def restart_exportation(poller_id)
              print_status('Reload the poller to trigger exploitation.')
              token = get_token(normalize_uri(target_uri.path, 'main.get.php'), { 'p' => '60902', 'poller' => poller_id })
          
              unless token
          Severity: Minor
          Found in modules/exploits/linux/http/centreon_pollers_auth_rce.rb - About 1 hr to fix

            Method get_auth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def get_auth
                print_status('Sending authentication request.')
                token = get_token(normalize_uri(target_uri.path, 'index.php'))
                unless token.nil?
                  response = send_request_cgi(
            Severity: Minor
            Found in modules/exploits/linux/http/centreon_pollers_auth_rce.rb - About 45 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 restart_exportation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def restart_exportation(poller_id)
                print_status('Reload the poller to trigger exploitation.')
                token = get_token(normalize_uri(target_uri.path, 'main.get.php'), { 'p' => '60902', 'poller' => poller_id })
            
                unless token
            Severity: Minor
            Found in modules/exploits/linux/http/centreon_pollers_auth_rce.rb - About 45 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

            Avoid too many return statements within this method.
            Open

                return true
            Severity: Major
            Found in modules/exploits/linux/http/centreon_pollers_auth_rce.rb - About 30 mins to fix

              Method get_command_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def get_command_id(cmd_name)
                  response = send_request_cgi(
                    'method' => 'GET',
                    'uri' => normalize_uri(target_uri.path, 'main.get.php'),
                    'cookie' => @cookies,
              Severity: Minor
              Found in modules/exploits/linux/http/centreon_pollers_auth_rce.rb - About 25 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 get_poller_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def get_poller_id(poller_name)
                  response = send_request_cgi(
                    'method' => 'GET',
                    'uri' => normalize_uri(target_uri.path, 'main.get.php'),
                    'cookie' => @cookies,
              Severity: Minor
              Found in modules/exploits/linux/http/centreon_pollers_auth_rce.rb - About 25 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