rapid7/metasploit-framework

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

Summary

Maintainability
D
2 days
Test Coverage

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

  def exploit
    marker = rand_text_alpha(6)
    sqli_rand = rand_text_numeric(4+rand(4))
    sqli = "' and (select 1 from(select count(*),concat((select (select concat(0x#{marker.unpack('H*')[0]},Hex(cast(id as char)),0x#{marker.unpack('H*')[0]})) "
    sqli << "from alienvault.sessions where login='admin' limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) and '#{sqli_rand}'='#{sqli_rand}"
Severity: Major
Found in modules/exploits/linux/http/alienvault_sqli_exec.rb - About 6 hrs to fix

    File alienvault_sqli_exec.rb has 301 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Exploit::Remote
      Rank = ExcellentRanking
    
      include Msf::Exploit::Remote::HttpClient
    
    
    Severity: Minor
    Found in modules/exploits/linux/http/alienvault_sqli_exec.rb - About 3 hrs to fix

      Method cleanup has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def cleanup
          begin
            # Clean up, retrieve token so that the policy can be removed
            print_status("Cleaning up")
            res = send_request_cgi({
      Severity: Major
      Found in modules/exploits/linux/http/alienvault_sqli_exec.rb - About 2 hrs to fix

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

          def exploit
            marker = rand_text_alpha(6)
            sqli_rand = rand_text_numeric(4+rand(4))
            sqli = "' and (select 1 from(select count(*),concat((select (select concat(0x#{marker.unpack('H*')[0]},Hex(cast(id as char)),0x#{marker.unpack('H*')[0]})) "
            sqli << "from alienvault.sessions where login='admin' limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) and '#{sqli_rand}'='#{sqli_rand}"
        Severity: Minor
        Found in modules/exploits/linux/http/alienvault_sqli_exec.rb - About 2 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 initialize has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def initialize(info={})
            super(update_info(info,
              'Name'           => "AlienVault OSSIM SQL Injection and Remote Code Execution",
              'Description'    => %q{
                This module exploits an unauthenticated SQL injection vulnerability affecting AlienVault
        Severity: Minor
        Found in modules/exploits/linux/http/alienvault_sqli_exec.rb - About 1 hr to fix

          Method cleanup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def cleanup
              begin
                # Clean up, retrieve token so that the policy can be removed
                print_status("Cleaning up")
                res = send_request_cgi({
          Severity: Minor
          Found in modules/exploits/linux/http/alienvault_sqli_exec.rb - About 55 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

          There are no issues that match your filters.

          Category
          Status