rapid7/metasploit-framework

View on GitHub
modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb

Summary

Maintainability
D
2 days
Test Coverage

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

  def exploit
    downfile = datastore['DOWNFILE'] || rand_text_alpha(8+rand(8))
    uri = '/pppoe.cgi'
    user = datastore['HttpUsername']
    pass = datastore['HttpPassword']
Severity: Minor
Found in modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb - About 3 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 exploit has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def exploit
    downfile = datastore['DOWNFILE'] || rand_text_alpha(8+rand(8))
    uri = '/pppoe.cgi'
    user = datastore['HttpUsername']
    pass = datastore['HttpPassword']
Severity: Major
Found in modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb - About 3 hrs to fix

    File netgear_dgn2200b_pppoe_exec.rb has 285 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Exploit::Remote
      Rank = ManualRanking
    
      include Msf::Exploit::Remote::HttpClient
      include Msf::Exploit::Remote::HttpServer
    Severity: Minor
    Found in modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb - About 2 hrs to fix

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

        def initialize(info = {})
          super(update_info(info,
            'Name'        => 'Netgear DGN2200B pppoe.cgi Remote Command Execution',
            'Description' => %q{
                Some Netgear Routers are vulnerable to an authenticated OS command injection
      Severity: Major
      Found in modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb - About 2 hrs to fix

        Method grab_config has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def grab_config(user,pass)
            print_status("#{rhost}:#{rport} - Trying to download the original configuration")
            begin
              res = send_request_cgi({
                'uri'     => '/BAS_pppoe.htm',
        Severity: Minor
        Found in modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb - About 1 hr to fix

          Method request has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def request(cmd,user,pass,uri)
              begin
          
              #original post request
              #login_type=PPPoE%28PPP+over+Ethernet%29&pppoe_username=%26%20COMMAND%20%26
          Severity: Minor
          Found in modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb - About 1 hr to fix

            Method grab_config has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def grab_config(user,pass)
                print_status("#{rhost}:#{rport} - Trying to download the original configuration")
                begin
                  res = send_request_cgi({
                    'uri'     => '/BAS_pppoe.htm',
            Severity: Minor
            Found in modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb - About 45 mins 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

                if (datastore['DOWNHOST'])
                  service_url = 'http://' + datastore['DOWNHOST'] + ':' + datastore['SRVPORT'].to_s + resource_uri
                else
                  #do not use SSL
                  if datastore['SSL']
            Severity: Major
            Found in modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb and 3 other locations - About 2 hrs to fix
            modules/exploits/linux/http/dlink_diagnostic_exec_noauth.rb on lines 122..149
            modules/exploits/linux/http/dlink_dir615_up_exec.rb on lines 155..179
            modules/exploits/multi/sap/sap_mgmt_con_osexec_payload.rb on lines 216..242

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

            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
                  res = send_request_cgi({
                    'uri'     => '/BAS_pppoe.htm',
                    'method'  => 'GET',
                    'authorization' => basic_auth(user,pass)
            Severity: Major
            Found in modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb and 1 other location - About 2 hrs to fix
            modules/exploits/linux/http/linksys_wrt54gl_apply_exec.rb on lines 86..105

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

            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

                register_options(
                  [
                    OptString.new('HttpUsername', [ true, 'The username to authenticate as', 'admin' ]),
                    OptString.new('HttpPassword', [ true, 'The password for the specified username', 'password' ]),
                    OptAddress.new('DOWNHOST', [ false, 'An alternative host to request the MIPS payload from' ]),
            Severity: Minor
            Found in modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb and 1 other location - About 50 mins to fix
            modules/exploits/linux/smtp/exim4_dovecot_exec.rb on lines 52..60

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

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

              def wait_linux_payload
                print_status("#{rhost}:#{rport} - Waiting for the victim to request the ELF payload...")
            
                waited = 0
                while (not @elf_sent)
            Severity: Major
            Found in modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb and 7 other locations - About 45 mins to fix
            modules/exploits/linux/http/dlink_diagnostic_exec_noauth.rb on lines 210..218
            modules/exploits/linux/http/dlink_dir615_up_exec.rb on lines 245..253
            modules/exploits/linux/http/linksys_e1500_apply_exec.rb on lines 238..246
            modules/exploits/linux/http/linksys_wrt54gl_apply_exec.rb on lines 405..413
            modules/exploits/linux/http/netgear_dgn1000b_setup_exec.rb on lines 242..250
            modules/exploits/linux/smtp/exim4_dovecot_exec.rb on lines 71..79
            modules/exploits/multi/sap/sap_mgmt_con_osexec_payload.rb on lines 310..318

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

            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

                  if [200, 301, 302].include?(res.code)
                    print_good("#{rhost}:#{rport} - Successful login #{user}/#{pass}")
                  else
                    fail_with(Failure::NoAccess, "#{rhost}:#{rport} - No successful login possible with #{user}/#{pass}")
            Severity: Minor
            Found in modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb and 1 other location - About 35 mins to fix
            modules/exploits/linux/http/linksys_wrt160nv2_apply_exec.rb on lines 120..123

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

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

              def on_request_uri(cli, request)
                #print_status("on_request_uri called: #{request.inspect}")
                if (not @pl)
                  print_error("#{rhost}:#{rport} - A request came in, but the payload wasn't ready yet!")
                  return
            Severity: Major
            Found in modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb and 10 other locations - About 20 mins to fix
            modules/exploits/linux/http/dlink_diagnostic_exec_noauth.rb on lines 198..206
            modules/exploits/linux/http/dlink_dir615_up_exec.rb on lines 233..241
            modules/exploits/linux/http/linksys_e1500_apply_exec.rb on lines 226..234
            modules/exploits/linux/http/linksys_wrt54gl_apply_exec.rb on lines 393..401
            modules/exploits/linux/http/netgear_dgn1000b_setup_exec.rb on lines 230..238
            modules/exploits/linux/smtp/exim4_dovecot_exec.rb on lines 85..92
            modules/exploits/multi/http/bassmaster_js_injection.rb on lines 87..94
            modules/exploits/multi/http/rails_dynamic_render_code_exec.rb on lines 95..102
            modules/exploits/multi/http/trendmicro_threat_discovery_admin_sys_time_cmdi.rb on lines 137..144
            modules/exploits/multi/sap/sap_mgmt_con_osexec_payload.rb on lines 298..306

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

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

                if (datastore['DOWNHOST'])
                  print_status("#{rhost}:#{rport} - Giving #{datastore['HTTP_DELAY']} seconds to the Netgear device to download the payload")
                  select(nil, nil, nil, datastore['HTTP_DELAY'])
                else
                  wait_linux_payload
            Severity: Minor
            Found in modules/exploits/linux/http/netgear_dgn2200b_pppoe_exec.rb and 5 other locations - About 15 mins to fix
            modules/exploits/linux/http/dlink_diagnostic_exec_noauth.rb on lines 167..171
            modules/exploits/linux/http/dlink_dir615_up_exec.rb on lines 197..201
            modules/exploits/linux/http/linksys_wrt160nv2_apply_exec.rb on lines 169..173
            modules/exploits/linux/smtp/exim4_dovecot_exec.rb on lines 209..213
            modules/exploits/multi/sap/sap_mgmt_con_osexec_payload.rb on lines 263..267

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

            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

            There are no issues that match your filters.

            Category
            Status