modules/exploits/multi/http/subrion_cms_file_upload_rce.rb
Method initialize
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Intelliants Subrion CMS 4.2.1 - Authenticated File Upload Bypass to RCE',
Method login_and_get_csrf_token
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def login_and_get_csrf_token(username, password)
print_status('Connecting to Subrion Admin Panel login page to obtain CSRF token...')
# Session cookies need to be kept to preserve the CSRF token across multiple requests
uri = normalize_uri(target_uri.path, 'panel/')
Method upload_and_execute_payload
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def upload_and_execute_payload(csrf_token)
print_status('Preparing payload...')
# set `unlink_self: true` to delete the file after execution
payload_name = "#{Rex::Text.rand_text_alpha_lower(10)}.phar"
Method check
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def check
uri = normalize_uri(target_uri.path, 'panel/') # requires a trailing forward slash
print_status("Checking target web server for a response at: #{full_uri(uri)}")
res = send_request_cgi({
'method' => 'GET',
Method check
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def check
uri = normalize_uri(target_uri.path, 'panel/') # requires a trailing forward slash
print_status("Checking target web server for a response at: #{full_uri(uri)}")
res = send_request_cgi({
'method' => 'GET',
- 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 login_and_get_csrf_token
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def login_and_get_csrf_token(username, password)
print_status('Connecting to Subrion Admin Panel login page to obtain CSRF token...')
# Session cookies need to be kept to preserve the CSRF token across multiple requests
uri = normalize_uri(target_uri.path, 'panel/')
- 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
Avoid too many return
statements within this method. Open
Open
return CheckCode::Safe