rapid7/metasploit-framework

View on GitHub

Showing 21,886 of 21,886 total issues

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

  def setup
    super

    @file = File.binread(datastore['STYLE_FILE'])
    begin
Severity: Minor
Found in modules/exploits/windows/fileformat/theme_dll_hijack_cve_2023_38146.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_random_spray has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def get_random_spray(t, js_code, js_nops, js_90_nops, js_counter, js_stack_pivot)
Severity: Minor
Found in modules/exploits/windows/browser/oracle_autovue_setmarkupmode.rb - About 45 mins to fix

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

      def unpack_docx(template_path)
        document = []
    
        Zip::File.open(template_path) do |entries|
          entries.each do |entry|
    Severity: Minor
    Found in modules/exploits/windows/fileformat/word_msdtjs_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 process_get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def process_get(cli, request)
        myhost = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(cli.peerhost) : datastore['SRVHOST']
        webdav = "\\\\#{myhost}\\"
    
        if (request.uri =~ /vmhgfs\.dll$/i)
    Severity: Minor
    Found in modules/exploits/windows/misc/vmhgfs_webdav_dll_sideload.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 create_simple_smb_client! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def create_simple_smb_client!
        if session
          print_status("Using existing session #{session.sid}")
          client = session.client
          self.simple = ::Rex::Proto::SMB::SimpleClient.new(client.dispatcher.tcp_socket, client: client)
    Severity: Minor
    Found in modules/exploits/windows/smb/psexec.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
        # [in] [unique] wchar *
        # [in] [unique] wchar *
        # [out] long
    
    
    Severity: Minor
    Found in modules/exploits/windows/smb/ms06_066_nwwks.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

                    if l.include? 'VERSION="'
                      number = l.split("=")[1].split('"')[1]
                      if number.match /(\d+\.)?(\d+\.)?(\d+\.)?(\*|\d+)$/
                        if number <= '8.1.1.50' and not number < '7'
                          return Exploit::CheckCode::Appears
    Severity: Major
    Found in modules/exploits/windows/misc/ahsay_backup_fileupload.rb - About 45 mins to fix

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

        def exploit
          print_status( "Connecting to the target (#{datastore['RHOST']}:#{datastore['RPORT']})..." )
          connect
      
          # we use ReadAddress to avoid problems in srv2!SrvProcCompleteRequest
      Severity: Minor
      Found in modules/exploits/windows/smb/ms09_050_smb2_negotiate_func_index.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
          validate_service_stub_encoder!
      
          # automatically select an SMB share unless one is explicitly specified
          if datastore['SMBSHARE'] && !datastore['SMBSHARE'].blank?
      Severity: Minor
      Found in modules/exploits/windows/smb/psexec.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
          checkcode = CheckCode::Unknown
      
          res = send_request_cgi(
            'method' => 'GET',
      Severity: Minor
      Found in modules/exploits/linux/upnp/belkin_wemo_upnp_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 check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def check
          kernel_core_pattern = cmd_exec 'grep abrt-hook-ccpp /proc/sys/kernel/core_pattern'
          unless kernel_core_pattern.include? 'abrt-hook-ccpp'
            vprint_error 'System is not configured to use ABRT for crash reporting'
            return CheckCode::Safe
      Severity: Minor
      Found in modules/exploits/linux/local/abrt_sosreport_priv_esc.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_ld_so_build_id_perf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def check_ld_so_build_id_perf
          perf_cmd_output = ''
      
          # This needs to be split up by distro as Ubuntu has readlink and which installed by default but "ld.so" is not
          # defined on the path like it is on Debian. Also Ubuntu doesn't have ldconfig install by default.
      Severity: Minor
      Found in modules/exploits/linux/local/glibc_tunables_priv_esc.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
          # Check if we're already root
          if is_root? && !datastore['ForceExploit']
            fail_with Failure::BadConfig, 'Session already has root privileges. Set ForceExploit to override'
          end
      Severity: Minor
      Found in modules/exploits/linux/local/tomcat_rhel_based_temp_priv_esc.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_userspec has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def exploit_userspec(resolved_target)
          fail_with(Failure::BadConfig, 'The "NewUser" advanced option must be specified for this target') if datastore['NewUser'].blank?
      
          python_binary = find_exec_program
          fail_with(Failure::NotFound, 'The python binary was not found') unless python_binary
      Severity: Minor
      Found in modules/exploits/linux/local/sudo_baron_samedit.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_nss has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def exploit_nss(resolved_target)
          if target.name == 'Manual'
            fail_with(Failure::BadConfig, 'The "Lengths" advanced option must be specified for the manual target') if datastore['Lengths'].blank?
            exploit_params = datastore['Lengths'].gsub(/,/, ' ').gsub(/  +/, ' ')
          else
      Severity: Minor
      Found in modules/exploits/linux/local/sudo_baron_samedit.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 magic_packet has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def magic_packet(mac, username, password)
          mac = mac.gsub(/[:-]/, '').upcase
      
          if mac.length != 12
            fail_with(Failure::BadConfig, 'MAC must be 12 bytes without : or -')
      Severity: Minor
      Found in modules/exploits/linux/telnet/netgear_telnetenable.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_ld_so_build_id_readelf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def check_ld_so_build_id_readelf
          file_cmd_output = ''
      
          # This needs to be split up by distro as Ubuntu has readlink and which installed by default but "ld.so" is not
          # defined on the path like it is on Debian. Also Ubuntu doesn't have ldconfig install by default.
      Severity: Minor
      Found in modules/exploits/linux/local/glibc_tunables_priv_esc.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
          if !datastore['ForceExploit'] && is_root?
            fail_with(Failure::BadConfig, 'Session already has root privileges. Set ForceExploit to override.')
          end
      
      
      Severity: Minor
      Found in modules/exploits/linux/local/lastore_daemon_dbus_priv_esc.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
          # Sanity check
          if is_root?
            fail_with(Failure::None, 'Session already has root privileges')
          end
      Severity: Minor
      Found in modules/exploits/linux/local/zimbra_postfix_priv_esc.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_ld_so_build_id_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def check_ld_so_build_id_file
          file_cmd_output = ''
      
          # This needs to be split up by distro as Ubuntu has readlink and which installed by default but "ld.so" is not
          # defined on the path like it is on Debian. Also Ubuntu doesn't have ldconfig install by default.
      Severity: Minor
      Found in modules/exploits/linux/local/glibc_tunables_priv_esc.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