rapid7/metasploit-framework

View on GitHub

Showing 7,287 of 21,960 total issues

File dnn_cookie_deserialization_rce.rb has 547 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'openssl'
require 'set'

class MetasploitModule < Msf::Exploit::Remote
  include Msf::Exploit::Remote::HttpClient
Severity: Major
Found in modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb - About 1 day to fix

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

      def exploit
        if check != CheckCode::Appears
          fail_with(Failure::NotVulnerable, 'Target not vulnerable! punt!')
        end
    
    
    Severity: Major
    Found in modules/exploits/linux/local/netfilter_priv_esc_ipv4.rb - About 1 day to fix

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

        def run
          max_search = datastore['MAX_SEARCH']
      
          db, dbfile = create_sqlite_db
          print_status "Temporary database created: #{dbfile.path}"
      Severity: Major
      Found in modules/post/windows/gather/ad_to_sqlite.rb - About 1 day to fix

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

          def generate(_opts = {})
            uri = URI(datastore['HOPURL'])
            #create actual payload
            payload_data = <<EOS
          cld            ; clear direction flag
        Severity: Major
        Found in modules/payloads/stagers/windows/reverse_hop_http.rb - About 1 day to fix

          File winenum.rb has 539 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          @client = client
          opts = Rex::Parser::Arguments.new(
            "-h" => [ false, "Help menu." ],
            "-m" => [ false, "Migrate the Meterpreter Session from it current process to a new cmd.exe before doing anything" ],
            "-r" => [ false, "Dump, compress and download entire Registry" ],
          Severity: Major
          Found in scripts/meterpreter/winenum.rb - About 1 day to fix

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

              def exploit
                if !datastore['ForceExploit'] && is_root?
                  fail_with(Failure::BadConfig, 'Session already has root privileges. Set ForceExploit to override.')
                end
            
            
            Severity: Major
            Found in modules/exploits/linux/local/bpf_priv_esc.rb - About 1 day to fix

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

                def calculate_race(server, domain, num=50)
              
                  q_beg_t = nil
                  q_end_t = nil
                  cnt     = 0
              Severity: Major
              Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb and 1 other location - About 1 day to fix
              modules/auxiliary/spoof/dns/bailiwicked_host.rb on lines 395..474

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

              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 calculate_race(server, domain, num=50)
              
                  q_beg_t = nil
                  q_end_t = nil
                  cnt     = 0
              Severity: Major
              Found in modules/auxiliary/spoof/dns/bailiwicked_host.rb and 1 other location - About 1 day to fix
              modules/auxiliary/spoof/dns/bailiwicked_domain.rb on lines 398..477

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

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

                def run
                  '
                Hash format
                  :name,
                  :check_file,
              Severity: Major
              Found in modules/post/windows/gather/credentials/vnc.rb - About 1 day to fix

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

                  def run_host(target_host)
                    case
                      when action.name == 'LISTFILES'
                        res = http_post('listFiles')
                        unless res
                Severity: Major
                Found in modules/auxiliary/scanner/http/es_file_explorer_open_port.rb - About 1 day to fix

                  File command_shell.rb has 534 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'shellwords'
                  require 'rex/text/table'
                  require "base64"
                  
                  module Msf
                  Severity: Major
                  Found in lib/msf/base/sessions/command_shell.rb - About 1 day to fix

                    Method getMbeanServer has 220 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private MBeanServer getMbeanServer() {
                    
                            return new MBeanServer() {
                    
                                @Override
                    Severity: Major
                    Found in external/source/exploits/CVE-2010-0094/Exploit.java - About 1 day to fix

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

                        def exploit
                          # Make initial request to get assigned a session token
                          cookie = "pagerefresh=1; NfaupdateMsg=true; sortBy=sByName; testcookie=; "
                          cookie << "am_username=;am_check="
                          begin
                      Severity: Major
                      Found in modules/exploits/windows/http/manageengine_apps_mngr.rb - About 1 day to fix

                        Method process_propfind has 218 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def process_propfind(cli, request)
                            path = request.uri
                            print_status("Received WebDAV PROPFIND request for #{path}")
                            body = ''
                        
                        
                        Severity: Major
                        Found in modules/exploits/windows/browser/ms10_046_shortcut_icon_dllloader.rb - About 1 day to fix

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

                            def initialize(info = {})
                              super(merge_info(info,
                                'Name'          => 'Windows x64 Pingback, Reverse TCP Inline',
                                'Description'   => 'Connect back to attacker and report UUID (Windows x64)',
                                'Author'        => [ 'bwatters-r7' ],
                          Severity: Major
                          Found in modules/payloads/singles/windows/x64/pingback_reverse_tcp.rb - About 1 day to fix

                            Method exploit_html has 217 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def exploit_html(req_uri)
                                srvhost = datastore['SRVHOST']
                                srvport = datastore['SRVPORT']
                            
                                template = <<-EOF
                            Severity: Major
                            Found in modules/exploits/windows/browser/ms16_051_vbscript.rb - About 1 day to fix

                              Method custom_inflections has 216 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def custom_inflections
                                  {
                                    'uuid' => 'UUID',
                                    'db_manager' => 'DBManager',
                                    'ci' => 'CI',
                              Severity: Major
                              Found in lib/msf_autoload.rb - About 1 day to fix

                                File solarwinds_orion_dump.rb has 526 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                require 'metasploit/framework/credential_collection'
                                
                                class MetasploitModule < Msf::Post
                                  include Msf::Post::Common
                                  include Msf::Post::File
                                Severity: Major
                                Found in modules/post/windows/gather/credentials/solarwinds_orion_dump.rb - About 1 day to fix

                                  File apache_superset_cookie_sig_rce.rb has 525 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  class MetasploitModule < Msf::Exploit::Remote
                                    Rank = GoodRanking
                                    include Msf::Exploit::Remote::HttpClient
                                  
                                    def initialize(info = {})
                                  Severity: Major
                                  Found in modules/exploits/linux/http/apache_superset_cookie_sig_rce.rb - About 1 day to fix

                                    Method cmd_hosts has 215 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      def cmd_hosts(*args)
                                        return unless active?
                                        onlyup = false
                                        set_rhosts = false
                                        mode = []
                                    Severity: Major
                                    Found in lib/msf/ui/console/command_dispatcher/db.rb - About 1 day to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language