rapid7/metasploit-framework

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

Summary

Maintainability
D
2 days
Test Coverage

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

  def exploit
    version = get_version

    # 1: get the cookies, the login_url and the password_form and username form names (they varies between versions)
    res = send_request_cgi({
Severity: Major
Found in modules/exploits/multi/http/novell_servicedesk_rce.rb - About 4 hrs to fix

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

      def exploit
        version = get_version
    
        # 1: get the cookies, the login_url and the password_form and username form names (they varies between versions)
        res = send_request_cgi({
    Severity: Minor
    Found in modules/exploits/multi/http/novell_servicedesk_rce.rb - About 4 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

    File novell_servicedesk_rce.rb has 307 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
    Severity: Minor
    Found in modules/exploits/multi/http/novell_servicedesk_rce.rb - About 3 hrs to fix

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

        def initialize(info = {})
          super(update_info(info,
            'Name'           => 'Novell ServiceDesk Authenticated File Upload',
            'Description'    => %q{
              This module exploits an authenticated arbitrary file upload via directory traversal
      Severity: Major
      Found in modules/exploits/multi/http/novell_servicedesk_rce.rb - About 2 hrs to fix

        Method create_jsp has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def create_jsp
            opts = {:arch => @my_target.arch, :platform => @my_target.platform}
            payload = exploit_regenerate_payload(@my_target.platform, @my_target.arch)
            exe = generate_payload_exe(opts)
            base64_exe = Rex::Text.encode_base64(exe)
        Severity: Minor
        Found in modules/exploits/multi/http/novell_servicedesk_rce.rb - About 2 hrs to fix

          Method pick_target has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            def pick_target
              return target if target.name != 'Automatic'
          
              print_status("#{peer} - Determining target")
          
          
          Severity: Minor
          Found in modules/exploits/multi/http/novell_servicedesk_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 pick_target has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def pick_target
              return target if target.name != 'Automatic'
          
              print_status("#{peer} - Determining target")
          
          
          Severity: Minor
          Found in modules/exploits/multi/http/novell_servicedesk_rce.rb - About 1 hr to fix

            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/novell_servicedesk_rce.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/sysaid_auth_file_upload.rb on lines 197..215
            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/novell_servicedesk_rce.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/sysaid_auth_file_upload.rb on lines 180..194
            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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    res = send_request_cgi({
                      'method' => 'POST',
                      'uri' => normalize_uri(login_url),
                      'headers' => {
                        'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)',
            Severity: Minor
            Found in modules/exploits/multi/http/novell_servicedesk_rce.rb and 1 other location - About 15 mins to fix
            modules/exploits/multi/http/novell_servicedesk_rce.rb on lines 273..283

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

            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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                res = send_request_cgi({
                  'method' => 'POST',
                  'uri' => normalize_uri(login_url),
                  'headers' => {
                    'User-Agent' => 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)',
            Severity: Minor
            Found in modules/exploits/multi/http/novell_servicedesk_rce.rb and 1 other location - About 15 mins to fix
            modules/exploits/multi/http/novell_servicedesk_rce.rb on lines 297..307

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

            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