rapid7/metasploit-framework

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

Summary

Maintainability
C
1 day
Test Coverage

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

  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'Zpanel Remote Unauthenticated RCE',
      'Description'    => %q{
        This module exploits an information disclosure vulnerability
Severity: Minor
Found in modules/exploits/multi/http/zpanel_information_disclosure_rce.rb - About 1 hr to fix

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

      def login_phpmyadmin(uri, uname, passwd, cookies, token, sess_id)
        old_cookies = cookies
    
        res = send_request_cgi({
          'method' => 'POST',
    Severity: Minor
    Found in modules/exploits/multi/http/zpanel_information_disclosure_rce.rb - About 1 hr to fix

      Method do_sql has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def do_sql(cookies, token, uri)
          fname = "#{rand_text_alpha_upper(5)}.php"
          sql_stmt = "SELECT \"<?php #{payload.encoded} ?>\" INTO OUTFILE \"/etc/zpanel/panel/#{fname}\""
      
          res = send_request_cgi({
      Severity: Minor
      Found in modules/exploits/multi/http/zpanel_information_disclosure_rce.rb - About 1 hr to fix

        Method grab_sess_and_token has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def grab_sess_and_token(uri)
            print_status('Attempting to get PHPSESSIONID')
            res = send_request_cgi({
              'method' => 'GET',
              'uri'    => normalize_uri("#{uri}"),
        Severity: Minor
        Found in modules/exploits/multi/http/zpanel_information_disclosure_rce.rb - About 1 hr to fix

          Method grab_sess_and_token has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def grab_sess_and_token(uri)
              print_status('Attempting to get PHPSESSIONID')
              res = send_request_cgi({
                'method' => 'GET',
                'uri'    => normalize_uri("#{uri}"),
          Severity: Minor
          Found in modules/exploits/multi/http/zpanel_information_disclosure_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 login_phpmyadmin has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def login_phpmyadmin(uri, uname, passwd, cookies, token, sess_id)
          Severity: Minor
          Found in modules/exploits/multi/http/zpanel_information_disclosure_rce.rb - About 45 mins to fix

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

              def exploit
                # Checking pChart
                res = send_request_cgi({
                  'method'=> 'GET',
                  'uri'=> normalize_uri("#{datastore['URI']}", 'etc', 'lib', 'pChart2', 'examples', 'index.php')
            Severity: Minor
            Found in modules/exploits/multi/http/zpanel_information_disclosure_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

            There are no issues that match your filters.

            Category
            Status