Headline
CVE-2023-36806: Merge pull request from GHSA-4gpr-p634-922x · contao/contao@5c9aff3
Contao is an open source content management system. Starting in version 4.0.0 and prior to versions 4.9.42, 4.13.28, and 5.1.10, it is possible for untrusted backend users to inject malicious code into headline fields in the back end, which will be executed both in the element preview (back end) and on the website (front end). Installations are only affected if there are untrusted back end users who have the rights to modify headline fields, or other fields using the input unit widget. Contao 4.9.42, 4.13.28, and 5.1.10 have a patch for this issue. As a workaround, disable the login for all untrusted back end users.
Expand Up
@@ -33,12 +33,6 @@ class TimePeriod extends Widget
*/
protected $strTemplate = 'be_widget’;
/**
* Units
* @var array
*/
protected $arrUnits = array();
/**
* Add specific attributes
*
Expand Down Expand Up
@@ -69,7 +63,7 @@ public function __set($strKey, $varValue)
break;
case 'options’:
$this->arrUnits = StringUtil::deserialize($varValue);
$this->arrOptions = StringUtil::deserialize($varValue);
break;
default:
Expand All
@@ -79,8 +73,6 @@ public function __set($strKey, $varValue)
}
/**
* Do not validate unit fields
*
* @param mixed $varInput
*
* @return mixed
Expand All
@@ -89,7 +81,15 @@ protected function validator($varInput)
{
foreach ($varInput as $k=>$v)
{
if ($k != ‘unit’)
if ($k == ‘unit’)
{
if (!$this->isValidOption($v))
{
$varInput[$k] = '’;
$this->addError($GLOBALS[‘TL_LANG’][‘ERR’][‘invalid’]);
}
}
else
{
$varInput[$k] = parent::validator($v);
}
Expand Down Expand Up
@@ -130,12 +130,12 @@ public function generate()
$arrUnits = array();
// Add an empty option if there are none (see #5067)
if (empty($this->arrUnits))
if (empty($this->arrOptions))
{
$this->arrUnits = array(array('value’=>’’, ‘label’=>’-'));
$this->arrOptions = array(array('value’=>’’, ‘label’=>’-'));
}
foreach ($this->arrUnits as $arrUnit)
foreach ($this->arrOptions as $arrUnit)
{
$arrUnits[] = sprintf(
'<option value="%s"%s>%s</option>’,
Expand Down
Related news
### Impact Authenticated users can inject malicious code in widgets with units, which is then executed both in the element preview (back end) and on the website (front end). ### Patches Update to Contao 4.9.42, 4.13.28 or 5.1.10. ### Workarounds Disable login for all untrusted back end users. ### References https://contao.org/en/security-advisories/cross-site-scripting-in-widgets-with-units ### For more information If you have any questions or comments about this advisory, open an issue in [contao/contao](https://github.com/contao/contao/issues/new/choose). ### Credits Thanks to Maximilian Seilmaier from usd AG for reporting this vulnerability.