rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

Avoid deeply nested control flow statements.
Open

            if pos == 0
              if !startnum
                answer += '0'
              end
            else
Severity: Major
Found in modules/auxiliary/admin/http/webnms_cred_disclosure.rb - About 45 mins to fix

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

      def run
        return unless check == Exploit::CheckCode::Vulnerable
    
        begin
          print_status("Starting the password reset for #{datastore['USERNAME']}...")
    Severity: Minor
    Found in modules/auxiliary/admin/http/hikvision_unauth_pwd_reset_cve_2017_7921.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 read_mdb_sts_block has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def read_mdb_sts_block(file_name, chunk_size, offset)
        bytes = nil
        file = File.open(file_name, 'rb')
        while offset <= file.size - chunk_size
          buf = File.binread(file, chunk_size, offset + 1)
    Severity: Minor
    Found in modules/auxiliary/admin/vmware/vcenter_offline_mdb_extract.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_keypair has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def create_keypair(creds)
        action = 'ImportKeyPair'
        doc = call_ec2(creds, 'Action' => action, 'KeyName' => datastore['KEY_NAME'], 'PublicKeyMaterial' => Rex::Text.encode_base64(datastore['SSH_PUB_KEY']))
        if doc['Response'].nil?
          doc = print_results(doc, action)
    Severity: Minor
    Found in modules/auxiliary/admin/aws/aws_launch_instances.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 init_vsphere_login has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def init_vsphere_login
        res = send_request_cgi({
          'uri' => '/ui/login',
          'method' => 'GET'
        })
    Severity: Minor
    Found in modules/auxiliary/admin/vmware/vcenter_forge_saml_token.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        path = datastore['PATH']
        # Always make sure there is a starting slash so as an user,
        # we don't need to worry about it.
        path = "/#{path}" if path && path[0] != '/'
    Severity: Minor
    Found in modules/auxiliary/admin/http/ulterius_file_download.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 run_host has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def run_host(_ip)
        vprint_status('Obtaining CSRF token')
        res = send_request_cgi(
          'method' => 'GET',
          'keep_cookies' => true,
    Severity: Minor
    Found in modules/auxiliary/admin/http/gitlab_password_reset_account_takeover.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 run_host has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def run_host(_ip)
        @files_found = []
    
        begin
          print_status("Attempting to connect to #{rhost}:#{rport}")
    Severity: Minor
    Found in modules/auxiliary/admin/http/tomcat_utf8_traversal.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 save_downloaded_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def save_downloaded_file
        print_status "Saving #{remote_file} as '#{file}'"
        fh = @tftp_client.recv_tempfile
        data = File.open(fh,"rb") {|f| f.read f.stat.size} rescue nil
        if data and not data.empty?
    Severity: Minor
    Found in modules/auxiliary/admin/tftp/tftp_transfer_util.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
        bind_to_netlogon_service
    
        status = nil
        2000.times do
    Severity: Minor
    Found in modules/auxiliary/admin/dcerpc/cve_2020_1472_zerologon.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        check_pcaprub_loaded # Check first
        # Load all of our existing protocols
        load_protocols
    
    
    Severity: Minor
    Found in modules/auxiliary/sniffer/psnuffle.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 describe_ec2_instance has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def describe_ec2_instance(inst)
        print_good "  #{inst.id} (#{inst.state.name})"
        print_good "    Creation Date:  #{inst.launch_time}"
        print_good "    Public IP:      #{inst.public_ip_address} (#{inst.public_dns_name})"
        print_good "    Private IP:     #{inst.private_ip_address} (#{inst.private_dns_name})"
    Severity: Minor
    Found in modules/auxiliary/cloud/aws/enum_ec2.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 fingerprint has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def fingerprint
        memory_to_use = fingerprint_step
        # try out the available memory in steps
        # apache will return a server error if the limit is reached
        while memory_to_use < 1024
    Severity: Minor
    Found in modules/auxiliary/dos/http/wordpress_xmlrpc_dos.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 build_tls_fragment has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def build_tls_fragment(type, length, seq, frag_offset, frag_length, frag_body=nil)
    Severity: Minor
    Found in modules/auxiliary/dos/ssl/dtls_fragment_overflow.rb - About 45 mins to fix

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

        def run_host(ip)
          to = (datastore['TIMEOUT'].zero?) ? 30 : datastore['TIMEOUT']
          begin
            ::Timeout.timeout(to) do
              res = connect
      Severity: Minor
      Found in modules/auxiliary/scanner/telnet/telnet_ruggedcom.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 not origin.nil?
                      print_good(/\w+\@[\w+\.]+/.match(origin.to_s).to_s)
                    else
                      print_status("Ringing message received but no user/gateway sent...")
                    end
      Severity: Major
      Found in modules/auxiliary/scanner/sip/sipdroid_ext_enum.rb - About 45 mins to fix

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

          def run_host(ip)
        
            connect
        
            begin
        Severity: Minor
        Found in modules/auxiliary/scanner/sip/enumerator_tcp.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 do_login has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def do_login(user=nil,pass=nil)
            begin
              otp_send("< OTP/1.0 >\n",true) # send hello
              if @result !~ /\<\ OTP\/1\.0 \>/
                print_error("#{msg} OpenVAS OTP does not appear to be running: did not get response to OTP hello: #{@result}")
        Severity: Minor
        Found in modules/auxiliary/scanner/openvas/openvas_otp_login.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 report_hashes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def report_hashes(mssql_hashes, version_year)
            case version_year
            when "2000"
              hashtype = "mssql"
            when "2005", "2008"
        Severity: Minor
        Found in modules/auxiliary/scanner/mssql/mssql_hashdump.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 run_host has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def run_host(target_host)
        
            check_url = datastore['CHECKURL']
        
            if datastore['VERIFYCONNECT']
        Severity: Minor
        Found in modules/auxiliary/scanner/http/open_proxy.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