modules/exploits/multi/http/connectwise_screenconnect_rce_cve_2024_1709.rb
Method exploit
has 189 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def exploit
# Sanity check the USERNAME and PASSWORD will meet the servers password requirements.
fail_with(Failure::BadConfig, 'USERNAME must not be empty.') if datastore['USERNAME'].empty?
fail_with(Failure::BadConfig, 'PASSWORD must be 8 characters of more.') if datastore['PASSWORD'].length < 8
Method exploit
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
Open
def exploit
# Sanity check the USERNAME and PASSWORD will meet the servers password requirements.
fail_with(Failure::BadConfig, 'USERNAME must not be empty.') if datastore['USERNAME'].empty?
fail_with(Failure::BadConfig, 'PASSWORD must be 8 characters of more.') if datastore['PASSWORD'].length < 8
- 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 connectwise_screenconnect_rce_cve_2024_1709.rb
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
prepend Msf::Exploit::Remote::AutoCheck
Method initialize
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'ConnectWise ScreenConnect Unauthenticated Remote Code Execution',
Method check
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
def check
# This is a file found on the recent 23.9.7.8804 (Circa 2024), an out of support 20.3.31734 (Circa 2021), and
# a very old 2.5.3409.4645 (Circa 2012). So we can expect this file to exist on all targets. As this endpoint
# expects authentication, the response will be a 302 redirect to the Login page. As Windows is case insensitive
# we can request 'Host.aspx' with any case and get the expected 302 response, however Linux is case sensitive and
- 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"