rapid7/metasploit-framework

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

Summary

Maintainability
B
6 hrs
Test Coverage

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

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Telerik UI ASP.NET AJAX RadAsyncUpload Deserialization',
Severity: Minor
Found in modules/exploits/windows/http/telerik_rau_deserialization.rb - About 2 hrs to fix

    Method upload_file has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def upload_file(file_contents, version)
        target_folder = encrypt('')
        temp_target_folder = encrypt(datastore['DESTINATION'].encode('UTF-16LE'))
        if (version =~ /(\d{4})\.\d+.\d+/) && Regexp.last_match(1).to_i > 2016
          # signing is only necessary for versions >= 2017.1.118 (versions that don't match the regex don't require signing)
    Severity: Minor
    Found in modules/exploits/windows/http/telerik_rau_deserialization.rb - About 1 hr to fix

      Method check has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def check
          res = send_request_cgi({
            'uri' => normalize_uri(target_uri.path, 'Telerik.Web.UI.WebResource.axd'),
            'vars_get' => { 'type' => 'rau' }
          })
      Severity: Minor
      Found in modules/exploits/windows/http/telerik_rau_deserialization.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 check has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def check
          res = send_request_cgi({
            'uri' => normalize_uri(target_uri.path, 'Telerik.Web.UI.WebResource.axd'),
            'vars_get' => { 'type' => 'rau' }
          })
      Severity: Minor
      Found in modules/exploits/windows/http/telerik_rau_deserialization.rb - About 1 hr to fix

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

          def enumerate_version
            print_status('Enumerating the Telerik UI ASP.NET AJAX version, this will fail if the keys are incorrect')
            File.open(File.join(Msf::Config.data_directory, 'wordlists', 'telerik_ui_asp_net_ajax_versions.txt'), 'rb').each_line do |version|
              version.strip!
              next if version.start_with?('#')
        Severity: Minor
        Found in modules/exploits/windows/http/telerik_rau_deserialization.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