rapid7/metasploit-framework

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

Summary

Maintainability
C
1 day
Test Coverage

Method generate_jsp_payload has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def generate_jsp_payload
    opts = {:arch => @my_target.arch, :platform => @my_target.platform}
    exe = generate_payload_exe(opts)
    base64_exe = Rex::Text.encode_base64(exe)

Severity: Minor
Found in modules/exploits/multi/http/sysaid_auth_file_upload.rb - About 1 hr to fix

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

      def initialize(info = {})
        super(update_info(info,
          'Name'        => 'SysAid Help Desk Administrator Portal Arbitrary File Upload',
          'Description' => %q{
            This module exploits a file upload vulnerability in SysAid Help Desk.
    Severity: Minor
    Found in modules/exploits/multi/http/sysaid_auth_file_upload.rb - About 1 hr to fix

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

        def exploit
          @cookie = authenticate
          unless @cookie
            fail_with(Failure::NoAccess, "#{peer} - Unable to authenticate with the provided credentials.")
          end
      Severity: Minor
      Found in modules/exploits/multi/http/sysaid_auth_file_upload.rb - About 1 hr to fix

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

          def exploit
            @cookie = authenticate
            unless @cookie
              fail_with(Failure::NoAccess, "#{peer} - Unable to authenticate with the provided credentials.")
            end
        Severity: Minor
        Found in modules/exploits/multi/http/sysaid_auth_file_upload.rb - About 55 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 pick_target has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def pick_target
            unless target.name == 'Automatic'
              return target
            end
        
        
        Severity: Minor
        Found in modules/exploits/multi/http/sysaid_auth_file_upload.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

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

          def upload_payload(payload, is_exploit)
            post_data = Rex::MIME::Message.new
            post_data.add_part(payload,
              'application/octet-stream', 'binary',
              "form-data; name=\"#{Rex::Text.rand_text_alpha(4+rand(8))}\"; filename=\"#{Rex::Text.rand_text_alpha(4+rand(10))}.jsp\"")
        Severity: Minor
        Found in modules/exploits/multi/http/sysaid_auth_file_upload.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

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

          def check
            res = send_request_cgi({
              'uri'    => normalize_uri(datastore['TARGETURI'], 'errorInSignUp.htm'),
              'method' => 'GET'
            })
        Severity: Minor
        Found in modules/exploits/multi/http/sysaid_auth_file_upload.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 5 locations. Consider refactoring.
        Open

            jsp = %Q|
            <%@page import="java.io.*"%>
            <%@page import="sun.misc.BASE64Decoder"%>
            <%
            try {
        Severity: Major
        Found in modules/exploits/multi/http/sysaid_auth_file_upload.rb and 4 other locations - About 1 hr to fix
        modules/exploits/multi/http/eventlog_file_upload.rb on lines 229..247
        modules/exploits/multi/http/novell_servicedesk_rce.rb on lines 208..226
        modules/exploits/multi/http/webnms_file_upload.rb on lines 166..184
        modules/exploits/windows/browser/facebook_extractiptc.rb on lines 76..85

        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 62.

        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

        Identical blocks of code found in 6 locations. Consider refactoring.
        Open

            if @my_target['Platform'] == 'linux'
              var_proc1 = Rex::Text.rand_text_alpha(rand(8) + 3)
              chmod = %Q|
              Process #{var_proc1} = Runtime.getRuntime().exec("chmod 777 " + #{var_path});
              Thread.sleep(200);
        Severity: Major
        Found in modules/exploits/multi/http/sysaid_auth_file_upload.rb and 5 other locations - About 55 mins to fix
        modules/exploits/multi/http/eventlog_file_upload.rb on lines 212..226
        modules/exploits/multi/http/manage_engine_dc_pmp_sqli.rb on lines 353..367
        modules/exploits/multi/http/manageengine_search_sqli.rb on lines 114..128
        modules/exploits/multi/http/novell_servicedesk_rce.rb on lines 191..205
        modules/exploits/multi/http/webnms_file_upload.rb on lines 149..163

        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 44.

        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