rapid7/metasploit-framework

View on GitHub
modules/exploits/unix/webapp/aerohive_netconfig_lfi_log_poison_rce.rb

Summary

Maintainability
C
1 day
Test Coverage

Method on_new_session has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def on_new_session(session)
    log_cleaned = false
    if auto_clean_log
      print_status('Attempting to clean the log file at /tmp/messages...')
      print_warning('Please note this will render the target (temporarily) unexploitable. This state can last over an hour.')
Severity: Minor
Found in modules/exploits/unix/webapp/aerohive_netconfig_lfi_log_poison_rce.rb - About 3 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 initialize has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Aerohive NetConfig 10.0r8a LFI and log poisoning to RCE',
Severity: Major
Found in modules/exploits/unix/webapp/aerohive_netconfig_lfi_log_poison_rce.rb - About 3 hrs to fix

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

      def on_new_session(session)
        log_cleaned = false
        if auto_clean_log
          print_status('Attempting to clean the log file at /tmp/messages...')
          print_warning('Please note this will render the target (temporarily) unexploitable. This state can last over an hour.')

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

        def check
          res = send_request_cgi({
            'method' => 'GET',
            'uri' => normalize_uri(target_uri.path, 'index.php5')
          })

      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 CheckCode::Unknown("Failed to obtain a valid Aerohive NetConfig version: #{e}")
      Severity: Major
      Found in modules/exploits/unix/webapp/aerohive_netconfig_lfi_log_poison_rce.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return CheckCode::Safe("The target is Aerohive NetConfig version #{version}")
        Severity: Major
        Found in modules/exploits/unix/webapp/aerohive_netconfig_lfi_log_poison_rce.rb - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status