rapid7/metasploit-framework

View on GitHub
modules/exploits/windows/iis/msadc.rb

Summary

Maintainability
D
2 days
Test Coverage

File msadc.rb has 345 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rex/exploitation'

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

Severity: Minor
Found in modules/exploits/windows/iis/msadc.rb - About 4 hrs to fix

    Method find_exec has 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def find_exec
        # config data - greets to rain forest puppy :)
        boundary = rand_text_alphanumeric(8)
    
        if (datastore['NAME']) # Obtain the hostname if true
    Severity: Major
    Found in modules/exploits/windows/iis/msadc.rb - About 4 hrs to fix

      Method exec_cmd has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

        def exec_cmd(sql, cmd, d)
          boundary = rand_text_alphanumeric(8)
          method = datastore['METHOD'] ? "VbBusObj.VbBusObjCls.GetRecordset" : "AdvancedDataFactory.Query"
          dsn = Rex::Text.to_unicode(d)
          if (d =~ /driver=\{SQL Server\}/)
      Severity: Minor
      Found in modules/exploits/windows/iis/msadc.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 exec_cmd has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def exec_cmd(sql, cmd, d)
          boundary = rand_text_alphanumeric(8)
          method = datastore['METHOD'] ? "VbBusObj.VbBusObjCls.GetRecordset" : "AdvancedDataFactory.Query"
          dsn = Rex::Text.to_unicode(d)
          if (d =~ /driver=\{SQL Server\}/)
      Severity: Major
      Found in modules/exploits/windows/iis/msadc.rb - About 3 hrs to fix

        Method find_exec has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

          def find_exec
            # config data - greets to rain forest puppy :)
            boundary = rand_text_alphanumeric(8)
        
            if (datastore['NAME']) # Obtain the hostname if true
        Severity: Minor
        Found in modules/exploits/windows/iis/msadc.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 initialize has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def initialize
            super(
              'Name' => 'MS99-025 Microsoft IIS MDAC msadcs.dll RDS Arbitrary Remote Command Execution',
              'Description' => %q{
                  This module can be used to execute arbitrary commands on IIS servers
        Severity: Major
        Found in modules/exploits/windows/iis/msadc.rb - About 2 hrs to fix

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

            def exploit
              print_status("Searching for valid command execution point...")
              x = false
              until (x)
                x, y, z = find_exec
          Severity: Minor
          Found in modules/exploits/windows/iis/msadc.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 too many return statements within this method.
          Open

                  return ret if (ret)
          Severity: Major
          Found in modules/exploits/windows/iis/msadc.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                return -1
            Severity: Major
            Found in modules/exploits/windows/iis/msadc.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                  return ret if (ret)
              Severity: Major
              Found in modules/exploits/windows/iis/msadc.rb - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status