rapid7/metasploit-framework

View on GitHub
modules/exploits/linux/http/vmware_vrli_rce.rb

Summary

Maintainability
D
2 days
Test Coverage

Method generate_malicious_tar has 116 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def generate_malicious_tar
    mf_file = <<~EOF.strip
      {
          "CHECKSUMS": [
              {
Severity: Major
Found in modules/exploits/linux/http/vmware_vrli_rce.rb - About 4 hrs to fix

    File vmware_vrli_rce.rb has 315 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'rex/proto/thrift'
    require 'rex/stopwatch'
    
    class MetasploitModule < Msf::Exploit::Remote
      Rank = ExcellentRanking
    Severity: Minor
    Found in modules/exploits/linux/http/vmware_vrli_rce.rb - About 3 hrs to fix

      Method exploit has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def exploit
          # This is an important check...
          fail_with(Failure::BadConfig, 'SRVHOST can\'t be localhost') if datastore['SRVHOST'] =~ /(127|0)\.0\.0\.(0|1)|localhost/
      
          # Step 1 generate malicious TAR archive
      Severity: Major
      Found in modules/exploits/linux/http/vmware_vrli_rce.rb - About 3 hrs to fix

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

          def initialize(info = {})
            super(
              update_info(
                info,
                'Name' => 'VMware vRealize Log Insight Unauthenticated RCE',
        Severity: Major
        Found in modules/exploits/linux/http/vmware_vrli_rce.rb - About 2 hrs to fix

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

            def exploit
              # This is an important check...
              fail_with(Failure::BadConfig, 'SRVHOST can\'t be localhost') if datastore['SRVHOST'] =~ /(127|0)\.0\.0\.(0|1)|localhost/
          
              # Step 1 generate malicious TAR archive
          Severity: Minor
          Found in modules/exploits/linux/http/vmware_vrli_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 check has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def check
              print_status "Checking if #{peer} can be exploited."
              res = send_request_cgi({
                'uri' => normalize_uri(target_uri.path, 'i18n', 'component'),
                'method' => 'GET'
          Severity: Minor
          Found in modules/exploits/linux/http/vmware_vrli_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

          There are no issues that match your filters.

          Category
          Status