rapid7/metasploit-framework

View on GitHub

Showing 21,757 of 21,757 total issues

Method process_ntlm_hash has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def process_ntlm_hash(arg = {})
          ntlm_ver = arg[:ntlm_ver]
          lm_hash = arg[:lm_hash]
          nt_hash = arg[:nt_hash]
          unless ntlm_ver == NTLM_CONST::NTLM_V1_RESPONSE || ntlm_ver == NTLM_CONST::NTLM_2_SESSION_RESPONSE
Severity: Major
Found in lib/rex/proto/ldap/auth.rb - About 3 hrs to fix

    Method cmd_generate has 95 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def cmd_generate(*args)
                # Parse the arguments
                encoder_name = nil
                sled_size = nil
                pad_nops = nil
    Severity: Major
    Found in lib/msf/ui/console/command_dispatcher/payload.rb - About 3 hrs to fix

      Method start_handler has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def start_handler
              # Maximum number of seconds to run the handler
              ctimeout = 150
      
              if (exploit_config and exploit_config['active_timeout'])
      Severity: Major
      Found in lib/msf/core/handler/bind_named_pipe.rb - About 3 hrs to fix

        File mikrotik.rb has 325 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Msf
          ###
          #
          # This module provides methods for working with Mikrotik equipment
          #
        Severity: Minor
        Found in lib/msf/core/auxiliary/mikrotik.rb - About 3 hrs to fix

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

              sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
              response_data = response_data[11..-1] # cut out acpi data
              if sq_bit.eql?(0b10000000)
                ioa = response_data[0..3]
                response_data = response_data[3..-1]
          Severity: Major
          Found in modules/auxiliary/client/iec104/iec104.rb and 3 other locations - About 3 hrs to fix
          modules/auxiliary/client/iec104/iec104.rb on lines 137..155
          modules/auxiliary/client/iec104/iec104.rb on lines 183..201
          modules/auxiliary/client/iec104/iec104.rb on lines 302..320

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

          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

              sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
              response_data = response_data[11..-1] # cut out acpi data
              if sq_bit.eql?(0b10000000)
                ioa = response_data[0..3]
                response_data = response_data[3..-1]
          Severity: Major
          Found in modules/auxiliary/client/iec104/iec104.rb and 3 other locations - About 3 hrs to fix
          modules/auxiliary/client/iec104/iec104.rb on lines 137..155
          modules/auxiliary/client/iec104/iec104.rb on lines 206..224
          modules/auxiliary/client/iec104/iec104.rb on lines 302..320

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

          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

              sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
              response_data = response_data[11..-1] # cut out acpi data
              if sq_bit.eql?(0b10000000)
                ioa = response_data[0..3]
                response_data = response_data[3..-1]
          Severity: Major
          Found in modules/auxiliary/client/iec104/iec104.rb and 3 other locations - About 3 hrs to fix
          modules/auxiliary/client/iec104/iec104.rb on lines 137..155
          modules/auxiliary/client/iec104/iec104.rb on lines 183..201
          modules/auxiliary/client/iec104/iec104.rb on lines 206..224

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

          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

              sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000 # this bit determines the object addressing structure
              response_data = response_data[11..-1] # cut out acpi data
              if sq_bit.eql?(0b10000000)
                ioa = response_data[0..3] # extract ioa value
                response_data = response_data[3..-1] # cut ioa from message
          Severity: Major
          Found in modules/auxiliary/client/iec104/iec104.rb and 3 other locations - About 3 hrs to fix
          modules/auxiliary/client/iec104/iec104.rb on lines 183..201
          modules/auxiliary/client/iec104/iec104.rb on lines 206..224
          modules/auxiliary/client/iec104/iec104.rb on lines 302..320

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

          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

            def decrypt_password(data)
              pid = client.sys.process.getpid
              process = client.sys.process.open(pid, PROCESS_ALL_ACCESS)
          
              mem = process.memory.allocate(512)
          Severity: Major
          Found in modules/post/windows/gather/credentials/enum_picasa_pwds.rb and 1 other location - About 3 hrs to fix
          modules/post/windows/gather/credentials/tortoisesvn.rb on lines 55..77

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

          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

            def decrypt_password(data)
              pid = client.sys.process.getpid
              process = client.sys.process.open(pid, PROCESS_ALL_ACCESS)
          
              mem = process.memory.allocate(128)
          Severity: Major
          Found in modules/post/windows/gather/credentials/tortoisesvn.rb and 1 other location - About 3 hrs to fix
          modules/post/windows/gather/credentials/enum_picasa_pwds.rb on lines 51..73

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

          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

          File prtg_authenticated_rce_cve_2023_32781.rb has 324 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class MetasploitModule < Msf::Exploit::Remote
            Rank = ExcellentRanking
            include Msf::Exploit::Remote::HttpClient
            include Msf::Exploit::CmdStager
            include Msf::Exploit::Retry

            File local_exploit_suggester.rb has 324 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            class MetasploitModule < Msf::Post
            
              include Msf::Auxiliary::Report
            
              def initialize(info = {})
            Severity: Minor
            Found in modules/post/multi/recon/local_exploit_suggester.rb - About 3 hrs to fix

              File gpp.rb has 324 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class MetasploitModule < Msf::Post
                include Msf::Auxiliary::Report
                include Msf::Post::File
                include Msf::Post::Windows::ExtAPI
                include Msf::Post::Windows::Priv
              Severity: Minor
              Found in modules/post/windows/gather/credentials/gpp.rb - About 3 hrs to fix

                File graphml.rb has 324 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                module Rex
                  module Parser
                    #
                    # A partial implementation of the GraphML specification for loading structured data from an XML file. Notable
                    # missing components include GraphML parse meta-data (XML attributes with the "parse" prefix), hyperedges and ports.
                Severity: Minor
                Found in lib/rex/parser/graphml.rb - About 3 hrs to fix

                  File credential_api_doc.rb has 324 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'swagger/blocks'
                  
                  # TODO: Complete this documentation when the credential model is fully implemented in the API.
                  module Msf::WebServices::Documentation::Api::V1::CredentialApiDoc
                    include Swagger::Blocks
                  Severity: Minor
                  Found in lib/msf/core/web_services/documentation/api/v1/credential_api_doc.rb - About 3 hrs to fix

                    Method dispatch_request has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def dispatch_request(packet, rhost, src_port)
                        rhost = ::IPAddr.new(rhost)
                    
                        # `recvfrom` (on Linux at least) will give us an ipv6/ipv4 mapped
                        # addr like "::ffff:192.168.0.1" when the interface we're listening
                    Severity: Major
                    Found in modules/auxiliary/spoof/mdns/mdns_response.rb - About 3 hrs to fix

                      Method run_host has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def run_host(ip)
                          client = datastore['CLIENT']
                          data = '<?xml version="1.0" encoding="utf-8" ?>'
                          data << '<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'
                          data << '<env:Body>'
                      Severity: Major
                      Found in modules/auxiliary/scanner/sap/sap_soap_rfc_system_info.rb - About 3 hrs to fix

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

                          def on_request_uri(cli, request)
                            print_status("Sending #{request.uri} to #{request['User-Agent']}")
                            shellcode = Rex::Text.to_num(payload.encoded).gsub(/\r\n/, '')
                            jscript = <<~JS
                              var wasm_code = new Uint8Array([0,97,115,109,1,0,0,0,1,133,128,128,128,0,1,96,0,1,127,3,130,128,128,128,0,1,0,4,132,128,128,128,0,1,112,0,0,5,131,128,128,128,0,1,0,1,6,129,128,128,128,0,0,7,145,128,128,128,0,2,6,109,101,109,111,114,121,2,0,4,109,97,105,110,0,0,10,138,128,128,128,0,1,132,128,128,128,0,0,65,42,11])
                        Severity: Major
                        Found in modules/exploits/multi/browser/chrome_simplifiedlowering_overflow.rb - About 3 hrs to fix

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

                            def on_request_uri(cli, request)
                          
                              # Set target manually or automatically
                              my_target = target
                              if my_target.name == 'Automatic'
                          Severity: Major
                          Found in modules/exploits/windows/browser/viscom_movieplayer_drawtext.rb - About 3 hrs to fix

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

                              def initialize(info = {})
                                super(
                                  update_info(
                                    info,
                                    'Name' => 'Craft CMS unauthenticated Remote Code Execution (RCE)',
                            Severity: Major
                            Found in modules/exploits/linux/http/craftcms_unauth_rce_cve_2023_41892.rb - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language