rapid7/metasploit-framework

View on GitHub
modules/exploits/multi/misc/weblogic_deserialize.rb

Summary

Maintainability
D
1 day
Test Coverage

Method gen_resp has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def gen_resp
    if target.name == 'Windows'
      pwrshl = cmd_psh_payload(payload.encoded, payload_instance.arch.first, {remove_comspec: true})
      tmp_dat = pwrshl.each_byte.map {|b| b.to_s(16)}.join
    else
Severity: Major
Found in modules/exploits/multi/misc/weblogic_deserialize.rb - About 3 hrs to fix

    File weblogic_deserialize.rb has 302 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Exploit::Remote
      Rank = ManualRanking
    
      include Msf::Exploit::Remote::Tcp
      include Msf::Exploit::Remote::TcpServer
    Severity: Minor
    Found in modules/exploits/multi/misc/weblogic_deserialize.rb - About 3 hrs to fix

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

        def check
          connect
          req = "GET /console/login/LoginForm.jsp HTTP/1.1\n"
          req << "Host: #{peer}\n\n"
          sock.put(req)
      Severity: Minor
      Found in modules/exploits/multi/misc/weblogic_deserialize.rb - About 2 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

      Method build_t3_request_object has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def build_t3_request_object
          # data block is from EDB PoC
          data = '000005c3016501ffffffffffffffff0000006a0000ea600000001900937b484a'
          data << '56fa4a777666f581daa4f5b90e2aebfc607499b4027973720078720178720278'
          data << '700000000a000000030000000000000006007070707070700000000a00000003'
      Severity: Major
      Found in modules/exploits/multi/misc/weblogic_deserialize.rb - About 2 hrs to fix

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

          def send_payload_objdata
            # JRMPClient2 payload generated from EDB PoC:
            # python exploit.py <rhost> <rport> ysoserial-0.0.6-SNAPSHOT-BETA-all.jar <lhost> <lport> JRMPClient2
            # Patch in srvhost and srvport
            payload = '056508000000010000001b0000005d0101007372017870737202787000000000'
        Severity: Minor
        Found in modules/exploits/multi/misc/weblogic_deserialize.rb - About 1 hr to fix

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

            def initialize(info={})
              super(update_info(info,
                'Name' => 'Oracle Weblogic Server Deserialization RCE',
                'Description' => %q{
                  An unauthenticated attacker with network access to the Oracle Weblogic
          Severity: Minor
          Found in modules/exploits/multi/misc/weblogic_deserialize.rb - About 1 hr to fix

            Avoid too many return statements within this method.
            Open

                  return CheckCode::Detected
            Severity: Major
            Found in modules/exploits/multi/misc/weblogic_deserialize.rb - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status