usd-2024-0009 | Reflected XSS in Oveleon Cookiebar
Details
Advisory ID: usd-2024-0009
Product: Cookiebar
Affected Version: 2.X
Vulnerability Type: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Security Risk: HIGH, CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:L/VA:N/SC:L/SI:L/SA:N
Vendor URL: https://www.usd.de/
Vendor acknowledged vulnerability: Yes
Vendor Status: Fixed
CVE Number: Not requested yet
CVE Link: Not requested yet
First Published: Published
Last Update: 2024-07-29
Affected Component
The block function in CookiebarController.php.
Desciption
Oveleon's Cookiebar is an extension for the popular Contao CMS.
The block/locale endpoint does not properly sanitize the user-controlled locale input before including it in the backend's HTTP response, thereby causing reflected XSS.
Proof of Concept
The vulnerability could be triggered by entering the following Link:
https://[redacted].de/cookiebar/block/dens82w%22%3E%3Cimg%20src%3da%20onerror%3dalert(1)%3Ew9qt
n/[id]?redirect=https%3A%2F%2F[...]amp%3Biv_load_policy%3D3%26amp%3Bmo
destbranding%3D1%26amp%3Brel%3D0
It is likely related to the following function in the Oveleon Cookiebar source code:
/**
* Block content
*
* @Route("/cookiebar/block/{locale}/{id}", name="cookiebar_block")
*/
public function block(Request $request, string $locale, int $id): Response
{
System::loadLanguageFile('tl_cookiebar', $locale);
$this->framework->initialize();
$objCookie = CookieModel::findById($id);
if (null === $objCookie || null === $request->headers->get('referer'))
{
throw new PageNotFoundException();
}
$strUrl = $request->get('redirect');
// Protect against XSS attacks
if(!Validator::isUrl($strUrl))
{
return new Response('The redirect destination must be a valid URL.', Response::HTTP_BAD_REQUEST);
}
$objTemplate = new FrontendTemplate($objCookie->blockTemplate ?: 'ccb_element_blocker');
$objTemplate->language = $locale;
$objTemplate->id = $objCookie->id;
$objTemplate->title = $objCookie->title;
$objTemplate->type = $objCookie->type;
$objTemplate->iframeType = $objCookie->iframeType;
$objTemplate->description = $objCookie->blockDescription;
$objTemplate->redirect = $request->get('redirect');
$objTemplate->acceptAndDisplayLabel = $this->translator->trans('tl_cookiebar.acceptAndDisplayLabel', [], 'contao_default', $locale);
return $objTemplate->getResponse();
}