rapid7/metasploit-framework

View on GitHub
modules/exploits/linux/http/atutor_filemanager_traversal.rb

Summary

Maintainability
C
7 hrs
Test Coverage

File atutor_filemanager_traversal.rb has 273 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::FileDropper
Severity: Minor
Found in modules/exploits/linux/http/atutor_filemanager_traversal.rb - About 2 hrs to fix

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

      def initialize(info = {})
        super(
          update_info(
            info,
            'Name' => 'ATutor 2.2.1 Directory Traversal / Remote Code Execution',
    Severity: Minor
    Found in modules/exploits/linux/http/atutor_filemanager_traversal.rb - About 1 hr to fix

      Method type_juggle has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        def type_juggle
          # high padding, means higher success rate
          # also, we use numbers, so we can count requests :p
          for i in 1..8
            for @number in ('0' * i..'9' * i)
      Severity: Minor
      Found in modules/exploits/linux/http/atutor_filemanager_traversal.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 check has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def check
          # there is no real way to finger print the target so we just
          # check if we can upload a zip and extract it into the web root...
          # obviously not ideal, but if anyone knows better, feel free to change
          unless datastore['USERNAME'] && datastore['PASSWORD']
      Severity: Minor
      Found in modules/exploits/linux/http/atutor_filemanager_traversal.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 login has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def login(username, password, check = false)
          hash = Rex::Text.sha1(Rex::Text.sha1(password))
          res = send_request_cgi({
            'method' => 'POST',
            'uri' => normalize_uri(target_uri.path, 'login.php'),
      Severity: Minor
      Found in modules/exploits/linux/http/atutor_filemanager_traversal.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

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

        def exploit
          # login if needed
          if datastore['USERNAME'] && datastore['PASSWORD']
            store_valid_credential(user: datastore['USERNAME'], private: datastore['PASSWORD'])
            student_cookie = login(datastore['USERNAME'], datastore['PASSWORD'])
      Severity: Minor
      Found in modules/exploits/linux/http/atutor_filemanager_traversal.rb - About 25 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