rapid7/metasploit-framework

View on GitHub

Showing 7,361 of 22,177 total issues

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

  def enum_interfaces(wlan_handle)
    iflist = @wlanapi.WlanEnumInterfaces(wlan_handle, nil, 4)
    pointer = iflist['ppInterfaceList']

    numifs = @host_process.memory.read(pointer, 4)
Severity: Major
Found in modules/post/windows/wlan/wlan_probe_request.rb and 3 other locations - About 4 hrs to fix
modules/post/windows/wlan/wlan_bss_list.rb on lines 196..242
modules/post/windows/wlan/wlan_current_connection.rb on lines 263..310
modules/post/windows/wlan/wlan_disconnect.rb on lines 299..345

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

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 enum_interfaces(wlan_handle)
    iflist = @wlanapi.WlanEnumInterfaces(wlan_handle, nil, 4)
    pointer = iflist['ppInterfaceList']

    numifs = @host_process.memory.read(pointer, 4)
Severity: Major
Found in modules/post/windows/wlan/wlan_bss_list.rb and 3 other locations - About 4 hrs to fix
modules/post/windows/wlan/wlan_current_connection.rb on lines 263..310
modules/post/windows/wlan/wlan_disconnect.rb on lines 299..345
modules/post/windows/wlan/wlan_probe_request.rb on lines 107..153

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

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 enum_interfaces(wlan_handle)
    iflist = @wlanapi.WlanEnumInterfaces(wlan_handle, nil, 4)
    pointer = iflist['ppInterfaceList']

    numifs = @host_process.memory.read(pointer, 4)
Severity: Major
Found in modules/post/windows/wlan/wlan_disconnect.rb and 3 other locations - About 4 hrs to fix
modules/post/windows/wlan/wlan_bss_list.rb on lines 196..242
modules/post/windows/wlan/wlan_current_connection.rb on lines 263..310
modules/post/windows/wlan/wlan_probe_request.rb on lines 107..153

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

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 enum_interfaces(wlan_handle)
    iflist = @wlanapi.WlanEnumInterfaces(wlan_handle, nil, 4)
    pointer = iflist['ppInterfaceList']

    numifs = @host_process.memory.read(pointer, 4)
Severity: Major
Found in modules/post/windows/wlan/wlan_current_connection.rb and 3 other locations - About 4 hrs to fix
modules/post/windows/wlan/wlan_bss_list.rb on lines 196..242
modules/post/windows/wlan/wlan_disconnect.rb on lines 299..345
modules/post/windows/wlan/wlan_probe_request.rb on lines 107..153

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

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

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Monitorr unauthenticated Remote Code Execution (RCE)',
Severity: Major
Found in modules/exploits/multi/http/monitorr_webshell_rce_cve_2020_28871.rb - About 4 hrs to fix

    Method initialize has 107 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'Apache Solr Remote Code Execution via Velocity Template',
    Severity: Major
    Found in modules/exploits/multi/http/solr_velocity_rce.rb - About 4 hrs to fix

      Method send_payload_objdata has 107 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def send_payload_objdata
          # basic weblogic ClassTableEntry object (serialized)
          # TODO: WHAT DOES THIS DO?  CAN WE RANDOMIZE ANY OF IT?
          objdata = '056508000000010000001b0000005d0101007372017870737202787000000000'
          objdata << '00000000757203787000000000787400087765626c6f67696375720478700000'
      Severity: Major
      Found in modules/exploits/multi/misc/weblogic_deserialize_rawobject.rb - About 4 hrs to fix

        Method initialize has 107 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def initialize(info = {})
            super(
              update_info(
                info,
                {
        Severity: Major
        Found in modules/exploits/windows/local/bits_ntlm_token_impersonation.rb - About 4 hrs to fix

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

            def exploit
          
              @basename = rand_text_alpha(3)
              @share_name = rand_text_alpha(3)
              @extensions = "exe"
          Severity: Major
          Found in modules/exploits/windows/http/sap_host_control_cmd_exec.rb - About 4 hrs to fix

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

              def exploit
            
                print_status("Creating '#{datastore['FILENAME']}' using target '#{target.name}' ...")
            
                sploit = "[CloneCD]\r\n"
            Severity: Major
            Found in modules/exploits/windows/fileformat/ultraiso_ccd.rb - About 4 hrs to fix

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

                def run
                  case session.platform
                  when 'windows'
                    if command_exists?('wmic') == false
                      print_error("The 'wmic' command doesn't exist on this host!") # wmic is technically marked as depreciated so this command could very well be removed in future releases.
              Severity: Major
              Found in modules/post/multi/gather/enum_software_versions.rb - About 4 hrs to fix

                Method init_proc has 107 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def init_proc
                    %Q^
                      HANDLE* init_process(SOCKET s)
                      {
                        char cmd[] = { 'c', 'm', 'd', 0 };
                Severity: Major
                Found in lib/msf/core/payload/windows/encrypted_reverse_tcp.rb - About 4 hrs to fix

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

                      public final IntBuffer [] spray(short[] sc, short[] np)
                        {
                            int cnt = 50; // total 50 mb
                            int sz = 1024*1024; // 1 mb
                            int nops = (sz / 4) - (sc.length);
                  Severity: Major
                  Found in external/source/exploits/CVE-2009-3867/AppletX.java and 1 other location - About 4 hrs to fix
                  external/source/exploits/CVE-2009-3869/AppletX.java on lines 84..111

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

                  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

                      public final IntBuffer [] spray(short[] sc, short[] np)
                        {
                            int cnt = 50; // total 50 mb
                            int sz = 1024*1024; // 1 mb
                            int nops = (sz / 4) - (sc.length);
                  Severity: Major
                  Found in external/source/exploits/CVE-2009-3869/AppletX.java and 1 other location - About 4 hrs to fix
                  external/source/exploits/CVE-2009-3867/AppletX.java on lines 113..140

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

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

                    def run
                      # setting up some basic variables
                      uri = datastore['TARGETURI']
                      user = datastore['HttpUsername']
                      rhost = datastore['RHOST']
                  Severity: Major
                  Found in modules/auxiliary/admin/http/linksys_wrt54gl_exec.rb - About 4 hrs to fix

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

                      def run_host(ip)
                        host_port = "#{ip}:#{datastore['RPORT']}"
                        type = 'ROUTER_ADM'
                        version = 0x26
                        cmd = 0x2
                    Severity: Major
                    Found in modules/auxiliary/scanner/sap/sap_router_info_request.rb - About 4 hrs to fix

                      Method exec_php has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def exec_php(php_code, is_check = false)
                      
                          # remove comments, line breaks and spaces of php_code
                          payload_clean = php_code.gsub(/(\s+)|(#.*)/, '')
                      
                      
                      Severity: Major
                      Found in modules/exploits/multi/http/x7chat2_php_exec.rb - About 4 hrs to fix

                        Method set_win32k_offsets has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def set_win32k_offsets
                            @set_win32k_offsets ||= proc do |version|
                              case version
                              when '6.3.9600.17393'
                                {
                        Severity: Major
                        Found in modules/exploits/windows/local/ms15_078_atmfd_bof.rb - About 4 hrs to fix

                          Method on_request_uri has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def on_request_uri(cli, request)
                          
                              agent = request.headers['User-Agent']
                              my_target = get_target(agent)
                          
                          
                          Severity: Major
                          Found in modules/exploits/windows/browser/ms12_037_same_id.rb - About 4 hrs to fix

                            Method enum_vm_cust_spec has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def enum_vm_cust_spec
                                vpx_customization_specs = get_vpx_customization_spec(shell_vcdb_pass, vcdb_user, vcdb_name)
                            
                                if vpx_customization_specs.nil?
                                  print_warning('No vpx_customization_spec entries evident')
                            Severity: Major
                            Found in modules/post/linux/gather/vcenter_secrets_dump.rb - About 4 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language