rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

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

  def make_pdf(js)

    xref = []
    eol = "\x0d\x0a"
    endobj = "endobj" << eol
modules/exploits/windows/fileformat/adobe_flatedecode_predictor02.rb on lines 172..233

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

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 make_pdf(js)

    xref = []
    eol = "\x0d\x0a"
    endobj = "endobj" << eol
modules/exploits/windows/browser/adobe_flatedecode_predictor02.rb on lines 175..236

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

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

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::Remote::SSH

Severity: Major
Found in modules/exploits/linux/ssh/microfocus_obr_shrboadmin.rb and 1 other location - About 1 day to fix
modules/exploits/linux/ssh/cisco_ucs_scpuser.rb on lines 9..133

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

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

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::Remote::SSH

Severity: Major
Found in modules/exploits/linux/ssh/cisco_ucs_scpuser.rb and 1 other location - About 1 day to fix
modules/exploits/linux/ssh/microfocus_obr_shrboadmin.rb on lines 9..132

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

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 smart_hash_dump has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

  def smart_hash_dump(migrate_system, pwdfile)
    domain_controller = domain_controller?
    print_good('Host is a Domain Controller') if domain_controller

    if !is_uac_enabled? || is_admin?
Severity: Minor
Found in modules/post/windows/gather/smart_hashdump.rb - About 1 day 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 encode has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

  def encode
    # Get the minimum number of nops to use
    min = (reqs['MinNops'] || 0).to_i
    min = 0 if reqs['DisableNops']

Severity: Minor
Found in lib/msf/core/encoded_payload.rb - About 1 day 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 report_auth_info has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

  def report_auth_info(opts={})
    return if not active
    raise ArgumentError.new("Missing required option :host") if opts[:host].nil?
    raise ArgumentError.new("Missing required option :port") if (opts[:port].nil? and opts[:service].nil?)

Severity: Minor
Found in lib/msf/core/db_manager/cred.rb - About 1 day 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 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

            Method cmd_wmap_sites has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
            Open

                  def cmd_wmap_sites(*args)
                    args.push('-h') if args.empty?
            
                    while (arg = args.shift)
                      case arg
            Severity: Minor
            Found in plugins/wmap.rb - About 1 day 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 run has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
            Open

              def run
                found = false
                roots.each do |root|
                  break if found
            
            
            Severity: Minor
            Found in modules/auxiliary/gather/owncloud_phpinfo_reader.rb - About 1 day 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 run_host has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
            Open

              def run_host(ip)
                epm = dcerpc_endpoint_list
                if !epm
                  print_status("Could not contact the endpoint mapper on #{ip}")
                  return
            Severity: Minor
            Found in modules/auxiliary/scanner/dcerpc/hidden.rb - About 1 day 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 cmd_connect has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
            Open

              def cmd_connect(*args)
                if args.length < 2 or args.include?("-h") or args.include?("--help")
                  cmd_connect_help
                  return false
                end
            Severity: Minor
            Found in lib/msf/ui/console/command_dispatcher/core.rb - About 1 day 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 cmd_vulns has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
            Open

              def cmd_vulns(*args)
                return unless active?
            
                default_columns = ['Timestamp', 'Host', 'Name', 'References']
                host_ranges = []
            Severity: Minor
            Found in lib/msf/ui/console/command_dispatcher/db.rb - About 1 day 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

              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

            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

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