rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

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

  def check
    begin
      # authorization header required, see https://github.com/rapid7/metasploit-framework/pull/6433#r56764179
      # after a chat with @bcoles in IRC.
      res = send_request_cgi(
Severity: Minor
Found in modules/exploits/linux/http/ipfire_oinkcode_exec.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 leak_api_key has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def leak_api_key(*path_parts)
    path = normalize_uri(path_parts)

    print_status("Leaking API key from #{path}")

Severity: Minor
Found in modules/exploits/linux/http/cisco_ucs_cloupia_script_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 deeply nested control flow statements.
Open

          next unless (round3_byte_array[i] == keystr2_byte_array[j])
Severity: Major
Found in modules/exploits/linux/http/zyxel_lfi_unauth_ssh_rce.rb - About 45 mins to fix

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

      def telnet_prompt_wait(error_regex = nil)
        begin
          result = read_until(@telnet_sock, @telnet_timeout, @telnet_prompt)
          if error_regex
            error_regex = [error_regex] unless error_regex.is_a? Array
    Severity: Minor
    Found in modules/exploits/linux/http/huawei_hg532n_cmdinject.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 deeply nested control flow statements.
    Open

            if Rex::Version.new(phpversion) < Rex::Version.new('5.6.39')
              vprint_good("PHP Version #{phpversion} is vulnerable")
              return CheckCode::Appears
            else
              vprint_bad("PHP Version #{phpversion} is NOT vulnerable, patched in 5.6.39.")
    Severity: Major
    Found in modules/exploits/linux/http/php_imap_open_rce.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

            unless res
              print_error('Error loading site.  Check options.')
              return
            end
      Severity: Major
      Found in modules/exploits/linux/http/php_imap_open_rce.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

              if res.code == 302
                cookie = res.get_cookies
                print_good('Login Success')
              else
                print_error('Failed Login, check options.')
        Severity: Major
        Found in modules/exploits/linux/http/php_imap_open_rce.rb - About 45 mins to fix

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

            def brute_force
              print_status('Beginning brute forcing...')
              # Attempt to get a new session cookie with an LED puzzle tied to it.
              res = send_request_cgi(
                'method' => 'GET',
          Severity: Minor
          Found in modules/exploits/linux/http/pineapple_preconfig_cmdinject.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 deeply nested control flow statements.
          Open

                if /name='e-token' value='(?<etoken>\w{32})'/ =~ res.body && /_system::procEmailBounce.+?cron_execute\[(?<cron_id>\d)\]/m =~ res.body
                  print_good("Triggering manual run of mail bounch check cron to execute payload with cron id #{cron_id} and etoken #{etoken}")
                  # The post request has several duplicate columns, however all were not required.  Left them commented for documentation purposes
                  send_request_cgi(
                    'method' => 'POST',
          Severity: Major
          Found in modules/exploits/linux/http/php_imap_open_rce.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                elsif target.name =~ /custom/
                  print_status('Listener started for 300 seconds')
                  print_good("POST request connection string: x #{command}}")
                  # URI.encode leaves + as + since that's a space encoded.  So we manually change it.
                  print_good("GET request connection string: #{URI::DEFAULT_PARSER.escape("x " + command + "}").sub! '+', '%2B'}")
            Severity: Major
            Found in modules/exploits/linux/http/php_imap_open_rce.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                    if res.body.include? 'Status: <b>Disabled</b>'
                      print_error('Cron disabled, unexploitable.')
                      return
                    end
              Severity: Major
              Found in modules/exploits/linux/http/php_imap_open_rce.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                      unless res
                        print_error('Error loading site.  Check options.')
                        return
                      end
                Severity: Major
                Found in modules/exploits/linux/http/php_imap_open_rce.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                        unless res
                          print_error('Error loading site.  Check options.')
                          return
                        end
                  Severity: Major
                  Found in modules/exploits/linux/http/php_imap_open_rce.rb - About 45 mins to fix

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

                      def select_metric
                        # check if any metrics have been configured. if not, exploitation cannot work
                        res = send_request_cgi({
                          'method' => 'GET',
                          'uri' => normalize_uri(target_uri.path, 'suggest'),
                    Severity: Minor
                    Found in modules/exploits/linux/http/opentsdb_key_cmd_injection.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 select_aggregator has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def select_aggregator
                        # check the configured aggregators and select one at random
                        res = send_request_cgi({
                          'method' => 'GET',
                          'uri' => normalize_uri(target_uri.path, 'aggregators')
                    Severity: Minor
                    Found in modules/exploits/linux/http/opentsdb_key_cmd_injection.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 login has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def login
                        login_uri = normalize_uri(target_uri.path, 'login')
                        res = send_request_cgi('method' =>  'GET', 'uri'  =>  login_uri)
                        fail_with(Failure::NotFound, 'Failed to access the login page') unless res && res.code == 200
                    
                    
                    Severity: Minor
                    Found in modules/exploits/linux/http/librenms_addhost_cmd_inject.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 check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def check
                        print_status("Checking if #{peer} can be exploited!")
                        res = send_request_cgi(
                          'uri' => normalize_uri(datastore['TARGETURI'], 'favicon.ico'),
                          'method' => 'GET'
                    Severity: Minor
                    Found in modules/exploits/linux/http/majordomo_cmd_inject_cve_2023_50917.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 check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def check
                        res = create_user(role: 'Guest')
                        return CheckCode::Unknown('No response received from target.') unless res
                        return CheckCode::Safe('Failed to create the user.') unless res.code == 200
                    
                    
                    Severity: Minor
                    Found in modules/exploits/linux/http/f5_bigip_tmui_rce_cve_2023_46747.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 deal_with_failure_by_mode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def deal_with_failure_by_mode(mode, message, status)
                        return [false, "#{message}. Manual cleanup is required."] if mode == 'cleanup'
                    
                        case status
                        when 'disconnected'
                    Severity: Minor
                    Found in modules/exploits/linux/http/opennms_horizon_authenticated_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 deeply nested control flow statements.
                    Open

                              @my_target = targets[1] if target['auto']
                    Severity: Major
                    Found in modules/exploits/linux/http/dlink_hnap_bof.rb - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language