rapid7/metasploit-framework

View on GitHub
modules/exploits/multi/http/mirth_connect_cve_2023_43208.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method execute_command_cve_2023_43208 has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def execute_command_cve_2023_43208(cmd, _opts = {})
    if target['Platform'] == 'win'
      cmd = "cmd.exe /c \"#{cmd}\""
    else
      # see: https://codewhitesec.blogspot.com/2015/03/sh-or-getting-shell-environment-from.html
Severity: Major
Found in modules/exploits/multi/http/mirth_connect_cve_2023_43208.rb - About 2 hrs to fix

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

      def initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'Mirth Connect Deserialization RCE',
    Severity: Major
    Found in modules/exploits/multi/http/mirth_connect_cve_2023_43208.rb - About 2 hrs to fix

      Method execute_command_cve_2023_37679 has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def execute_command_cve_2023_37679(cmd, _opts = {})
          # Tested on 4.1.1 and 4.3.0
          xml = Nokogiri::XML(<<-XML, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS).root.to_xml(indent: 0, save_with: 0)
            <sorted-set>
              <string>#{rand_text_alphanumeric(4..12)}</string>
      Severity: Minor
      Found in modules/exploits/multi/http/mirth_connect_cve_2023_43208.rb - About 1 hr to fix

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

          def check
            res = send_request_cgi(
              'method' => 'GET',
              'uri' => normalize_uri(target_uri.path)
            )
        Severity: Minor
        Found in modules/exploits/multi/http/mirth_connect_cve_2023_43208.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 CheckCode::Appears("Version #{target_version} is affected by CVE-2023-43208.")
        Severity: Major
        Found in modules/exploits/multi/http/mirth_connect_cve_2023_43208.rb - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status