rapid7/metasploit-framework

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

Summary

Maintainability
C
1 day
Test Coverage

File bypassuac_injection_winsxs.rb has 341 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

  include Exploit::EXE
  include Exploit::FileDropper
Severity: Minor
Found in modules/exploits/windows/local/bypassuac_injection_winsxs.rb - About 4 hrs to fix

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

      def initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'Windows Escalate UAC Protection Bypass (In Memory Injection) abusing WinSXS',
    Severity: Minor
    Found in modules/exploits/windows/local/bypassuac_injection_winsxs.rb - About 1 hr to fix

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

        def exploit
          # Validate that we can actually do things before we bother
          # doing any more work
          validate_environment!
          check_permissions!
      Severity: Minor
      Found in modules/exploits/windows/local/bypassuac_injection_winsxs.rb - About 1 hr to fix

        Method validate_environment! has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def validate_environment!
            fail_with(Failure::None, 'Already in elevated state') if is_admin? || is_system?
        
            version = get_version_info
            if (!version.windows_server? && version.build_number >= Msf::WindowsVersion::Win8) ||
        Severity: Minor
        Found in modules/exploits/windows/local/bypassuac_injection_winsxs.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 get_directories has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def get_directories(payload_filepath, targetedDirectories)
            directoryNames = []
            findFileDataSize = 592
            maxPath = client.railgun.const('MAX_PATH')
            fileNamePadding = 44
        Severity: Minor
        Found in modules/exploits/windows/local/bypassuac_injection_winsxs.rb - About 1 hr to fix

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

            def bypass_dll_path
              path = ::File.join(Msf::Config.data_directory, 'post')
          
              sysarch = sysinfo['Architecture']
              if sysarch == ARCH_X86
          Severity: Minor
          Found in modules/exploits/windows/local/bypassuac_injection_winsxs.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 removal_checking has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def removal_checking(droppedElements)
              successfullyRemoved = true
          
              droppedElements.each do |element|
                stat = session.fs.file.stat(element)
          Severity: Minor
          Found in modules/exploits/windows/local/bypassuac_injection_winsxs.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