rapid7/metasploit-framework

View on GitHub
modules/exploits/multi/http/ubiquiti_unifi_log4shell.rb

Summary

Maintainability
A
4 hrs
Test Coverage

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

  def initialize(_info = {})
    super(
      'Name' => 'UniFi Network Application Unauthenticated JNDI Injection RCE (via Log4Shell)',
      'Description' => %q{
        The Ubiquiti UniFi Network Application versions 5.13.29 through 6.5.53 are affected by the Log4Shell
Severity: Major
Found in modules/exploits/multi/http/ubiquiti_unifi_log4shell.rb - About 2 hrs to fix

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

      def check
        validate_configuration!
        res = send_request_cgi('uri' => normalize_uri(target_uri, 'status'))
        return Exploit::CheckCode::Unknown('No HTTP response was received.') if res.nil?
    
    
    Severity: Minor
    Found in modules/exploits/multi/http/ubiquiti_unifi_log4shell.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 exploit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def exploit
        validate_configuration!
    
        @exploiting = true
        start_service
    Severity: Minor
    Found in modules/exploits/multi/http/ubiquiti_unifi_log4shell.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

    Avoid too many return statements within this method.
    Open

        return Exploit::CheckCode::Unknown('No HTTP response was received.') if res.nil?
    Severity: Major
    Found in modules/exploits/multi/http/ubiquiti_unifi_log4shell.rb - About 30 mins to fix

      There are no issues that match your filters.

      Category
      Status