rapid7/metasploit-framework

View on GitHub
modules/exploits/multi/browser/java_jre17_jmxbean.rb

Summary

Maintainability
C
7 hrs
Test Coverage

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

  def initialize( info = {} )

    super( update_info( info,
      'Name'          => 'Java Applet JMX Remote Code Execution',
      'Description'   => %q{
Severity: Major
Found in modules/exploits/multi/browser/java_jre17_jmxbean.rb - About 2 hrs to fix

    Method on_request_uri has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def on_request_uri(cli, request)
        print_status("handling request for #{request.uri}")
    
        case request.uri
        when /\.jar$/i
    Severity: Minor
    Found in modules/exploits/multi/browser/java_jre17_jmxbean.rb - About 1 hr to fix

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

        def on_request_uri(cli, request)
          print_status("handling request for #{request.uri}")
      
          case request.uri
          when /\.jar$/i
      Severity: Major
      Found in modules/exploits/multi/browser/java_jre17_jmxbean.rb and 2 other locations - About 2 hrs to fix
      modules/exploits/multi/browser/java_jre17_glassfish_averagerangestatisticimpl.rb on lines 86..114
      modules/exploits/multi/browser/java_jre17_method_handle.rb on lines 84..112

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

      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 3 locations. Consider refactoring.
      Open

        def setup
          path = File.join(Msf::Config.data_directory, "exploits", "cve-2013-0422", "Exploit.class")
          @exploit_class = File.open(path, "rb") {|fd| fd.read(fd.stat.size) }
          path = File.join(Msf::Config.data_directory, "exploits", "cve-2013-0422", "B.class")
          @loader_class = File.open(path, "rb") {|fd| fd.read(fd.stat.size) }
      Severity: Major
      Found in modules/exploits/multi/browser/java_jre17_jmxbean.rb and 2 other locations - About 1 hr to fix
      modules/exploits/multi/browser/java_jre17_glassfish_averagerangestatisticimpl.rb on lines 75..84
      modules/exploits/multi/browser/java_jre17_method_handle.rb on lines 73..82

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

      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 4 locations. Consider refactoring.
      Open

        def generate_html
          html  = %Q|<html><head><title>Loading, Please Wait...</title></head>|
          html += %Q|<body><center><p>Loading, Please Wait...</p></center>|
          html += %Q|<applet archive="#{rand_text_alpha(8)}.jar" code="#{@exploit_class_name}.class" width="1" height="1">|
          html += %Q|</applet></body></html>|
      Severity: Minor
      Found in modules/exploits/multi/browser/java_jre17_jmxbean.rb and 3 other locations - About 15 mins to fix
      modules/exploits/multi/browser/java_jre17_glassfish_averagerangestatisticimpl.rb on lines 119..124
      modules/exploits/multi/browser/java_jre17_method_handle.rb on lines 117..122
      modules/exploits/windows/browser/java_cmm.rb on lines 115..120

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

      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