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

    if sport.to_i == 0
      req = Resolv::DNS::Message.new
      txt = "spoofprobe-#{$$}#{(rand()*1000000).to_i}.red.metasploit.com"
      req.add_question(txt, Resolv::DNS::Resource::IN::TXT)
      req.rd = 1
Severity: Major
Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb and 1 other location - About 2 hrs to fix
modules/auxiliary/spoof/dns/bailiwicked_host.rb on lines 171..193

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

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 login
    login_uri = normalize_uri(target_uri.path, 'login')
    res = send_request_cgi('method' =>  'GET',  'uri' =>  login_uri)
    fail_with(Failure::NotFound, 'Failed to access the login page') unless res && res.code == 200

Severity: Major
Found in modules/exploits/linux/http/librenms_collectd_cmd_inject.rb and 1 other location - About 2 hrs to fix
modules/exploits/linux/http/librenms_addhost_cmd_inject.rb on lines 57..83

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

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

    begin

      if majorrel.join.to_i < 11

        query = %Q|
Severity: Major
Found in modules/auxiliary/admin/oracle/oraenum.rb and 1 other location - About 2 hrs to fix
modules/auxiliary/admin/oracle/oraenum.rb on lines 461..510

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

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

    begin
      if majorrel.join.to_i < 11
        query = %Q|
          SELECT username, password
          FROM dba_users
Severity: Major
Found in modules/auxiliary/admin/oracle/oraenum.rb and 1 other location - About 2 hrs to fix
modules/auxiliary/admin/oracle/oraenum.rb on lines 408..459

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

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 generate_tiff(targ)
    #
    # This is a TIFF file, we have a huge range of evasion
    # capabilities, but for now, we don't use them.
    #  - https://strikecenter.bpointsys.com/articles/2007/10/10/october-2007-microsoft-tuesday
Severity: Major
Found in modules/exploits/apple_ios/email/mobilemail_libtiff.rb and 1 other location - About 2 hrs to fix
modules/exploits/apple_ios/browser/safari_libtiff.rb on lines 88..165

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

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 generate_tiff(code, targ)

    #
    # This is a TIFF file, we have a huge range of evasion
    # capabilities, but for now, we don't use them.
Severity: Major
Found in modules/exploits/apple_ios/browser/safari_libtiff.rb and 1 other location - About 2 hrs to fix
modules/exploits/apple_ios/email/mobilemail_libtiff.rb on lines 91..167

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

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

  def init_exploit(name, mod = nil, targ = 0)
    if mod.nil?
      @exploits[name] = framework.modules.create(name)
    else
      @exploits[name] = mod.new
Severity: Major
Found in modules/auxiliary/server/browser_autopwn.rb - About 2 hrs to fix

    Method icmp_listener has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def icmp_listener
        # start icmp listener
    
        print_status("ICMP Listener started on #{@interface} (#{@iface_ip}). Monitoring for trigger packet containing #{datastore['START_TRIGGER']}")
        if datastore['FNAME_IN_PACKET']
    Severity: Major
    Found in modules/auxiliary/server/icmp_exfil.rb - About 2 hrs to fix

      Method init_sqli has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def init_sqli
          wrong_resp_length = send_injection_request_cgi(',\\,))+AND+1=2;+--+')&.body&.length
          fail_with(Failure::UnexpectedReply, 'The server responded unexpectedly to a request sent with uid: ",\\,))+AND+1=2;+--+"') unless wrong_resp_length
          sqli = create_sqli(dbms: MySQLi::BooleanBasedBlind, opts: { hex_encode_strings: true }) do |payload|
            fail_with(Failure::BadConfig, 'comma in payload') if payload.include?(',')
      Severity: Major
      Found in modules/auxiliary/gather/suite_crm_export_sqli.rb - About 2 hrs to fix

        Method grab_auths has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def grab_auths(sid,last_login)
            token         = '' # from hidden input
            selected_ldap = '' # from checkbox input
            new_uri       = '' # redirection
            flow_id       = '' # id of the flow
        Severity: Major
        Found in modules/auxiliary/scanner/http/symantec_brightmail_ldapcreds.rb - About 2 hrs to fix

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

            def run_host(ip)
          
              # Keep track of results (successful connections)
              results = []
          
          
          Severity: Major
          Found in modules/auxiliary/scanner/mysql/mysql_authbypass_hashdump.rb - About 2 hrs to fix

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

              def initialize(info = {})
                super(merge_info(info,
                  'Name'          => 'Apple iOS Command Shell, Bind TCP Inline',
                  'Description'   => 'Listen for a connection and spawn a command shell',
                  'Author'        => 'hdm',
            Severity: Major
            Found in modules/payloads/singles/osx/armle/shell_bind_tcp.rb - About 2 hrs to fix

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

                def handle_intermediate_stage(conn, payload)
                  entry_offset = elf_ep(payload)
              
                  # Generated from external/source/shellcode/linux/aarch64/stage_mettle.s
                  midstager = [
              Severity: Major
              Found in modules/payloads/stages/linux/aarch64/meterpreter.rb - About 2 hrs to fix

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

                  def on_request_uri(cli, request)
                    print_status("GET #{request.uri} #{request.headers['User-Agent']}")
                
                    resp = create_response(200, "OK")
                    if request.uri =~ /\.js$/
                Severity: Major
                Found in modules/exploits/unix/http/pfsense_clickjacking.rb - About 2 hrs to fix

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

                    def exploit
                      @token = datastore['TOKEN']
                      if @token.blank?
                        res = send_request_cgi({
                          'uri' => normalize_uri(target_uri.path, '/post_applogin.php'),
                  Severity: Major
                  Found in modules/exploits/unix/http/syncovery_linux_rce_2022_36534.rb - About 2 hrs to fix

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

                      def exploit
                        unless wordpress_and_online?
                          fail_with(Failure::NoTarget, "#{target_uri} does not seeem to be Wordpress site")
                        end
                    
                    
                    Severity: Major
                    Found in modules/exploits/unix/webapp/wp_total_cache_exec.rb - About 2 hrs to fix

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

                        def initialize(info = {})
                          super(update_info(info,
                            'Name'        => 'Rocket Servergraph Admin Center fileRequestor Remote Code Execution',
                            'Description' => %q{
                              This module abuses several directory traversal flaws in Rocket Servergraph Admin
                      Severity: Major
                      Found in modules/exploits/multi/http/rocket_servergraph_file_requestor_rce.rb - About 2 hrs to fix

                        Method do_login has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def do_login
                            print_status("Authenticating...")
                            # this method borrowed with thanks from splunk_mappy_exec.rb
                            res = send_request_cgi(
                              'uri'     => '/en-US/account/login',
                        Severity: Major
                        Found in modules/exploits/multi/http/splunk_upload_app_exec.rb - About 2 hrs to fix

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

                            def initialize(info = {})
                              super(
                                update_info(
                                  info,
                                  'Name' => 'Geoserver unauthenticated Remote Code Execution',
                          Severity: Major
                          Found in modules/exploits/multi/http/geoserver_unauth_rce_cve_2024_36401.rb - About 2 hrs to fix

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

                              def initialize(info = {})
                                super(
                                  update_info(
                                    info,
                                    'Name' => 'Apache Struts 2 DefaultActionMapper Prefixes OGNL Code Execution',
                            Severity: Major
                            Found in modules/exploits/multi/http/struts_default_action_mapper.rb - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language