rapid7/metasploit-framework

View on GitHub
modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb

Summary

Maintainability
F
4 days
Test Coverage

File dnn_cookie_deserialization_rce.rb has 547 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'openssl'
require 'set'

class MetasploitModule < Msf::Exploit::Remote
  include Msf::Exploit::Remote::HttpClient
Severity: Major
Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 1 day to fix

    Method find_key has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

      def find_key(cipher_text)
        print_status('Finding Key...')
    
        # Counter
        total_keys = @key_charset.length**8
    Severity: Minor
    Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 4 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 26 (exceeds 5 allowed). Consider refactoring.
    Open

      def exploit
        return unless check == Exploit::CheckCode::Appears
    
        @encrypted = datastore['ENCRYPTED']
        verification_code = datastore['VERIFICATION_CODE']
    Severity: Minor
    Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 3 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 81 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def exploit
        return unless check == Exploit::CheckCode::Appears
    
        @encrypted = datastore['ENCRYPTED']
        verification_code = datastore['VERIFICATION_CODE']
    Severity: Major
    Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 3 hrs to fix

      Method initialize has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def initialize(info = {})
          super(
            update_info(
              info,
              'Name' => 'DotNetNuke Cookie Deserialization Remote Code Excecution',
      Severity: Major
      Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 2 hrs to fix

        Class MetasploitModule has 22 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class MetasploitModule < Msf::Exploit::Remote
          include Msf::Exploit::Remote::HttpClient
          include Msf::Exploit::Powershell
          include Msf::Exploit::Remote::HttpServer
        
        
        Severity: Minor
        Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 2 hrs to fix

          Method find_key has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def find_key(cipher_text)
              print_status('Finding Key...')
          
              # Counter
              total_keys = @key_charset.length**8
          Severity: Major
          Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 2 hrs to fix

            Method select_target has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              def select_target
                print_status('Trying to determine DNN Version...')
                # Check for copyright version in /Documentation/license.txt
                uri = %r{^(.*[\\/])}.match(target_uri.path)[0]
                vprint_status("Checking version at #{normalize_uri("#{uri}Documentation", 'License.txt')} ...")
            Severity: Minor
            Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 1 hr 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 select_target has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def select_target
                print_status('Trying to determine DNN Version...')
                # Check for copyright version in /Documentation/license.txt
                uri = %r{^(.*[\\/])}.match(target_uri.path)[0]
                vprint_status("Checking version at #{normalize_uri("#{uri}Documentation", 'License.txt')} ...")
            Severity: Minor
            Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 1 hr to fix

              Method generate_base_keys has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                def generate_base_keys(pos, from_key, new_key)
                  if !@unchanged.include? from_key[pos]
                    if from_key[pos].even?
                      new_key[pos] = (from_key[pos] + 1).chr
                    else
              Severity: Minor
              Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 1 hr 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 brute_force_ivs has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def brute_force_ivs(pt_prefix, num_chars_needed, cipher_text, key, found_pt)
              Severity: Minor
              Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 35 mins to fix

                Method brute_force_ivs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def brute_force_ivs(pt_prefix, num_chars_needed, cipher_text, key, found_pt)
                    charset = '0123456789abcdef'
                    if num_chars_needed == 0
                      @decryptor.key = key
                      @decryptor.iv = pt_prefix
                Severity: Minor
                Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 35 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 test_passphrases has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def test_passphrases
                    for i in 0..@passphrases.size - 1
                      # Stop sending if we've found the passphrase
                      if !@passphrase.empty?
                        break
                Severity: Minor
                Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 35 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 too many return statements within this method.
                Open

                    return false
                Severity: Major
                Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                        return false
                  Severity: Major
                  Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 30 mins to fix

                    Method decrypt_data_and_iv has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def decrypt_data_and_iv(cipher, cipher_text, key)
                        cipher.key = key
                        begin
                          plaintext = cipher.update(cipher_text) + cipher.final
                          if @target_idx == 4
                    Severity: Minor
                    Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 25 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

                    There are no issues that match your filters.

                    Category
                    Status