rapid7/metasploit-framework

View on GitHub
modules/auxiliary/admin/http/cisco_ssm_onprem_account.rb

Summary

Maintainability
B
5 hrs
Test Coverage

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

  def run
    begin
      @xsrf_token_value ||= xsrf_token_value
      @auth_token ||= auth_token(@xsrf_token_value)
      @reset_password ||= reset_password(@xsrf_token_value, @auth_token)
Severity: Minor
Found in modules/auxiliary/admin/http/cisco_ssm_onprem_account.rb - About 1 hr 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 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Cisco Smart Software Manager (SSM) On-Prem Account Takeover (CVE-2024-20419)',
Severity: Minor
Found in modules/auxiliary/admin/http/cisco_ssm_onprem_account.rb - About 1 hr to fix

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

      def run
        begin
          @xsrf_token_value ||= xsrf_token_value
          @auth_token ||= auth_token(@xsrf_token_value)
          @reset_password ||= reset_password(@xsrf_token_value, @auth_token)
    Severity: Minor
    Found in modules/auxiliary/admin/http/cisco_ssm_onprem_account.rb - About 1 hr to fix

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

        def check
          begin
            @xsrf_token_value = xsrf_token_value
            @auth_token = auth_token(@xsrf_token_value)
            @reset_password = reset_password(@xsrf_token_value, @auth_token)
      Severity: Minor
      Found in modules/auxiliary/admin/http/cisco_ssm_onprem_account.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

      Avoid too many return statements within this method.
      Open

            return Exploit::CheckCode::Appears('Password reset was successful, target is vulnerable')
      Severity: Major
      Found in modules/auxiliary/admin/http/cisco_ssm_onprem_account.rb - About 30 mins to fix

        There are no issues that match your filters.

        Category
        Status