rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

Method resolve_sid has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def resolve_sid(sid, system_name = nil)
          unless session.commands.include?(Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_RAILGUN_API)
            return nil
          end

Severity: Major
Found in lib/msf/core/post/windows/accounts.rb - About 2 hrs to fix

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

            {
              'Offsets' =>
                {
                  'CPORT' => [ 43, 'n' ],
                },
    Severity: Major
    Found in modules/payloads/singles/solaris/x86/shell_find_port.rb and 1 other location - About 2 hrs to fix
    modules/payloads/singles/bsd/x64/shell_bind_ipv6_tcp.rb on lines 27..78

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

    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
        res = send_request_cgi!({
          'uri' => normalize_uri(target_uri.path, 'login/')
        })
        return Exploit::CheckCode::Unknown("#{peer} - Could not connect to web service - no response") if res.nil?
    modules/auxiliary/gather/apache_superset_cookie_sig_priv_esc.rb on lines 60..76

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

    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
        res = send_request_cgi!({
          'uri' => normalize_uri(target_uri.path, 'login')
        })
        return Exploit::CheckCode::Unknown("#{peer} - Could not connect to web service - no response") if res.nil?
    modules/exploits/linux/http/apache_superset_cookie_sig_rce.rb on lines 78..94

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

    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

            {
              'Offsets' =>
                {
                  'LPORT'    => [ 20, 'n' ],
                },
    Severity: Major
    Found in modules/payloads/singles/bsd/x64/shell_bind_ipv6_tcp.rb and 1 other location - About 2 hrs to fix
    modules/payloads/singles/solaris/x86/shell_find_port.rb on lines 26..77

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

    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

        @xref = {}
        @pdf = ''
    
        @pdf << header
    
    
    Severity: Major
    Found in lib/msf/core/exploit/pdf.rb and 1 other location - About 2 hrs to fix
    lib/msf/core/exploit/pdf.rb on lines 276..292

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

    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

        @xref = {}
        @pdf = ''
    
        @pdf << header
        add_object(1, nobfu("<</Type/Catalog/Outlines ") << io_ref(2) << nobfu("/Pages ") << io_ref(3) << ">>")
    Severity: Major
    Found in lib/msf/core/exploit/pdf.rb and 1 other location - About 2 hrs to fix
    lib/msf/core/exploit/pdf.rb on lines 299..316

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

    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

        begin
          randdir = Rex::Text.rand_text_alpha(5).chomp + '/'
          res = send_request_cgi({
            'uri'          =>  tpath+randdir,
            'method'       => 'GET',
    Severity: Major
    Found in modules/auxiliary/scanner/http/svn_scanner.rb and 1 other location - About 2 hrs to fix
    modules/auxiliary/scanner/http/dir_webdav_unicode_bypass.rb on lines 75..113

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

    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 initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'RaspAP Unauthenticated Command Injection',
    Severity: Major
    Found in modules/exploits/unix/http/raspap_rce.rb and 1 other location - About 2 hrs to fix
    modules/exploits/unix/http/maltrail_rce.rb on lines 13..82

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

    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 initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'Maltrail Unauthenticated Command Injection',
    Severity: Major
    Found in modules/exploits/unix/http/maltrail_rce.rb and 1 other location - About 2 hrs to fix
    modules/exploits/unix/http/raspap_rce.rb on lines 13..78

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

    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

        begin
          randdir = Rex::Text.rand_text_alpha(5).chomp + '/'
          res = send_request_cgi({
            'uri'          =>  tpath+randdir,
            'method'       => 'GET',
    Severity: Major
    Found in modules/auxiliary/scanner/http/dir_webdav_unicode_bypass.rb and 1 other location - About 2 hrs to fix
    modules/auxiliary/scanner/http/svn_scanner.rb on lines 59..96

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

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

          def cmd_nessus_help(*_args)
            tbl = Rex::Text::Table.new(
              'Columns' => [
                'Command',
                'Help Text'
    Severity: Major
    Found in plugins/nessus.rb - About 2 hrs to fix

      Method rpc_round_exec has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def rpc_round_exec(mod, mtype, opts, nmaxjobs)
              res = nil
              idx = 0
      
              if active_rpc_nodes == 0
      Severity: Major
      Found in plugins/wmap.rb - About 2 hrs to fix

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

          def run_host(ip)
            os = datastore['OS']
            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_rfc_sxpg_command_exec.rb - About 2 hrs to fix

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

            def run_host(ip)
              extensions = [
                '.null',
                '.backup',
                '.bak',
          Severity: Major
          Found in modules/auxiliary/scanner/http/prev_dir_same_name_file.rb - About 2 hrs to fix

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

              def run_host(ip)
                if (datastore['REQUESTTYPE'] == "PUT") && (datastore['AUTH_URI'].blank?)
                  print_error("You need need to set AUTH_URI when using PUT Method !")
                  return
                end
            Severity: Major
            Found in modules/auxiliary/scanner/http/http_login.rb - About 2 hrs to fix

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

                def run_host(ip)
                  rhost = datastore['RHOST']
                  rport = datastore['RPORT']
                  uri = datastore['URI']
                  ssl = datastore['SSL']
              Severity: Major
              Found in modules/auxiliary/scanner/winrm/winrm_cmd.rb - About 2 hrs to fix

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

                  def run_host(ip)
                    return if not check_dependencies
                
                    # Checks for Version of Oracle. Behavior varies with oracle version.
                    # 12c uses SHA-512 (explained in more detail in report_hashes() below)
                Severity: Major
                Found in modules/auxiliary/scanner/oracle/oracle_hashdump.rb - About 2 hrs to fix

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

                    def run
                      i, a = 0, []
                  
                      self.ctarget = datastore['RHOSTS']
                      self.cport = datastore['RPORT']
                  Severity: Major
                  Found in modules/auxiliary/crawler/msfcrawler.rb - About 2 hrs to fix

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

                      def run_host(ip)
                        begin
                        last_str = nil
                        last_inp = nil
                        last_err = nil
                    Severity: Major
                    Found in modules/auxiliary/fuzzers/smtp/smtp_fuzzer.rb - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language