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

    sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
    response_data = response_data[11..-1] # cut out acpi data
    if sq_bit.eql?(0b10000000)
      ioa = response_data[0..3]
      response_data = response_data[3..-1]
Severity: Major
Found in modules/auxiliary/client/iec104/iec104.rb and 1 other location - About 4 hrs to fix
modules/auxiliary/client/iec104/iec104.rb on lines 277..297

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

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 send_transform(transform)
    assertion_id = "_#{SecureRandom.uuid}"
    saml = <<~EOS
      <?xml version="1.0" encoding="UTF-8"?>
      <samlp:Response
modules/exploits/windows/http/manageengine_endpoint_central_saml_rce_cve_2022_47966.rb on lines 208..259

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

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

          matches1.each_key do |xref|
            if masstop
              print_error('STOPPED.')
              return
            end
Severity: Major
Found in plugins/wmap.rb and 1 other location - About 4 hrs to fix
plugins/wmap.rb on lines 565..616

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

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

          matches3.each_key do |xref|
            if masstop
              print_error('STOPPED.')
              return
            end
Severity: Major
Found in plugins/wmap.rb and 1 other location - About 4 hrs to fix
plugins/wmap.rb on lines 628..680

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

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

    sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
    response_data = response_data[11..-1] # cut out acpi data
    if sq_bit.eql?(0b10000000)
      ioa = response_data[0..3]
      response_data = response_data[3..-1]
Severity: Major
Found in modules/auxiliary/client/iec104/iec104.rb and 1 other location - About 4 hrs to fix
modules/auxiliary/client/iec104/iec104.rb on lines 252..272

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

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 send_transform(transform)
    assertion_id = "_#{SecureRandom.uuid}"
    saml = <<~EOS
      <?xml version="1.0" encoding="UTF-8"?>
      <samlp:Response
modules/exploits/multi/http/manageengine_servicedesk_plus_saml_rce_cve_2022_47966.rb on lines 234..285

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

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

  def start_exploit_modules()
    @lhost = (datastore['LHOST'] || "0.0.0.0")

    @noscript_tests = {}
    @all_tests = {}
Severity: Major
Found in modules/auxiliary/server/browser_autopwn.rb - About 4 hrs to fix

    Method process_hash has 101 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def process_hash(entry, attr)
        service_details = {
          workspace_id: myworkspace_id,
          module_fullname: fullname,
          origin_type: :service,
    Severity: Major
    Found in modules/auxiliary/gather/ldap_hashdump.rb - About 4 hrs to fix

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

        def run_host(ip)
          begin
            snmp = connect_snmp
      
            epmp_info = ''
      Severity: Major
      Found in modules/auxiliary/scanner/snmp/epmp1000_snmp_loot.rb - About 4 hrs to fix

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

          def run_host(ip)
        
            data = '<?xml version="1.0" encoding="utf-8" ?>'
            data << '<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'
            data << '<env:Body>'
        Severity: Major
        Found in modules/auxiliary/scanner/sap/sap_soap_th_saprel_disclosure.rb - About 4 hrs to fix

          Method accessfile has 101 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def accessfile
              print_status("Retrieving the target hostname")
          
              data = "<?xml version='1.0' encoding='UTF-8'?>" + "\r\n"
              data << "<wsns0:Envelope" + "\r\n"

            Method get_files_info has 101 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def get_files_info(ip, shares)
                # Creating a separate file for each IP address's results.
                detailed_tbl = Rex::Text::Table.new(
                  'Header' => "Spidered results for #{ip}.",
                  'Indent' => 1,
            Severity: Major
            Found in modules/auxiliary/scanner/smb/smb_enumshares.rb - About 4 hrs to fix

              Method upload_xml has 101 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def upload_xml(payload_b64, rand_text, cookies, is_check)
              
                  if is_check
                    timeout = 20
                  else
              Severity: Major
              Found in modules/exploits/multi/http/mantisbt_php_exec.rb - About 4 hrs to fix

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

                  def on_request_uri(cli, request)
                
                    my_target = ''
                    agent = request.headers['User-Agent']
                
                
                Severity: Major
                Found in modules/exploits/windows/scada/iconics_webhmi_setactivexguid.rb - About 4 hrs to fix

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

                    def exploit
                      # Generate the ASP containing the EXE containing the payload
                      exe  = generate_payload_exe
                      asp  = Msf::Util::EXE.to_exe_asp(exe)
                      path = datastore['PATH'].gsub('%RAND%', rand(0x10000000).to_s)
                  Severity: Major
                  Found in modules/exploits/windows/iis/iis_webdav_upload_asp.rb - About 4 hrs to fix

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

                      def initialize(info = {})
                        super(update_info(info,
                          'Name'           => 'Oracle AutoVue ActiveX Control SetMarkupMode Buffer Overflow',
                          'Description'    => %q{
                              This module exploits a vulnerability found in the AutoVue.ocx ActiveX control.
                    Severity: Major
                    Found in modules/exploits/windows/browser/oracle_autovue_setmarkupmode.rb - About 4 hrs to fix

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

                        def run
                      
                          yamlconf = load_yaml_conf
                      
                          fileto               = yamlconf['to']
                      Severity: Major
                      Found in modules/auxiliary/client/smtp/emailer.rb - About 4 hrs to fix

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

                          def run_host(ip)
                            uri = target_uri.path
                            peer = "#{ip}:#{rport}"
                        
                            vprint_status("Retrieving cookie")

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

                            def run_host(ip)
                              conn = true
                              ecode = nil
                              emesg = nil
                          
                          
                          Severity: Major
                          Found in modules/auxiliary/scanner/http/dir_scanner.rb - About 4 hrs to fix

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

                              def initialize(info = {})
                                super(
                                  update_info(
                                    info,
                                    'Name' => 'SSH Username Enumeration',
                            Severity: Major
                            Found in modules/auxiliary/scanner/ssh/ssh_enumusers.rb - About 4 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language