rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

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

  def on_request_uri(cli, request)

    mytarget = target
    if target.name == 'Automatic'
      mytarget = auto_target(cli, request)
modules/exploits/windows/browser/keyhelp_launchtripane_exec.rb on lines 109..148

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

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

          res['delegation'].split("\n").each do |user|
            opt_users.each do |needle|
              ndom, nusr = needle.split('\\')
              if !nusr
                nusr = ndom
Severity: Major
Found in plugins/token_hunter.rb and 1 other location - About 2 hrs to fix
plugins/token_hunter.rb on lines 103..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 106.

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 enum_users_unix
    if @platform == :osx
      home = '/Users/'
    else
      home = '/home/'
Severity: Major
Found in modules/post/multi/gather/filezilla_client_cred.rb and 1 other location - About 2 hrs to fix
modules/post/multi/gather/pidgin_cred.rb on lines 81..114

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

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 enum_users_unix
    if @platform == :osx
      home = '/Users/'
    else
      home = '/home/'
Severity: Major
Found in modules/post/multi/gather/pidgin_cred.rb and 1 other location - About 2 hrs to fix
modules/post/multi/gather/filezilla_client_cred.rb on lines 73..106

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

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

        when /^\s*enable (password|secret) (\d+) (.*)/i
          stype = Regexp.last_match(2).to_i
          shash = Regexp.last_match(3).strip

          if framework.db.active
Severity: Major
Found in lib/msf/core/auxiliary/cisco.rb and 1 other location - About 2 hrs to fix
lib/msf/core/auxiliary/cisco.rb on lines 183..212

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

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

        when /^\s*wpa-psk (ascii|hex) (\d+) ([^\s]+)/i

          stype = Regexp.last_match(2).to_i
          spass = Regexp.last_match(3).strip

Severity: Major
Found in lib/msf/core/auxiliary/cisco.rb and 1 other location - About 2 hrs to fix
lib/msf/core/auxiliary/cisco.rb on lines 81..109

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

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

          res['impersonation'].split("\n").each do |user|
            opt_users.each do |needle|
              ndom, nusr = needle.split('\\')
              if !nusr
                nusr = ndom
Severity: Major
Found in plugins/token_hunter.rb and 1 other location - About 2 hrs to fix
plugins/token_hunter.rb on lines 79..100

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

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

    private Serializable setup(String cmd) throws Exception {
        final String[] execArgs = new String[] { cmd };

        final Transformer[] transformers = new Transformer[] {
                new ConstantTransformer(Runtime.class),
Severity: Major
Found in data/exploits/CVE-2017-1000353/Payload.java - About 2 hrs to fix

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

      def run
        sid, cookies = authenticate
    
        left_marker = Rex::Text.rand_text_alpha(5)
        right_marker = Rex::Text.rand_text_alpha(5)
    Severity: Major
    Found in modules/auxiliary/gather/zabbix_toggleids_sqli.rb - About 2 hrs to fix

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

        def run
          res = send_request_cgi!({
            'uri' => normalize_uri(target_uri.path, 'login'),
            'keep_cookies' => true
          })
      Severity: Major
      Found in modules/auxiliary/gather/apache_superset_cookie_sig_priv_esc.rb - About 2 hrs to fix

        Method run has 73 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_2009_001.rb - About 2 hrs to fix

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

            def initialize(info = {})
              super(
                update_info(
                  info,
                  'Name' => 'Arris / Motorola Surfboard SBG6580 Web Interface Takeover',
          Severity: Major
          Found in modules/auxiliary/admin/http/arris_motorola_surfboard_backdoor_xss.rb - About 2 hrs to fix

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

              def run_host(ip)
                print_status("#{rhost}:#{rport} - MSSQL - Starting authentication scanner.")
            
                if datastore['TDSENCRYPTION']
                  if create_session?
            Severity: Major
            Found in modules/auxiliary/scanner/mssql/mssql_login.rb - About 2 hrs to fix

              Method extractusers has 73 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def extractusers(rhost)
                  print_status("#{rhost}:#{rport} [SAP] Connecting to SAP Management Console SOAP Interface")
                  success = false
              
                  soapenv = 'http://schemas.xmlsoap.org/soap/envelope/'
              Severity: Major
              Found in modules/auxiliary/scanner/sap/sap_mgmt_con_extractusers.rb - About 2 hrs to fix

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

                  def run_host(ip)
                    # pull our csrf
                    res = send_request_cgi({
                      'uri'    => normalize_uri(datastore['TARGETURI'], 'login'),
                      'method' => 'GET',
                Severity: Major
                Found in modules/auxiliary/scanner/http/riverbed_steelhead_vcx_file_read.rb - About 2 hrs to fix

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

                    def initialize(info = {})
                      super(
                        update_info(
                          info,
                          'Name' => 'pfSense Diag Routes Web Shell Upload',
                  Severity: Major
                  Found in modules/exploits/unix/http/pfsense_diag_routes_webshell.rb - About 2 hrs to fix

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

                      def exploit
                    
                        cmd_php = '<?php ' + payload.encoded + '?>'
                    
                        # Generate some random strings
                    Severity: Major
                    Found in modules/exploits/unix/webapp/joomla_tinybrowser.rb - About 2 hrs to fix

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

                        def initialize(info = {})
                          super(
                            update_info(
                              info,
                              'Name' => 'CrushFTP Unauthenticated RCE',
                      Severity: Major
                      Found in modules/exploits/multi/http/crushftp_rce_cve_2023_43177.rb - About 2 hrs to fix

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

                          def initialize(info = {})
                            super(
                              update_info(
                                info,
                                'Name' => 'Splunk "edit_user" Capability Privilege Escalation',

                          Method req_teamcity_10 has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def req_teamcity_10(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
                            Severity
                            Category
                            Status
                            Source
                            Language