rapid7/metasploit-framework

View on GitHub
modules/exploits/osx/local/rsh_libmalloc.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method sploit has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def sploit
    user = cmd_exec("whoami").chomp
    vprint_status("The current effective user is #{user}. Starting the sploit")
    # Get size of sudoers file
    sudoer_path = "/etc/sudoers"
Severity: Minor
Found in modules/exploits/osx/local/rsh_libmalloc.rb - About 1 hr to fix

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

      def initialize(info = {})
        super(update_info(info,
          'Name'           => 'Mac OS X 10.9.5 / 10.10.5 - rsh/libmalloc Privilege Escalation',
          'Description'    => %q{
            This module writes to the sudoers file without root access by exploiting rsh and malloc log files.
    Severity: Minor
    Found in modules/exploits/osx/local/rsh_libmalloc.rb - About 1 hr to fix

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

        def exploit
          if is_root?
            fail_with Failure::BadConfig, 'Session already has root privileges'
          end
      
      
      Severity: Minor
      Found in modules/exploits/osx/local/rsh_libmalloc.rb - About 1 hr to fix

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

          def exploit
            if is_root?
              fail_with Failure::BadConfig, 'Session already has root privileges'
            end
        
        
        Severity: Minor
        Found in modules/exploits/osx/local/rsh_libmalloc.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

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

          def cleanup
            vprint_status("Starting the cron restore process...")
            super
            # Restore crontab back to is original state
            # If we don't do this, then cron will continue to append the no password rule to sudoers.
        Severity: Minor
        Found in modules/exploits/osx/local/rsh_libmalloc.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

        Method sploit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def sploit
            user = cmd_exec("whoami").chomp
            vprint_status("The current effective user is #{user}. Starting the sploit")
            # Get size of sudoers file
            sudoer_path = "/etc/sudoers"
        Severity: Minor
        Found in modules/exploits/osx/local/rsh_libmalloc.rb - About 35 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