rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

Method check_hku_entry has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

  def check_hku_entry(key, ip, smbshare, cmd, text, bat)
    begin
      key = key.split("HKEY_USERS\\")[1].chomp
      command = "#{cmd} /C echo reg.exe QUERY \"HKU\\#{key}\\Volatile Environment\" ^> %SYSTEMDRIVE%#{text} > #{bat} & #{cmd} /C start cmd.exe /C #{bat}"
      out = psexec(command)
Severity: Minor
Found in modules/auxiliary/scanner/smb/psexec_loggedin_users.rb - About 6 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method exploit has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

  def exploit
    factory = ssh_socket_factory

    opts = {
      auth_methods: ['password', 'keyboard-interactive'],
Severity: Minor
Found in modules/exploits/linux/ssh/vyos_restricted_shell_privesc.rb - About 6 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method decrypt_local_vault_key has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

  def decrypt_local_vault_key(account, browser_map)
    data = nil
    session_cookie_value = nil

    browser_map.each_pair do |browser, lp_data|
Severity: Minor
Found in modules/post/multi/gather/lastpass_creds.rb - About 6 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method transport_prepare_request has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

  def transport_prepare_request(method, opts={})
    unless valid_transport?(opts[:transport]) && opts[:lport]
      return nil
    end

Severity: Minor
Found in lib/rex/post/meterpreter/client_core.rb - About 6 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method dump_table_fields has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

    def dump_table_fields(table, columns, condition = '', num_limit = 0)
      return '' if columns.empty?

      one_column = columns.length == 1
      if one_column
Severity: Minor
Found in lib/msf/core/exploit/sqli/mysqli/common.rb - About 6 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

function process_list() {
    var res = new Array();
    var wbemFlagReturnImmediately = 0x10;
    var wbemFlagForwardOnly = 0x20;
    var oWMI = GetObject("winmgmts:\\\\localhost\\root\\CIMV2");
Severity: Major
Found in external/source/DLLHijackAuditKit/audit.js and 1 other location - About 6 hrs to fix
external/source/DLLHijackAuditKit/analyze.js on lines 14..27

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

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

function process_list() {
    var res = new Array();
    var wbemFlagReturnImmediately = 0x10;
    var wbemFlagForwardOnly = 0x20;
    var oWMI = GetObject("winmgmts:\\\\localhost\\root\\CIMV2");
Severity: Major
Found in external/source/DLLHijackAuditKit/analyze.js and 1 other location - About 6 hrs to fix
external/source/DLLHijackAuditKit/audit.js on lines 9..22

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

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

  def cmd_transport(*args)
    if ( args.length == 0 or args.include?("-h") )
      cmd_transport_help
      return
    end
Severity: Major
Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb - About 6 hrs to fix

    File bpf_priv_esc.rb has 446 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Exploit::Local
      Rank = GoodRanking
    
      include Msf::Post::File
      include Msf::Post::Linux::Priv
    Severity: Minor
    Found in modules/exploits/linux/local/bpf_priv_esc.rb - About 6 hrs to fix

      File varbind.rb has 446 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'snmp/ber'
      
      include SNMP::BER
      
      module SNMP
      Severity: Minor
      Found in lib/snmp/varbind.rb - About 6 hrs to fix

        File prepend_migrate.rb has 446 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Msf::Payload::Windows::PrependMigrate
        
          #
          # Initialize
          #
        Severity: Minor
        Found in lib/msf/core/payload/windows/prepend_migrate.rb - About 6 hrs to fix

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

            def build_hta(cli)
              var_shellobj    = rand_text_alpha(rand(5) + 5);
              var_fsobj    = rand_text_alpha(rand(5) + 5);
              var_fsobj_file    = rand_text_alpha(rand(5) + 5);
              var_vbsname    = rand_text_alpha(rand(5) + 5);
          modules/exploits/windows/browser/oracle_webcenter_checkoutandopen.rb on lines 94..168

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

          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 build_hta(cli)
              var_shellobj    = rand_text_alpha(rand(5) + 5);
              var_fsobj    = rand_text_alpha(rand(5) + 5);
              var_fsobj_file    = rand_text_alpha(rand(5) + 5);
              var_vbsname    = rand_text_alpha(rand(5) + 5);
          modules/exploits/windows/browser/honeywell_hscremotedeploy_exec.rb on lines 96..170

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

          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 check
              targ = rhost
          
              srv_sock = Rex::Socket.create_udp(
                'PeerHost' => targ,
          Severity: Major
          Found in modules/auxiliary/spoof/dns/bailiwicked_host.rb and 1 other location - About 6 hrs to fix
          modules/auxiliary/spoof/dns/bailiwicked_domain.rb on lines 75..150

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

          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 check
              targ = rhost
          
              srv_sock = Rex::Socket.create_udp(
                'PeerHost' => targ,
          Severity: Major
          Found in modules/auxiliary/spoof/dns/bailiwicked_domain.rb and 1 other location - About 6 hrs to fix
          modules/auxiliary/spoof/dns/bailiwicked_host.rb on lines 71..146

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

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

            def mssql_get_hash(arg = {})
              ntlm_ver = arg[:ntlm_ver]
              if ntlm_ver == NTLM_CONST::NTLM_V1_RESPONSE or ntlm_ver == NTLM_CONST::NTLM_2_SESSION_RESPONSE
                lm_hash = arg[:lm_hash]
                nt_hash = arg[:nt_hash]
          Severity: Major
          Found in modules/auxiliary/server/capture/mssql.rb - About 6 hrs to fix

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

              def run
                unless db
                  print_warning('Cannot find any active database. Extracted data will only be displayed here and NOT stored.')
                end
            
            
            Severity: Major
            Found in modules/auxiliary/gather/windows_secrets_dump.rb - About 6 hrs to fix

              Method output_endpoint_data has 167 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def output_endpoint_data(r)
                  ssl_protocols = [
                    { id: 771, name: "TLS", version: "1.2", secure: true, active: false },
                    { id: 770, name: "TLS", version: "1.1", secure: true, active: false },
                    { id: 769, name: "TLS", version: "1.0", secure: true, active: false },
              Severity: Major
              Found in modules/auxiliary/gather/ssllabs_scan.rb - About 6 hrs to fix

                File corpwatch_lookup_id.rb has 445 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'rexml/document'
                
                class MetasploitModule < Msf::Auxiliary
                  include Msf::Exploit::Remote::HttpClient
                
                
                Severity: Minor
                Found in modules/auxiliary/gather/corpwatch_lookup_id.rb - About 6 hrs to fix

                  Method check_vulnerabilities has 167 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def check_vulnerabilities(ip, ssl_version, ssl_cipher, cert)
                      # POODLE
                      if ssl_version == 'SSLv3'
                        print_good('Accepts SSLv3, vulnerable to POODLE')
                        report_vuln(
                  Severity: Major
                  Found in modules/auxiliary/scanner/ssl/ssl_version.rb - About 6 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language