rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

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 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 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 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 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 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 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
       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 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 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 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 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 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 authenticate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def authenticate
        if datastore['USERNAME'].blank? && datastore['PASSWORD'].blank?
          fail_with(Failure::BadConfig, 'Please set the USERNAME and PASSWORD options')
        end
    
    
    Severity: Minor
    Found in modules/exploits/windows/http/ivanti_avalanche_filestoreconfig_upload.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' => normalize_uri(target_uri.path)
        })
    Severity: Minor
    Found in modules/exploits/windows/http/hpe_sim_76_amf_deserialization.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

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

      def exploit
        print_status("Trying target #{target.name}...")
    
        install_path = get_install_path
        install_path << "help\\English_United States.1252"
    Severity: Minor
    Found in modules/exploits/windows/http/hp_nnm_ovbuildpath_textfile.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
    
        mytarget = target
    
        if (target.name =~ /Automatic/)
    Severity: Minor
    Found in modules/exploits/windows/http/altn_webadmin.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