rapid7/metasploit-framework

View on GitHub
modules/exploits/windows/local/anyconnect_lpe.rb

Summary

Maintainability
C
1 day
Test Coverage

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

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Cisco AnyConnect Privilege Escalations (CVE-2020-3153 and CVE-2020-3433)',
Severity: Major
Found in modules/exploits/windows/local/anyconnect_lpe.rb - About 3 hrs to fix

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

      def exploit
        fail_with(Failure::None, 'Session is already elevated') if is_system?
        if !payload.arch.include?(ARCH_X86)
          fail_with(Failure::None, 'Payload architecture is not compatible with this module. Please, select an x86 payload')
        end
    Severity: Major
    Found in modules/exploits/windows/local/anyconnect_lpe.rb - About 2 hrs to fix

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

        def check
          install_path = sanitize_path(datastore['INSTALL_PATH'])
          if install_path&.!= ''
            vprint_status("Skipping installation path detection and use provided path: #{install_path}")
            @installation_path = file_exist?([install_path, 'vpndownloader.exe'].join('\\')) ? install_path : nil
      Severity: Minor
      Found in modules/exploits/windows/local/anyconnect_lpe.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 exploit has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        def exploit
          fail_with(Failure::None, 'Session is already elevated') if is_system?
          if !payload.arch.include?(ARCH_X86)
            fail_with(Failure::None, 'Payload architecture is not compatible with this module. Please, select an x86 payload')
          end
      Severity: Minor
      Found in modules/exploits/windows/local/anyconnect_lpe.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 check has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def check
          install_path = sanitize_path(datastore['INSTALL_PATH'])
          if install_path&.!= ''
            vprint_status("Skipping installation path detection and use provided path: #{install_path}")
            @installation_path = file_exist?([install_path, 'vpndownloader.exe'].join('\\')) ? install_path : nil
      Severity: Minor
      Found in modules/exploits/windows/local/anyconnect_lpe.rb - About 1 hr to fix

        Avoid too many return statements within this method.
        Open

              return CheckCode.Safe("Cisco AnyConnect version #{@ac_version} >= #{patched_version_cve_2020_3433}.")
        Severity: Major
        Found in modules/exploits/windows/local/anyconnect_lpe.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return CheckCode.Safe("Cisco AnyConnect version #{@ac_version} >= #{patched_version_cve_2020_3153} (However CVE-2020-3433 can be used).")
          Severity: Major
          Found in modules/exploits/windows/local/anyconnect_lpe.rb - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status