rastating/wordpress-exploit-framework

View on GitHub
lib/wpxf/modules/exploit/xss/stored/universal_analytics_authenticated_xss_shell_upload.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Assignment Branch Condition size for run is too high. [17.58/15]
Open

  def run
    return false unless super

    cookie = authenticate_with_wordpress(username, password)
    return false unless cookie

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

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

  def initialize
    super

    update_info(
      name: 'Universal Analytics <= 1.3.0 Authenticated XSS Shell Upload',

    Avoid too many return statements within this method.
    Open

        return @success

      Method run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def run
          return false unless super
      
          cookie = authenticate_with_wordpress(username, password)
          return false unless cookie

      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

      Unnecessary spacing detected.
      Open

              'rastating'  # WPXF module

      This cop checks for extra/unnecessary whitespace.

      Example:

      # good if AllowForAlignment is true
      name      = "RuboCop"
      # Some comment and an empty line
      
      website  += "/bbatsov/rubocop" unless cond
      puts        "rubocop"          if     debug
      
      # bad for any configuration
      set_app("RuboCop")
      website  = "https://github.com/bbatsov/rubocop"

      Redundant return detected.
      Open

          return @success

      This cop checks for redundant return expressions.

      Example:

      def test
        return something
      end
      
      def test
        one
        two
        three
        return something
      end

      It should be extended to handle methods whose body is if/else or a case expression with a default branch.

      Prefer single-quoted strings when you don't need string interpolation or special symbols.
      Open

          emit_success "Script stored and will be executed when a user views a page"

      Checks if uses of quotes match the configured preference.

      Example: EnforcedStyle: single_quotes (default)

      # bad
      "No special symbols"
      "No string interpolation"
      "Just text"
      
      # good
      'No special symbols'
      'No string interpolation'
      'Just text'
      "Wait! What's #{this}!"

      Example: EnforcedStyle: double_quotes

      # bad
      'Just some text'
      'No special chars or interpolation'
      
      # good
      "Just some text"
      "No special chars or interpolation"
      "Every string in #{project} uses double_quotes"

      Avoid comma after the last item of an array.
      Open

              ['URL', 'https://plugins.trac.wordpress.org/changeset?sfp_email=&sfph_mail=&reponame=&new=1340918%40universal-analytics%2Ftrunk%2Funiversalanalytics.php&old=910037%40universal-analytics%2Ftrunk%2Funiversalanalytics.php'],

      This cop checks for trailing comma in array and hash literals.

      Example: EnforcedStyleForMultiline: consistent_comma

      # bad
      a = [1, 2,]
      
      # good
      a = [
        1, 2,
        3,
      ]
      
      # good
      a = [
        1,
        2,
      ]

      Example: EnforcedStyleForMultiline: comma

      # bad
      a = [1, 2,]
      
      # good
      a = [
        1,
        2,
      ]

      Example: EnforcedStyleForMultiline: no_comma (default)

      # bad
      a = [1, 2,]
      
      # good
      a = [
        1,
        2
      ]

      There are no issues that match your filters.

      Category
      Status