rapid7/metasploit-framework

View on GitHub
modules/exploits/linux/misc/saltstack_salt_unauth_rce.rb

Summary

Maintainability
C
1 day
Test Coverage

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

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'SaltStack Salt Master/Minion Unauthenticated RCE',
Severity: Major
Found in modules/exploits/linux/misc/saltstack_salt_unauth_rce.rb - About 4 hrs to fix

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

      def exploit
        if target.name.start_with?('Master')
          if (root_key = datastore['ROOT_KEY'])
            print_status("User-specified root key: #{root_key}")
          else
    Severity: Minor
    Found in modules/exploits/linux/misc/saltstack_salt_unauth_rce.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 yeet_send_pub has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def yeet_send_pub
        print_status("Yeeting _send_pub() at #{peer}")
    
        # NOTE: A unique JID (job ID) is needed for every published job
        jid = generate_jid
    Severity: Minor
    Found in modules/exploits/linux/misc/saltstack_salt_unauth_rce.rb - About 1 hr to fix

      Method yeet_runner has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def yeet_runner(root_key)
          print_status("Yeeting runner() at #{peer}")
      
          # https://github.com/saltstack/salt/blob/v2019.2.3/salt/master.py#L1898-L1951
          # https://github.com/saltstack/salt/blob/v3000.1/salt/master.py#L1898-L1951
      Severity: Minor
      Found in modules/exploits/linux/misc/saltstack_salt_unauth_rce.rb - About 1 hr to fix

        There are no issues that match your filters.

        Category
        Status