rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

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

  def exploit
    #
    # Connect and grab the banner
    #
    ehlo = datastore['EHLO_NAME']
Severity: Major
Found in modules/exploits/unix/smtp/exim4_string_format.rb - About 7 hrs to fix

    File packet_dispatcher.rb has 462 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'rex/post/meterpreter/command_mapper'
    require 'rex/post/meterpreter/packet_response_waiter'
    require 'rex/exceptions'
    require 'pathname'
    
    
    Severity: Minor
    Found in lib/rex/post/meterpreter/packet_dispatcher.rb - About 7 hrs to fix

      Method on_request_uri has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
      Open

        def on_request_uri(cli, request)
          if request.uri =~ /status$/i
            print_status("Sending status...") if datastore['VERBOSE']
            send_response_html(cli, get_status().to_json(), { 'Content-Type' => 'application/json' })
          elsif request.uri =~ /statistics$/i
      Severity: Minor
      Found in modules/auxiliary/server/local_hwbridge.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 run_host has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
      Open

        def run_host(ip)
          print_brute(level: :vstatus, ip: ip, msg: 'Starting SMB login bruteforce')
      
          domain = datastore['SMBDomain'] || ''
      
      
      Severity: Minor
      Found in modules/auxiliary/scanner/smb/smb_login.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 load_resource has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
      Open

        def load_resource(path)
          if path == '-'
            resource_file = $stdin.read
            path = 'stdin'
          elsif ::File.exist?(path)
      Severity: Minor
      Found in lib/rex/ui/text/resource.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 parse has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.parse(data)
          if data.nil?
            return []
          end
      
      
      Severity: Minor
      Found in lib/rex/parser/group_policy_preferences.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_user_pass has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
      Open

        def each_user_pass(noconn=false,&block)
          this_service = [datastore['RHOST'],datastore['RPORT']].join(":")
          fq_rest = [this_service,"all remaining users"].join(":")
      
          # This should kinda halfway be in setup, halfway in run... need to
      Severity: Minor
      Found in lib/msf/core/auxiliary/auth_brute.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 vyos_config_eater has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
      Open

          def vyos_config_eater(thost, tport, config, store = true)
      
            credential_data = {
              address: thost,
              port: tport,
      Severity: Minor
      Found in lib/msf/core/auxiliary/vyos.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 nexpose_host_from_rawxml has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
      Open

        def nexpose_host_from_rawxml(h, vstructs, wspace,task=nil)
          hobj = nil
          data = {:workspace => wspace}
          if h["addr"]
            addr = h["addr"]
      Severity: Minor
      Found in lib/msf/core/db_manager/import/nexpose/raw.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

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

        def generate_link(unc)
          uni_unc = unc.unpack('C*').pack('v*')
          path = ''
          path << [
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00,
      modules/exploits/windows/browser/ms10_046_shortcut_icon_dllloader.rb on lines 373..415
      modules/exploits/windows/fileformat/ms15_020_shortcut_icon_dllloader.rb on lines 115..158
      modules/exploits/windows/smb/ms10_046_shortcut_icon_dllloader.rb on lines 80..122

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

      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 4 locations. Consider refactoring.
      Open

        def generate_link(unc)
          uni_unc = unc.unpack('C*').pack('v*')
          path = ''
          path << [
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00,
      modules/exploits/windows/browser/ms10_046_shortcut_icon_dllloader.rb on lines 373..415
      modules/exploits/windows/fileformat/ms15_020_shortcut_icon_dllloader.rb on lines 115..158
      modules/exploits/windows/smb/ms15_020_shortcut_icon_dllloader.rb on lines 93..135

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

      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 4 locations. Consider refactoring.
      Open

        def generate_link(unc)
          uni_unc = unc.unpack("C*").pack("v*")
          path = ''
          path << [
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00,
      modules/exploits/windows/fileformat/ms15_020_shortcut_icon_dllloader.rb on lines 115..158
      modules/exploits/windows/smb/ms10_046_shortcut_icon_dllloader.rb on lines 80..122
      modules/exploits/windows/smb/ms15_020_shortcut_icon_dllloader.rb on lines 93..135

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

      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 4 locations. Consider refactoring.
      Open

        def generate_link(unc)
          uni_unc = unc.unpack('C*').pack('v*')
          path = ''
          path << [
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00,
      modules/exploits/windows/browser/ms10_046_shortcut_icon_dllloader.rb on lines 373..415
      modules/exploits/windows/smb/ms10_046_shortcut_icon_dllloader.rb on lines 80..122
      modules/exploits/windows/smb/ms15_020_shortcut_icon_dllloader.rb on lines 93..135

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

      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::Encoder::Xor
        Rank = NormalRanking
      
        def initialize
          super(
      Severity: Major
      Found in modules/encoders/mipsle/byte_xori.rb and 1 other location - About 7 hrs to fix
      modules/encoders/mipsbe/byte_xori.rb on lines 8..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 230.

      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::Encoder::Xor
        Rank = NormalRanking
      
        def initialize
          super(
      Severity: Major
      Found in modules/encoders/mipsbe/byte_xori.rb and 1 other location - About 7 hrs to fix
      modules/encoders/mipsle/byte_xori.rb on lines 8..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 230.

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

        def initialize(info = {})
          super(update_info(info,
            'Name'           => 'PHP 4 unserialize() ZVAL Reference Counter Overflow (Cookie)',
            'Description'    => %q{
                This module exploits an integer overflow vulnerability in the unserialize()
      Severity: Major
      Found in modules/exploits/multi/php/php_unserialize_zval_cookie.rb - About 7 hrs to fix

        Method creds_search has 177 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def creds_search(*args)
            host_ranges   = []
            origin_ranges = []
            port_ranges   = []
            svcs          = []
        Severity: Major
        Found in lib/msf/ui/console/command_dispatcher/creds.rb - About 7 hrs to fix

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

            def make_pdf(js)
          
              xref = []
              eol = "\x0d\x0a"
              endobj = "endobj" << eol
          modules/exploits/windows/browser/adobe_geticon.rb on lines 166..202
          modules/exploits/windows/browser/adobe_media_newplayer.rb on lines 181..218
          modules/exploits/windows/browser/adobe_utilprintf.rb on lines 145..182
          modules/exploits/windows/fileformat/adobe_media_newplayer.rb on lines 184..220
          modules/exploits/windows/fileformat/adobe_utilprintf.rb on lines 136..173

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

          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 6 locations. Consider refactoring.
          Open

            def make_pdf(js)
          
              xref = []
              eol = "\x0d\x0a"
              endobj = "endobj" << eol
          Severity: Major
          Found in modules/exploits/windows/browser/adobe_media_newplayer.rb and 5 other locations - About 7 hrs to fix
          modules/exploits/windows/browser/adobe_geticon.rb on lines 166..202
          modules/exploits/windows/browser/adobe_utilprintf.rb on lines 145..182
          modules/exploits/windows/fileformat/adobe_collectemailinfo.rb on lines 139..176
          modules/exploits/windows/fileformat/adobe_media_newplayer.rb on lines 184..220
          modules/exploits/windows/fileformat/adobe_utilprintf.rb on lines 136..173

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

          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 6 locations. Consider refactoring.
          Open

            def make_pdf(js)
          
              xref = []
              eol = "\x0d\x0a"
              endobj = "endobj" << eol
          modules/exploits/windows/browser/adobe_geticon.rb on lines 166..202
          modules/exploits/windows/browser/adobe_media_newplayer.rb on lines 181..218
          modules/exploits/windows/browser/adobe_utilprintf.rb on lines 145..182
          modules/exploits/windows/fileformat/adobe_collectemailinfo.rb on lines 139..176
          modules/exploits/windows/fileformat/adobe_utilprintf.rb on lines 136..173

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

          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