Vulnerability: A stored cross-site scripting (XSS) vulnerability in LimeSurvey before and including 3.21.1 allows authenticated users with correct permissions to inject arbitrary web script or HTML via parameter ParticipantAttributeNamesDropdown of the Attributes on the central participant database page. When the survey attribute being edited or viewed, e.g. by an administrative user, the JavaScript code will be executed in the browser.
Vulnerability ID: CVE-2020-25798
CWE: CWE-79
Severity score: 2.9
Project: https://github.com/LimeSurvey/LimeSurvey
Published: 2020-11-17
File: application/views/admin/participants/modal_subviews/_editAttribute.php
Commit message: Fixed issue #15672: LimeSurvey 3.21.1 Cross Site Scripting
Commit author: lacrioque

Vulnerable version (before fix):
                 foreach($model->getAttributesValues($model->attribute_id) as $attribute_value){                     echo "<div class='control-group'>";                     echo "<div class='dropDownContainer col-xs-8 col-offset-xs-2'>";                     echo "<input class='form-control' name='ParticipantAttributeNamesDropdown[]' value='".$attribute_value['value']."' />";                     echo "</div>";                     echo '<div class="col-xs-1">                             <button class="btn btn-default form-group action_delDropdownField">

Fixed version (after fix):
                 foreach($model->getAttributesValues($model->attribute_id) as $attribute_value){                     echo "<div class='control-group'>";                     echo "<div class='dropDownContainer col-xs-8 col-offset-xs-2'>";                     echo TbHtml::textField('ParticipantAttributeNamesDropdown[]', $attribute_value['value'], [                         'class' => 'form-control',                         'id' => ''                     ]);                     // echo "<input class='form-control' name='ParticipantAttributeNamesDropdown[]' value='".$attribute_value['value']."' />";                     echo "</div>";                     echo '<div class="col-xs-1">                             <button class="btn btn-default form-group action_delDropdownField">

Patch:
patch: @@ -59,7 +59,11 @@
                 foreach($model->getAttributesValues($model->attribute_id) as $attribute_value){
                     echo "<div class='control-group'>";
                     echo "<div class='dropDownContainer col-xs-8 col-offset-xs-2'>";
-                    echo "<input class='form-control' name='ParticipantAttributeNamesDropdown[]' value='".$attribute_value['value']."' />";
+                    echo TbHtml::textField('ParticipantAttributeNamesDropdown[]', $attribute_value['value'], [
+                        'class' => 'form-control',
+                        'id' => ''
+                    ]);
+                    // echo "<input class='form-control' name='ParticipantAttributeNamesDropdown[]' value='".$attribute_value['value']."' />";
                     echo "</div>";
                     echo '<div class="col-xs-1">
                             <button class="btn btn-default form-group action_delDropdownField">
path: application/views/admin/participants/modal_subviews/_editAttribute.php