rapid7/metasploit-framework

View on GitHub
modules/exploits/multi/veritas/beagent_sha_auth_rce.rb

Summary

Maintainability
D
2 days
Test Coverage

File beagent_sha_auth_rce.rb has 465 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

  include Msf::Exploit::Remote::Tcp
  include Msf::Exploit::Remote::NDMPSocket
Severity: Minor
Found in modules/exploits/multi/veritas/beagent_sha_auth_rce.rb - About 7 hrs to fix

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

      def initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'Veritas Backup Exec Agent Remote Code Execution',
    Severity: Major
    Found in modules/exploits/multi/veritas/beagent_sha_auth_rce.rb - About 2 hrs to fix

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

        def exploit
          print_status('Exploiting ...')
      
          ndmp_status, ndmp_sock, msg_fail_reason = ndmp_connect
          fail_with(Msf::Module::Failure::NotFound, "Can not connect to BE Agent service. #{msg_fail_reason}") unless ndmp_status
      Severity: Minor
      Found in modules/exploits/multi/veritas/beagent_sha_auth_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 win_write_upload has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def win_write_upload(ndmp_sock, filename)
          print_status('Uploading payload with NDMP_FILE_WRITE packet')
          ndmp_msg = ndmp_sock.do_request_response(
            NDMP::Message.new_request(
              NDMP_FILE_OPEN_EXT,
      Severity: Minor
      Found in modules/exploits/multi/veritas/beagent_sha_auth_rce.rb - About 1 hr to fix

        Method tls_enabling has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def tls_enabling(ndmp_sock)
            print_status('Enabling TLS for NDMP connection')
            ndmp_tls_certs = NdmpTlsCerts.new('VeritasBE', datastore['RHOSTS'].to_s)
            ndmp_tls_certs.forge_ca
            ndmp_msg = ndmp_sock.do_request_response(
        Severity: Minor
        Found in modules/exploits/multi/veritas/beagent_sha_auth_rce.rb - About 1 hr to fix

          Method ndmp_connect has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def ndmp_connect
              print_status('Connecting to BE Agent service')
              ndmp_msg = nil
              begin
                ndmp_sock = NDMP::Socket.new(connect)
          Severity: Minor
          Found in modules/exploits/multi/veritas/beagent_sha_auth_rce.rb - About 1 hr to fix

            Method sha_authentication has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def sha_authentication(ndmp_sock)
                print_status('Passing SHA authentication')
                ndmp_msg = ndmp_sock.do_request_response(
                  NDMP::Message.new_request(
                    NDMP_CONFIG_GET_AUTH_ATTR,
            Severity: Minor
            Found in modules/exploits/multi/veritas/beagent_sha_auth_rce.rb - About 1 hr to fix

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

                def win_write_upload(ndmp_sock, filename)
                  print_status('Uploading payload with NDMP_FILE_WRITE packet')
                  ndmp_msg = ndmp_sock.do_request_response(
                    NDMP::Message.new_request(
                      NDMP_FILE_OPEN_EXT,
              Severity: Minor
              Found in modules/exploits/multi/veritas/beagent_sha_auth_rce.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 tls_enabling has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def tls_enabling(ndmp_sock)
                  print_status('Enabling TLS for NDMP connection')
                  ndmp_tls_certs = NdmpTlsCerts.new('VeritasBE', datastore['RHOSTS'].to_s)
                  ndmp_tls_certs.forge_ca
                  ndmp_msg = ndmp_sock.do_request_response(
              Severity: Minor
              Found in modules/exploits/multi/veritas/beagent_sha_auth_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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                class NdmpConfigGetServerInfoRes < XDR::Struct
                  attribute :err_code, XDR::Int
                  attribute :vendor_name, XDR::String[]
                  attribute :product_name, XDR::String[]
                  attribute :revision, XDR::String[]
              Severity: Minor
              Found in modules/exploits/multi/veritas/beagent_sha_auth_rce.rb and 1 other location - About 25 mins to fix
              modules/exploits/windows/backupexec/ssl_uaf.rb on lines 447..452

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 29.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status