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_js(encoded_payload)

    # The following executes a ret2lib using icucnv36.dll
    # The effect is to bypass DEP and execute the shellcode in an indirect way
    stack_data = [
Severity: Major
Found in modules/exploits/windows/browser/adobe_cooltype_sing.rb and 1 other location - About 7 hrs to fix
modules/exploits/windows/fileformat/adobe_cooltype_sing.rb on lines 128..329

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

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_js(encoded_payload)

    # The following executes a ret2lib using icucnv36.dll
    # The effect is to bypass DEP and execute the shellcode in an indirect way
    stack_data = [
Severity: Major
Found in modules/exploits/windows/fileformat/adobe_cooltype_sing.rb and 1 other location - About 7 hrs to fix
modules/exploits/windows/browser/adobe_cooltype_sing.rb on lines 141..342

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

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 on_request_uri(cli, request)
    # Re-generate the payload.
    return if ((p = regenerate_payload(cli)) == nil)

    # Encode the shellcode.
Severity: Major
Found in modules/exploits/windows/browser/ms08_053_mediaencoder.rb and 1 other location - About 7 hrs to fix
modules/exploits/windows/browser/softartisans_getdrivename.rb on lines 54..114

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

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 on_request_uri(cli, request)
    # Re-generate the payload.
    return if ((p = regenerate_payload(cli)) == nil)

    # Encode the shellcode.
modules/exploits/windows/browser/ms08_053_mediaencoder.rb on lines 54..110

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

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

Class ConsoleCommandDispatcher has 55 methods (exceeds 20 allowed). Consider refactoring.
Open

    class ConsoleCommandDispatcher
      include Msf::Ui::Console::CommandDispatcher

      def name
        PLUGIN_NAME
Severity: Major
Found in plugins/nessus.rb - About 7 hrs to fix

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

    def build(name):
        location = locate('%s.asm' % name)
        if location:
            input = os.path.normpath(os.path.join(location, name))
            output = os.path.normpath(os.path.join('./bin/', name))
    Severity: Major
    Found in external/source/shellcode/windows/x86/build.py and 1 other location - About 7 hrs to fix
    external/source/shellcode/windows/x64/build.py on lines 37..47

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

    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(name):
        location = locate('%s.asm' % name)
        if location:
            input = os.path.normpath(os.path.join(location, name))
            output = os.path.normpath(os.path.join('./bin/', name))
    Severity: Major
    Found in external/source/shellcode/windows/x64/build.py and 1 other location - About 7 hrs to fix
    external/source/shellcode/windows/x86/build.py on lines 35..45

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

    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

    File safari_jit.rb has 493 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Exploit::Remote
      Rank = GoodRanking
    
      include Msf::Post::File
      include Msf::Exploit::Remote::HttpServer::HTML
    Severity: Minor
    Found in modules/exploits/apple_ios/browser/safari_jit.rb - About 7 hrs to fix

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

        def exploit
          # lots of this file's format is based on pkexec.rb
      
          # direct copy of code from exploit-db
          main = %q{
      Severity: Major
      Found in modules/exploits/unix/local/netbsd_mail_local.rb - About 7 hrs to fix

        Method cmd_reg has 195 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def cmd_reg(*args)
            # Extract the command, if any
            cmd = args.shift
        
            if (args.length == 0)
        Severity: Major
        Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb - About 7 hrs to fix

          Method init has 194 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

             @SuppressWarnings("unchecked")
             public void init()
               {
              try
                {
          Severity: Major
          Found in external/source/exploits/cve-2010-4452/AppletX.java - About 7 hrs to fix

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

              def exploit
                print_status('Trying to detect if target is running a supported version of piwik')
                res = send_request_cgi({
                  'method' => 'GET',
                  'uri' => normalized_index
            Severity: Major
            Found in modules/exploits/unix/webapp/piwik_superuser_plugin_upload.rb - About 7 hrs to fix

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

                def exploit
                  print_status('Trying to detect if target is running a supported version of piwik')
                  res = send_request_cgi({
                    'method' => 'GET',
                    'uri' => normalized_index
              Severity: Minor
              Found in modules/exploits/unix/webapp/piwik_superuser_plugin_upload.rb - About 7 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_trigger_decrypt has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
              Open

                def decrypt_trigger_decrypt(org_file, new_file, temp_file)
                  [org_file, new_file, temp_file].each do |f|
                    f.insert(0, @paths['ff'])
                  end
              
              
              Severity: Minor
              Found in modules/post/multi/gather/firefox_creds.rb - About 7 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 start_element has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
              Open

                def start_element(name, attrs)
                  @state[:current_tag][name] = true
                  case name
                  when "description", "information"
                    return unless in_tag("detaillist")
              Severity: Minor
              Found in lib/rex/parser/outpost24_document.rb - About 7 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 cmd_db_import has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
              Open

                def cmd_db_import(*args)
                  return unless active?
                  openvas_cert = false
                  openvas_dfn = false
                ::ApplicationRecord.connection_pool.with_connection {
              Severity: Minor
              Found in lib/msf/ui/console/command_dispatcher/db.rb - About 7 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 opts_to_services has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
              Open

                def opts_to_services(hosts,opts)
                ::ApplicationRecord.connection_pool.with_connection {
                  wspace = find_workspace(opts[:workspace])
                  services = []
                  if opts[:host] or opts[:address] or opts[:addresses]
              Severity: Minor
              Found in lib/msf/core/rpc/v10/rpc_db.rb - About 7 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 each_unfiltered_username_first has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
              Open

                  def each_unfiltered_username_first
                    if pass_file.present?
                      pass_fd = File.open(pass_file, 'r:binary')
                    end
              
              
              Severity: Minor
              Found in lib/metasploit/framework/credential_collection.rb - About 7 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

              File manage_engine_dc_pmp_sqli.rb has 489 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class MetasploitModule < Msf::Exploit::Remote
                Rank = ExcellentRanking
              
                include Msf::Exploit::Remote::HttpClient
                include Msf::Exploit::FileDropper
              Severity: Minor
              Found in modules/exploits/multi/http/manage_engine_dc_pmp_sqli.rb - About 7 hrs to fix

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

                  def recv_telnet(fd, timeout)
                
                    data = ''
                
                    begin
                Severity: Major
                Found in lib/msf/core/exploit/remote/telnet.rb and 1 other location - About 7 hrs to fix
                lib/metasploit/framework/telnet/client.rb on lines 140..202

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

                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

                Severity
                Category
                Status
                Source
                Language