rapid7/metasploit-framework

View on GitHub
modules/exploits/unix/webapp/wp_total_cache_exec.rb

Summary

Maintainability
C
1 day
Test Coverage

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

  def exploit
    unless wordpress_and_online?
      fail_with(Failure::NoTarget, "#{target_uri} does not seeem to be Wordpress site")
    end

Severity: Minor
Found in modules/exploits/unix/webapp/wp_total_cache_exec.rb - About 4 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 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def exploit
    unless wordpress_and_online?
      fail_with(Failure::NoTarget, "#{target_uri} does not seeem to be Wordpress site")
    end

Severity: Major
Found in modules/exploits/unix/webapp/wp_total_cache_exec.rb - About 2 hrs to fix

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

      def initialize(info = {})
        super(update_info(info,
          'Name'           => 'WordPress W3 Total Cache PHP Code Execution',
          'Description'    => %q{
              This module exploits a PHP Code Injection vulnerability against WordPress plugin
    Severity: Major
    Found in modules/exploits/unix/webapp/wp_total_cache_exec.rb - About 2 hrs to fix

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

        def check
          res = wordpress_and_online?
          unless res
            vprint_error("#{peer} does not seeem to be Wordpress site")
            return Exploit::CheckCode::Unknown
      Severity: Minor
      Found in modules/exploits/unix/webapp/wp_total_cache_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

      Avoid too many return statements within this method.
      Open

          return Exploit::CheckCode::Safe
      Severity: Major
      Found in modules/exploits/unix/webapp/wp_total_cache_exec.rb - About 30 mins to fix

        There are no issues that match your filters.

        Category
        Status