rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

Method query_current_connection has 142 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def query_current_connection(wlan_handle, guid)
    connection = {}
    conn_info = @wlanapi.WlanQueryInterface(wlan_handle, guid, 7, nil, 4, 4, nil)
    # Grab the pointer to our data structure. We skip voer the Interface State since we already have it
    # We interpret the connection mode used first
Severity: Major
Found in modules/post/windows/wlan/wlan_current_connection.rb - About 5 hrs to fix

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

    def execve(filename, argv, envp):
        from ctypes import cdll, c_char_p, POINTER
    
        libc = cdll.LoadLibrary("libc.so.6")
        libc.execve.argtypes = c_char_p,POINTER(c_char_p),POINTER(c_char_p)
    Severity: Major
    Found in data/exploits/CVE-2021-3156/nss_u16.py and 1 other location - About 5 hrs to fix
    data/exploits/CVE-2021-3156/nss_u14.py on lines 29..38

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

    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

            try:
                ldapConnection = ldap.LDAPConnection('ldap://%s' % self.__target, self.baseDN, self.__kdcIP)
                if self.__doKerberos is not True:
                    ldapConnection.login(self.__username, self.__password, self.__domain, self.__lmhash, self.__nthash)
                else:
    Severity: Major
    Found in modules/auxiliary/gather/get_user_spns.py and 1 other location - About 5 hrs to fix
    modules/auxiliary/gather/get_user_spns.py on lines 282..290

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

    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

                if str(e).find('strongerAuthRequired') >= 0:
                    # We need to try SSL
                    ldapConnection = ldap.LDAPConnection('ldaps://%s' % self.__target, self.baseDN, self.__kdcIP)
                    if self.__doKerberos is not True:
                        ldapConnection.login(self.__username, self.__password, self.__domain, self.__lmhash, self.__nthash)
    Severity: Major
    Found in modules/auxiliary/gather/get_user_spns.py and 1 other location - About 5 hrs to fix
    modules/auxiliary/gather/get_user_spns.py on lines 273..280

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

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

    def execve(filename, argv, envp):
        from ctypes import cdll, c_char_p, POINTER
    
        libc = cdll.LoadLibrary("libc.so.6")
        libc.execve.argtypes = c_char_p,POINTER(c_char_p),POINTER(c_char_p)
    Severity: Major
    Found in data/exploits/CVE-2021-3156/nss_u14.py and 1 other location - About 5 hrs to fix
    data/exploits/CVE-2021-3156/nss_u16.py on lines 27..36

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

    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 office365userenum.py has 402 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #! /usr/bin/env python3
    # -*- coding: utf-8 -*-
    from __future__ import print_function
    
    '''
    Severity: Minor
    Found in modules/auxiliary/gather/office365userenum.py - About 5 hrs to fix

      Method get_form_data has 141 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def get_form_data(body)
          print_status("Enumerating form data")
          body = body.gsub("\r","")
          body = body.gsub("\n","")
          bodydata = body.downcase.split(/<form/)
      Severity: Major
      Found in modules/auxiliary/fuzzers/http/http_form_field.rb - About 5 hrs to fix

        Method upload_exec has 141 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def upload_exec(session,rpath)
            contents=''
            name = Rex::Text.rand_text_alpha(8)
        
            # We must register this file early, that way the on_new_session method
        Severity: Major
        Found in modules/exploits/multi/http/axis2_deployer.rb - About 5 hrs to fix

          Method build_payload_obj has 141 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def build_payload_obj(payload_data)
              payload_obj = 'aced0005' # STREAM_MAGIC, STREAM_VERSION
              payload_obj << '73720017' # TC_OBJECT, TC_CLASSDESC, class name length: 23
              payload_obj << '6a6176612e7574696c2e5072696f726974795175657565' # java.util.PriorityQueue
              payload_obj << '94da30b4fb3f82b1' # SerialVersionUID
          Severity: Major
          Found in modules/exploits/multi/misc/weblogic_deserialize_badattr_extcomp.rb - About 5 hrs to fix

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

              def exploit
            
                # Step 1 - Establish a session with the target which will give us a PHP object we can
                # work with.
                begin
            Severity: Major
            Found in modules/exploits/linux/http/seagate_nas_php_exec_noauth.rb - About 5 hrs to fix

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

                def initialize(info = {})
                  super(
                    update_info(
                      info,
                      'Name' => 'Cloud Lookup (and Bypass)',
              Severity: Major
              Found in modules/auxiliary/gather/cloud_lookup.rb - About 5 hrs to fix

                File reg.rb has 400 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                begin
                msfbase = __FILE__
                while File.symlink?(msfbase)
                  msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
                end
                Severity: Minor
                Found in tools/exploit/reg.rb - About 5 hrs to fix

                  Method parse_sddl_ace has 140 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def parse_sddl_ace(ace, domain_sid:)
                          parts = ace.upcase.split(';', -1)
                          raise RuntimeError.new('SDDL parse error on too few ACE fields') if parts.length < 6
                          raise RuntimeError.new('SDDL parse error on too many ACE fields') if parts.length > 7
                  
                  
                  Severity: Major
                  Found in lib/rex/proto/ms_dtyp.rb - About 5 hrs to fix

                    File payload_generator.rb has 400 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'active_support/core_ext/numeric/bytes'
                    require 'msf/core/exception'
                    module Msf
                    
                      class PayloadGeneratorError < StandardError
                    Severity: Minor
                    Found in lib/msf/core/payload_generator.rb - About 5 hrs to fix

                      Method process_urls has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def process_urls(urlstr)
                              target_whitelist = []
                      
                              urls = urlstr.to_s.split(/\s+/)
                      
                      
                      Severity: Minor
                      Found in plugins/wmap.rb - About 5 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 process_openssl_cleartext_request has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def process_openssl_cleartext_request(c, data)
                          message_type, message_version, protocol_version = data.unpack("Cn@9n")
                      
                          if message_type == 0x15 and data.length >= 7
                            message_level, message_reason = data[5,2].unpack("CC")
                      Severity: Minor
                      Found in modules/auxiliary/server/openssl_heartbeat_client_memory.rb - About 5 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 on_dispatch_request has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def on_dispatch_request(cli, data)
                          return unless cli.is_a?(PacketFu::Packet)
                      
                          peer = "#{cli.ip_daddr}:" << (cli.is_udp? ? cli.udp_dst.to_s : cli.tcp_dst.to_s)
                      
                      
                      Severity: Minor
                      Found in modules/auxiliary/spoof/dns/native_spoofer.rb - About 5 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 run has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def run
                          # starts up the Listener Server
                          print_status("Starting listener...")
                          listener = Rex::Socket::TcpServer.create(
                            'LocalHost' => '0.0.0.0',
                      Severity: Minor
                      Found in modules/auxiliary/admin/vnc/realvnc_41_bypass.rb - About 5 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 get_schema has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def get_schema
                          mysql_schema=[]
                          res = mysql_query("show databases")
                          if res.size > 0
                            res.each do |row|
                      Severity: Minor
                      Found in modules/auxiliary/scanner/mysql/mysql_schemadump.rb - About 5 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 check has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def check
                          res = send_request_cgi({'uri' => target_uri.path })
                      
                          unless res
                            vprint_error("Connection timed out")
                      Severity: Minor
                      Found in modules/exploits/multi/http/joomla_http_header_rce.rb - About 5 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

                      Severity
                      Category
                      Status
                      Source
                      Language