Method get_directory_listing
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def get_directory_listing(folder)
print_status("Getting directory listing for #{folder} via XXE and FTP")
# Generate a unique callback URL
path = "/#{rand_text_alpha(rand(8..15))}.dtd"
- Read upRead up
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
File manageengine_adaudit_plus_cve_2022_28219.rb
has 322 lines of code (exceeds 250 allowed). Consider refactoring. Open
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
prepend Msf::Exploit::Remote::AutoCheck
Method get_directory_listing
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_directory_listing(folder)
print_status("Getting directory listing for #{folder} via XXE and FTP")
# Generate a unique callback URL
path = "/#{rand_text_alpha(rand(8..15))}.dtd"
Method initialize
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'ManageEngine ADAudit Plus CVE-2022-28219',
Method exploit
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exploit
# List the /users folder - this is good to do first, since we can fail early
# if something isn't working
vprint_status('Attempting to exploit XXE to get a list of users')
users = get_directory_listing('/users')
Method upload_payload
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upload_payload(payload, queue)
t = framework.threads.spawn('adaudit-payload-deliverer', false) do
c = nil
begin
# We use a TCP socket here so we can hold the socket open after the HTTP
Method exploit
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def exploit
# List the /users folder - this is good to do first, since we can fail early
# if something isn't working
vprint_status('Attempting to exploit XXE to get a list of users')
users = get_directory_listing('/users')
- Read upRead up
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
# Make sure it's ADAudit Plus by requesting the root and checking the title
res1 = send_request_cgi(
'method' => 'GET',
'uri' => '/'
- Read upRead up
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 upload_payload
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def upload_payload(payload, queue)
t = framework.threads.spawn('adaudit-payload-deliverer', false) do
c = nil
begin
# We use a TCP socket here so we can hold the socket open after the HTTP
- Read upRead up
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"