rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

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

  def check
    connect
    sock.put(rand_text_alpha_upper(64))
    resp = sock.get_once(-1,5)
    disconnect
Severity: Major
Found in modules/exploits/windows/misc/hp_omniinet_1.rb and 2 other locations - About 3 hrs to fix
modules/exploits/windows/misc/hp_omniinet_2.rb on lines 89..123
modules/exploits/windows/misc/hp_omniinet_3.rb on lines 55..91

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

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

  def check

    connect
    sock.put(rand_text_alpha_upper(64))
    resp = sock.get_once(-1,5)
Severity: Major
Found in modules/exploits/windows/misc/hp_omniinet_3.rb and 2 other locations - About 3 hrs to fix
modules/exploits/windows/misc/hp_omniinet_1.rb on lines 89..123
modules/exploits/windows/misc/hp_omniinet_2.rb on lines 89..123

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

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

  def check
    connect
    sock.put(rand_text_alpha_upper(64))
    resp = sock.get_once(-1,5)
    disconnect
Severity: Major
Found in modules/exploits/windows/misc/hp_omniinet_2.rb and 2 other locations - About 3 hrs to fix
modules/exploits/windows/misc/hp_omniinet_1.rb on lines 89..123
modules/exploits/windows/misc/hp_omniinet_3.rb on lines 55..91

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

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 process_urls has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def process_urls(urlstr)
        target_whitelist = []

        urls = urlstr.to_s.split(/\s+/)

Severity: Major
Found in plugins/wmap.rb - About 2 hrs to fix

    Method print_secret has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def print_secret(name, secret_item)
        if secret_item.nil? || secret_item.empty?
          vprint_status("Discarding secret #{name}, NULL Data")
          return
        end
    Severity: Major
    Found in modules/auxiliary/gather/windows_secrets_dump.rb - About 2 hrs to fix

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

        def run
          # Add padding to bypass TYPO3 security filters
          #
          # Null byte fixed in PHP 5.3.4
          #
      Severity: Major
      Found in modules/auxiliary/admin/http/typo3_sa_2010_020.rb - About 2 hrs to fix

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

          def initialize(info = {})
            super(
              update_info(
                info,
                'Name' => 'Kerberos TGT/TGS Ticket Requester',
        Severity: Major
        Found in modules/auxiliary/admin/kerberos/get_ticket.rb - About 2 hrs to fix

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

            def run_host(ip)
              unless wordpress_and_online?
                vprint_error('Server not online or not detected as wordpress')
                return
              end
          Severity: Major
          Found in modules/auxiliary/scanner/http/wp_loginizer_log_sqli.rb - About 2 hrs to fix

            Method generate has 74 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def generate(_opts = {})
                unless self.available_space.nil? || self.available_space >= 57
                  payload = <<-EOS
                    preparation:
                      xor edx, edx     ;zeroed edx
            Severity: Major
            Found in modules/payloads/singles/linux/x86/shell_bind_tcp_random_port.rb - About 2 hrs to fix

              Method handle_intermediate_stage has 74 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def handle_intermediate_stage(conn, payload)
                  stager_file = File.join(Msf::Config.data_directory, "meterpreter", "x64_osx_stage")
                  data = File.binread(stager_file)
                  macho = Msf::Payload::MachO.new(data)
                  output_data = macho.flatten
              Severity: Major
              Found in modules/payloads/stages/osx/x64/meterpreter.rb - About 2 hrs to fix

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

                  def initialize(info = {})
                    super(update_info(info,
                      'Name'           => 'Nagios3 history.cgi Host Command Execution',
                      'Description'    => %q{
                          This module abuses a command injection vulnerability in the
                Severity: Major
                Found in modules/exploits/unix/webapp/nagios3_history_cgi.rb - About 2 hrs to fix

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

                    def initialize(info = {})
                      super(
                        update_info(
                          info,
                          'Name' => 'Atlassian Confluence Namespace OGNL Injection',

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

                      def initialize(info = {})
                        super(
                          update_info(
                            info,
                            'Name' => 'Gambio Online Webshop unauthenticated PHP Deserialization Vulnerability',
                    Severity: Major
                    Found in modules/exploits/multi/http/gambio_unauth_rce_cve_2024_23759.rb - About 2 hrs to fix

                      Method login has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def login
                          # visit login page in order to obtain `shash` value, which is necessary for authentication
                          res = send_request_cgi({
                            'method' => 'GET',
                            'uri' => normalize_uri(target_uri.path),
                      Severity: Major
                      Found in modules/exploits/multi/http/maracms_upload_exec.rb - About 2 hrs to fix

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

                          def initialize(info = {})
                            super(
                              update_info(
                                info,
                                'Name' => 'VMware vCenter Server Unauthenticated OVA File Upload RCE',
                        Severity: Major
                        Found in modules/exploits/multi/http/vmware_vcenter_uploadova_rce.rb - About 2 hrs to fix

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

                            def initialize(info = {})
                              super(
                                update_info(
                                  info,
                                  'Name' => 'Oracle Weblogic Server Deserialization RCE - AsyncResponseService ',

                            Method req_teamcity_7 has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def req_teamcity_7(script_content)
                                build_id = Rex::Text.rand_text_numeric(8)
                                xml_payload = %(
                            <?xml version="1.0" encoding="UTF-8"?>
                            <methodCall>
                            Severity: Major
                            Found in modules/exploits/multi/misc/teamcity_agent_xmlrpc_exec.rb - About 2 hrs to fix

                              Method req_teamcity_2017 has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def req_teamcity_2017(script_content)
                                  build_code = Rex::Text.rand_text_alpha(8)
                                  build_id = Rex::Text.rand_text_numeric(8)
                                  xml_payload = %(
                              <?xml version="1.0" encoding="UTF-8"?>
                              Severity: Major
                              Found in modules/exploits/multi/misc/teamcity_agent_xmlrpc_exec.rb - About 2 hrs to fix

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

                                  def initialize(info={})
                                    super(update_info(info,
                                      'Name'           => "IBM Lotus Domino iCalendar MAILTO Buffer Overflow",
                                      'Description'    => %q{
                                          This module exploits a vulnerability found in IBM Lotus Domino iCalendar.  By
                                Severity: Major
                                Found in modules/exploits/windows/lotus/domino_icalendar_organizer.rb - About 2 hrs to fix

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

                                    def exploit
                                      # Prepare payload
                                      print_status("Creating initrd")
                                      initrd = File.binread(File.join(Msf::Config.data_directory, 'exploits', 'pxexploit', 'updatecustom'))
                                      uncompressed = Rex::Text.ungzip(initrd)
                                  Severity: Major
                                  Found in modules/exploits/windows/local/pxeexploit.rb - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language