rapid7/metasploit-framework

View on GitHub

Showing 21,886 of 21,886 total issues

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

  def exploit
    if is_system?
      fail_with(Failure::None, 'Session is already elevated')
    end

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

            break if session_created?
Severity: Major
Found in modules/exploits/windows/local/ikeext_service.rb - About 45 mins to fix

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

      def write_reg_keys(image_file, payload_pathname)
        reg_keys = []
        reg_keys.push(key_name: "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\#{image_file}",
                      value_name: "GlobalFlag",
                      type: "REG_DWORD",
    Severity: Minor
    Found in modules/exploits/windows/local/persistence_image_exec_options.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 reload_config has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def reload_config(token)
        print_status('Reloading Application . . .')
    
        send_request_cgi({
          'method' => 'GET',
    Severity: Minor
    Found in modules/exploits/windows/local/nscp_pe.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 exploit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def exploit
        temp_dir = ""
    
        print_status("Opening named pipe...")
        handle = open_named_pipe("\\\\.\\pipe\\acsipc_server")
    Severity: Minor
    Found in modules/exploits/windows/local/agnitum_outpost_acs.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 cve_2020_1048_privileged_filecopy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def cve_2020_1048_privileged_filecopy(destination_file, source_file, exploit_path, target_arch, force_exploit: false)
        # Upload Exploit
        if target_arch == ARCH_X86
          vprint_status('Using x86 binary')
          exploit_bin = exploit_data('CVE-2020-1048', 'cve-2020-1048-exe.Win32.exe')
    Severity: Minor
    Found in modules/exploits/windows/local/cve_2020_1048_printerdemon.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_permissions! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def check_permissions!
        unless check == Exploit::CheckCode::Appears
          fail_with(Failure::NotVulnerable, 'Target is not vulnerable.')
        end
        fail_with(Failure::None, 'Already in elevated state') if is_admin? || is_system?
    Severity: Minor
    Found in modules/exploits/windows/local/bypassuac_sluihijack.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 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

    Avoid deeply nested control flow statements.
    Open

                break if session_created?
    Severity: Major
    Found in modules/exploits/windows/local/webexec.rb - About 45 mins to fix

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

        def check_permissions!
          unless check == Exploit::CheckCode::Appears
            fail_with(Failure::NotVulnerable, 'Target is not vulnerable.')
          end
          fail_with(Failure::None, 'Already in elevated state') if is_admin? || is_system?
      Severity: Minor
      Found in modules/exploits/windows/local/bypassuac_dotnet_profiler.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 get_dotnet_path has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def get_dotnet_path(windir)
          base_path = "#{windir}\\Microsoft.NET\\Framework#{payload.arch.first == ARCH_X86 ? '' : '64'}"
          paths = dir(base_path).select { |p| p[0] == 'v' }
          dotnet_path = nil
      
      
      Severity: Minor
      Found in modules/exploits/windows/local/applocker_bypass.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 exploit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def exploit
          unless is_system? || is_admin?
            print_error("Insufficient privileges to create service")
            return
          end
      Severity: Minor
      Found in modules/exploits/windows/local/persistence_service.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 exploit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def exploit
         unless have_powershell?
            print_error("This module requires powershell to run")
            return
         end
      Severity: Minor
      Found in modules/exploits/windows/local/wmi_persistence.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_info has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def leak_info
          file_contents = read_file(datastore['FILE'])
          return unless file_contents
      
          a = file_contents.split("\n")
      Severity: Minor
      Found in modules/exploits/windows/local/nscp_pe.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 exploit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def exploit
          # Things to note:
          # 1. xp_cmdshell is disabled by default so first we must enable it.
          # 2. The application takes the SQL statement we inject into and converts it all to upper case. This was causing
          # attempted Base64 encoded payloads to fail, and is why we send the payload has a hex string and decode it using SQL
      Severity: Minor
      Found in modules/exploits/windows/http/forticlient_ems_fctid_sqli.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 reload_config has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def reload_config(token)
          print_status('Reloading Application . . .')
      
          send_request_cgi({
            'method' => 'GET',
      Severity: Minor
      Found in modules/exploits/windows/http/nscp_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

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

        def check
          res = send_request_cgi(
            'method' => 'GET',
            'uri'    => '/'
          )
      Severity: Minor
      Found in modules/exploits/windows/http/disksorter_bof.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 exploit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def exploit
          # Make sure we meet the requirements before running the script
          unless have_powershell?
            fail_with(Failure::BadConfig, 'PowerShell not found')
          end
      Severity: Minor
      Found in modules/exploits/windows/local/ps_wmi_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 exploit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def exploit
          print_status("Searching for valid command execution point...")
          x = false
          until (x)
            x, y, z = find_exec
      Severity: Minor
      Found in modules/exploits/windows/iis/msadc.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 auth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def auth(my_target)
          # Version XG performs MD5 validation on wf_CSRF_token parameter. We can't simply use PHPSESSID directly because it contains a-zA-Z0-9.
          # Beside that, version 11 use PHPSESSID value as a csrf token. Thus, we are manually crafting the cookie.
          if my_target.name == 'OfficeScan XG'
            csrf_token = build_csrftoken(my_target)
      Severity: Minor
      Found in modules/exploits/windows/http/trendmicro_officescan_widget_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

      Severity
      Category
      Status
      Source
      Language