rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

File struts2_namespace_ognl.rb has 386 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::EXE
Severity: Minor
Found in modules/exploits/multi/http/struts2_namespace_ognl.rb - About 5 hrs to fix

    Method report_creds has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def report_creds(opts)
        ip = opts[:ip] || rhost
        user = opts[:user] || nil
        domain = opts[:domain] || nil
        ntlm_ver = opts[:ntlm_ver] || nil
    Severity: Minor
    Found in modules/auxiliary/server/capture/http_ntlm.rb - About 5 hrs 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 run has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        res = send_request_cgi({
          'uri' => normalize_uri(target_uri.path, 'agentHandler'),
          'method' =>'GET',
          'vars_get' => {
    Severity: Minor
    Found in modules/auxiliary/gather/eventlog_cred_disclosure.rb - About 5 hrs 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 run has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        requests = datastore['REQUESTS']
        backends = []
        cookie_name = ''
        pool_name = ''
    Severity: Minor
    Found in modules/auxiliary/gather/f5_bigip_cookie_disclosure.rb - About 5 hrs 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 run_host has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def run_host(ip)
    
        unless wordpress_and_online?
          print_error("#{target_uri} does not seem to be WordPress site")
          return
    Severity: Minor
    Found in modules/auxiliary/scanner/http/wordpress_login_enum.rb - About 5 hrs 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 run_host has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def run_host(ip)
        # Get the available SSL/TLS versions that that Metasploit host supports
        versions = get_metasploit_ssl_versions
    
        certs_found = {}
    Severity: Minor
    Found in modules/auxiliary/scanner/ssl/ssl_version.rb - About 5 hrs 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 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def exploit
        admin_creds = nil
        is_windows = nil
        loop do
          print_status('Downloading the session file')
    Severity: Minor
    Found in modules/exploits/multi/http/crushftp_rce_cve_2023_43177.rb - About 5 hrs 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 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def exploit
        # Sanity check the USERNAME and PASSWORD will meet the servers password requirements.
        fail_with(Failure::BadConfig, 'USERNAME must not be empty.') if datastore['USERNAME'].empty?
        fail_with(Failure::BadConfig, 'PASSWORD must be 8 characters of more.') if datastore['PASSWORD'].length < 8
    
    

    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 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def exploit
        # Generate the ASP containing the EXE containing the payload
        exe  = generate_payload_exe
        asp  = Msf::Util::EXE.to_exe_asp(exe)
        path = datastore['PATH'].gsub('%RAND%', rand(0x10000000).to_s)
    Severity: Minor
    Found in modules/exploits/windows/iis/iis_webdav_upload_asp.rb - About 5 hrs 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 serial_num_method3 has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def serial_num_method3(serial_number)
        # SerialNumMethod3 password derivation function
    
        # constant definitions
        keystr1_byte_array = 'IO'.bytes.to_a
    Severity: Minor
    Found in modules/exploits/linux/http/zyxel_lfi_unauth_ssh_rce.rb - About 5 hrs 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 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def check
        res = send_request_cgi(
          'method' => 'GET',
          'keep_cookies' => true,
          'uri' => normalize_uri(target_uri.path, 'login')
    Severity: Minor
    Found in modules/exploits/linux/http/bitbucket_git_cmd_injection.rb - About 5 hrs 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_pidgin_creds has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_pidgin_creds(paths)
        case paths
        when /#{@user}\\(.*)\\/
          sys_user = ::Regexp.last_match(1)
        when %r{home/(.*)/}
    Severity: Minor
    Found in modules/post/multi/gather/pidgin_cred.rb - About 5 hrs 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_bookmarks has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_bookmarks(browser)
        file_exists = false # initializes file as not found
        grab_user_profiles.each do |user| # parses information for all users on target machine into a list.
          # If the browser is Google Chrome or Edge is searches the "AppData\Local directory, if it is Opera, it searches the AppData\Roaming directory"
          if (browser == 'GoogleChrome')
    Severity: Minor
    Found in modules/post/windows/gather/get_bookmarks.rb - About 5 hrs 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 is_hash_from_empty_pwd? has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.is_hash_from_empty_pwd?(arg)
        hash_type = arg[:type]
        raise ArgumentError,"arg[:type] is mandatory" if not hash_type
        raise ArgumentError,"arg[:type] must be lm or ntlm" if not hash_type  =~ /^((lm)|(ntlm))$/
    
    
    Severity: Minor
    Found in lib/rex/proto/ntlm/crypt.rb - About 5 hrs 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 wsloop has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        def wsloop(opts = {}, &block)
          buffer = ''
          buffer_type = nil
    
          # since web sockets have their own tear down exchange, use a synchronization lock to ensure we aren't closed until
    Severity: Minor
    Found in lib/rex/proto/http/web_socket.rb - About 5 hrs 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 cmd_pivot has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def cmd_pivot(*args)
        if args.length == 0 || args.include?('-h')
          cmd_pivot_help
          return true
        end
    Severity: Minor
    Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb - About 5 hrs 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 download_file has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def File.download_file(dest_file, src_file, opts = {}, &stat)
        stat ||= lambda { |a,b,c| }
    
        adaptive = opts["adaptive"]
        block_size = opts["block_size"] || 1024 * 1024
    Severity: Minor
    Found in lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb - About 5 hrs 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 cmd_klist has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def cmd_klist(*args)
        return unless active?
    
        entries_affected = 0
        mode = :list
    Severity: Minor
    Found in lib/msf/ui/console/command_dispatcher/db/klist.rb - About 5 hrs 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 import_msf_zip has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def import_msf_zip(args={}, &block)
        data = args[:data]
        wspace = Msf::Util::DBManager.process_opts_workspace(args, framework)
        bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []
    
    
    Severity: Minor
    Found in lib/msf/core/db_manager/import/metasploit_framework/zip.rb - About 5 hrs 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 report_web_site has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

      def report_web_site(opts)
        return if not active
      ::ApplicationRecord.connection_pool.with_connection { |conn|
        opts = opts.clone() # protect the original caller's opts
        wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)
    Severity: Minor
    Found in lib/msf/core/db_manager/web.rb - About 5 hrs 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