rapid7/metasploit-framework

View on GitHub
modules/exploits/freebsd/webapp/spamtitan_unauth_rce.rb

Summary

Maintainability
D
2 days
Test Coverage

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

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'SpamTitan Unauthenticated RCE',
Severity: Major
Found in modules/exploits/freebsd/webapp/spamtitan_unauth_rce.rb - About 5 hrs to fix

    File spamtitan_unauth_rce.rb has 290 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Exploit::Remote
      Rank = NormalRanking
    
      prepend Msf::Exploit::Remote::AutoCheck
      include Msf::Exploit::Remote::SNMPClient
    Severity: Minor
    Found in modules/exploits/freebsd/webapp/spamtitan_unauth_rce.rb - About 2 hrs to fix

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

        def check
          snmp_x_uri = normalize_uri(target_uri.path, 'snmp-x.php')
          vprint_status("Check if #{snmp_x_uri} exists")
          res = send_request_cgi(
            'uri' => snmp_x_uri,
      Severity: Minor
      Found in modules/exploits/freebsd/webapp/spamtitan_unauth_rce.rb - About 2 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 check has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def check
          snmp_x_uri = normalize_uri(target_uri.path, 'snmp-x.php')
          vprint_status("Check if #{snmp_x_uri} exists")
          res = send_request_cgi(
            'uri' => snmp_x_uri,
      Severity: Major
      Found in modules/exploits/freebsd/webapp/spamtitan_unauth_rce.rb - About 2 hrs to fix

        Method inject_payload has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def inject_payload(community)
            snmp_x_uri = normalize_uri(target_uri.path, 'snmp-x.php')
            print_status("Send a request to #{snmp_x_uri} and inject the payload")
        
            post_params = {
        Severity: Minor
        Found in modules/exploits/freebsd/webapp/spamtitan_unauth_rce.rb - About 1 hr to fix

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

            def inject_payload(community)
              snmp_x_uri = normalize_uri(target_uri.path, 'snmp-x.php')
              print_status("Send a request to #{snmp_x_uri} and inject the payload")
          
              post_params = {
          Severity: Minor
          Found in modules/exploits/freebsd/webapp/spamtitan_unauth_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

          Avoid too many return statements within this method.
          Open

              return Exploit::CheckCode::Unknown.new(
                "Could not connect to SpamTitan vulnerable page (#{snmp_x_uri})"
              )
          Severity: Major
          Found in modules/exploits/freebsd/webapp/spamtitan_unauth_rce.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return Exploit::CheckCode::Safe.new(
                    "Could not connect to SpamTitan vulnerable page (#{snmp_x_uri}) - "\
                    "unexpected HTTP response code: #{res.code}"
                  )
            Severity: Major
            Found in modules/exploits/freebsd/webapp/spamtitan_unauth_rce.rb - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status