Headline
CVE-2021-25955: Enhance the sanitizing. · Dolibarr/dolibarr@796b2d2
In “Dolibarr ERP CRM”, WYSIWYG Editor module, v2.8.1 to v13.0.2 are affected by a stored XSS vulnerability that allows low privileged application users to store malicious scripts in the “Private Note” field at “/adherents/note.php?id=1” endpoint. These scripts are executed in a victim’s browser when they open the page containing the vulnerable field. In the worst case, the victim who inadvertently triggers the attack is a highly privileged administrator. The injected scripts can extract the Session ID, which can lead to full Account takeover of the admin and due to other vulnerability (Improper Access Control on Private notes) a low privileged user can update the private notes which could lead to privilege escalation.
@@ -345,7 +345,7 @@ public function testGETPOST()
$_GET[“param5”]="a_1-b";
$_POST[“param6”]=""><svg onload=’console.log(“123”)'>";
$_POST[“param6b”]=’<<<…/>…/>…/svg><<<…/>…/>…/animate =alert(1)>abc’;
$_GET[“param7”]=’"c:\this is a path~1\aaan" abc<bad>def</bad>’;
$_GET[“param7”]=’"c:\this is a path~1\aaan Đ" abc<bad>def</bad>’;
$_POST[“param8a”]="Hacker<svg onload=’console.log(“123”)'"; // html tag is not closed so it is not detected as html tag but is still harmfull
$_POST[‘param8b’]=’<img src=x onerror=alert(document.location) t=’; // this is html obfuscated by non closing tag
$_POST[‘param8c’]=’< with space after is ok’;
@@ -479,20 +479,20 @@ public function testGETPOST()
$this->assertEquals('">’, $result);
$result=GETPOST("param7", ‘restricthtml’);
print __METHOD__." result=".$result."\n";
$this->assertEquals('"c:\this is a path~1\aaan" abcdef’, $result);
print __METHOD__." result param7 = ".$result."\n";
$this->assertEquals('"c:\this is a path~1\aaan &#x;;;;" abcdef’, $result);
$result=GETPOST("param12", ‘restricthtml’);
print __METHOD__." result=".$result."\n";
$this->assertEquals(trim($_POST[“param12”]), $result, ‘Test a string with DOCTYPE and restricthtml’);
$result=GETPOST("param13", ‘restricthtml’);
print __METHOD__." result=".$result."\n";
$this->assertEquals('n n > < " <a href=\"alert(document.domain)\">XSS</a>’, $result, ‘Test that HTML entities are decoded with restricthtml, but only for common alpha chars’);
$this->assertEquals('n n > < " <a href=\"alert(document.domain)\">XSS</a>’, $result, ‘Test 13 that HTML entities are decoded with restricthtml, but only for common alpha chars’);
$result=GETPOST("param13b", ‘restricthtml’);
print __METHOD__." result=".$result."\n";
$this->assertEquals('n n > < " <a href=\"jvascript:alert(document.domain)\">XSS</a>’, $result, ‘Test that HTML entities are decoded with restricthtml, but only for common alpha chars’);
$this->assertEquals('n n > < " <a href=\"alert(document.domain)\">XSS</a>’, $result, ‘Test 13b that HTML entities are decoded with restricthtml, but only for common alpha chars’);
// Special test for GETPOST of backtopage, backtolist or backtourl parameter