modules/exploits/multi/http/splunk_privilege_escalation_cve_2023_32707.rb
Method initialize
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Splunk "edit_user" Capability Privilege Escalation',
Method check
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def check
self.cookie = splunk_login(datastore['USERNAME'], datastore['PASSWORD'])
fail_with(Failure::NoAccess, 'Authentication Failed') unless cookie
res = send_request_cgi({
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def check
self.cookie = splunk_login(datastore['USERNAME'], datastore['PASSWORD'])
fail_with(Failure::NoAccess, 'Authentication Failed') unless cookie
res = send_request_cgi({
Consider simplifying this complex logical expression. Open
Open
return CheckCode::Safe("Detected Splunk version #{version} which is not vulnerable") unless
(Rex::Version.new('9.0.0') <= version && version < Rex::Version.new('9.0.5')) ||
(Rex::Version.new('8.2.0') <= version && version < Rex::Version.new('8.2.11')) ||
(Rex::Version.new('8.1.0') <= version && version < Rex::Version.new('8.1.14'))
Method splunk_change_password
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def splunk_change_password(username, password)
# due to the AutoCheck mixin and the keep_cookies option, the cookie might be already set
self.cookie ||= splunk_login(datastore['USERNAME'], datastore['PASSWORD'])
fail_with(Failure::NoAccess, 'Authentication Failed') unless cookie
- 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"