rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

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

  def exploit
    if is_system?
      fail_with(Failure::None, 'Session is already elevated')
    end

modules/exploits/windows/local/cve_2021_21551_dbutil_memmove.rb on lines 94..118

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

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 initialize(info = {})
    super(update_info(info,
      'Name'           => 'Apple TV Image Remote Control',
      'Description'    => %q(
        This module will show an image on an AppleTV device for a period of time.
Severity: Major
Found in modules/auxiliary/admin/appletv/appletv_display_image.rb and 1 other location - About 2 hrs to fix
modules/auxiliary/admin/appletv/appletv_display_video.rb on lines 11..56

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

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

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

    public Object run() throws Exception
    {
        //System.out.println("Running");
        // if the native payload data has not been set just return for now, it
        // will be set by the next time we reach here.
Severity: Major
Found in external/source/exploits/CVE-2012-1723/src/msf/x/PayloadX.java - About 2 hrs to fix

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

        public Object run() throws Exception
        {
            //System.out.println("Running");
            // if the native payload data has not been set just return for now, it
            // will be set by the next time we reach here.
    Severity: Major
    Found in external/source/exploits/CVE-2012-0507/msf/x/PayloadX.java - About 2 hrs to fix

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

            def view_site_tree(urlstr, md, ld)
              if !urlstr
                return
              end
      
      
      Severity: Major
      Found in plugins/wmap.rb - About 2 hrs to fix

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

              def rpc_mon_nodes
                # Pretty monitor
        
                color = begin
                  opts['ConsoleDriver'].output.supports_color?
        Severity: Major
        Found in plugins/wmap.rb - About 2 hrs to fix

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

            def on_dispatch_request(client, data)
              return if data.strip.empty?
          
              data.extend(Net::BER::Extensions::String)
              begin
          Severity: Major
          Found in modules/auxiliary/server/ldap.rb - About 2 hrs to fix

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

              def initialize(info = {})
                super(
                  update_info(
                    info,
                    'Name' => 'Python Flask Cookie Signer',
            Severity: Major
            Found in modules/auxiliary/gather/python_flask_cookie_signer.rb - About 2 hrs to fix

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

                def srvsvc_netshareenum
                  shares = []
                  handle = dcerpc_handle('4b324fc8-1670-01d3-1278-5a47bf6ee188', '3.0', 'ncacn_np', ["\\srvsvc"])
              
                  begin
              Severity: Major
              Found in modules/auxiliary/gather/windows_deployment_services_shares.rb - About 2 hrs to fix

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

                  def initialize(info = {})
                    super(
                      update_info(
                        info,
                        'Name' => 'Windows Registry Security Descriptor Utility',
                Severity: Major
                Found in modules/auxiliary/admin/registry_security_descriptor.rb - About 2 hrs to fix

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

                    def run
                  
                      connect_login
                  
                      modprops = ['attendee', 'categories', 'class', 'created', 'description',
                  Severity: Major
                  Found in modules/auxiliary/dos/windows/smtp/ms06_019_exchange.rb - About 2 hrs to fix

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

                      def run_host(ip)
                        if session
                          set_mssql_session(session.client)
                        elsif !mssql_login(datastore['USERNAME'], datastore['PASSWORD'])
                          info = self.mssql_client.initial_connection_info
                    Severity: Major
                    Found in modules/auxiliary/scanner/mssql/mssql_hashdump.rb - About 2 hrs to fix

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

                        def initialize
                          super(
                            'Name' => 'Log4Shell HTTP Scanner',
                            'Description' => %q{
                              Versions of Apache Log4j2 impacted by CVE-2021-44228 which allow JNDI features used in configuration,
                      Severity: Major
                      Found in modules/auxiliary/scanner/http/log4shell_scanner.rb - About 2 hrs to fix

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

                          def run_host(ip)
                        
                            tpath = normalize_uri(datastore['PATH'])
                            if tpath[-1,1] != '/'
                              tpath += '/'
                        Severity: Major
                        Found in modules/auxiliary/scanner/http/dir_listing.rb - About 2 hrs to fix

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

                            def run_host(ip)
                              vprint_status("#{ip}:#{rport} - Starting ACPP login sweep")
                          
                              cred_collection = Metasploit::Framework::PrivateCredentialCollection.new(
                                blank_passwords: datastore['BLANK_PASSWORDS'],
                          Severity: Major
                          Found in modules/auxiliary/scanner/acpp/login.rb - About 2 hrs to fix

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

                              def run_host(ip)
                                unless requires_password?(ip)
                                  print_good "#{peer} - No password is required."
                                  report_vuln(
                                    host: ip,
                            Severity: Major
                            Found in modules/auxiliary/scanner/redis/redis_login.rb - About 2 hrs to fix

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

                                def initialize(info = {})
                                  super(update_info(info,
                                    'Name'           => 'PhpMyAdmin Config File Code Injection',
                                    'Description'    => %q{
                                        This module exploits a vulnerability in phpMyAdmin's setup
                              Severity: Major
                              Found in modules/exploits/unix/webapp/phpmyadmin_config.rb - About 2 hrs to fix

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

                                  def initialize(info = {})
                                    super(update_info(info,
                                      'Name'           => 'Webmin Upload Authenticated RCE',
                                      'Description'    => %q(
                                        This module exploits an arbitrary command execution vulnerability in Webmin
                                Severity: Major
                                Found in modules/exploits/unix/webapp/webmin_upload_exec.rb - About 2 hrs to fix

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

                                    def initialize(info = {})
                                      super(update_info(info,
                                        'Name'            => 'FusionPBX Operator Panel exec.php Command Execution',
                                        'Description'     => %q{
                                          This module exploits an authenticated command injection vulnerability

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

                                      def initialize(info = {})
                                        super(update_info(info,
                                          'Name'           => 'MoinMoin twikidraw Action Traversal File Upload',
                                          'Description'    => %q{
                                              This module exploits a vulnerability in MoinMoin 1.9.5. The vulnerability
                                    Severity: Major
                                    Found in modules/exploits/unix/webapp/moinmoin_twikidraw.rb - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language