@thehunckerma (https://huntr.dev/users/thehunckerma) has fixed a potential Stored Cross Site Scripting vulnerability in your repository π¨. For more information, visit our website (https://huntr.dev/) or click the bounty URL below...
If you are happy with this disclosure, we would love to get a CVE assigned to the vulnerability. Feel free to credit @thehunckerma, the discloser found in the bounty URL (below) and @huntr-helper.
DigiDocu is rendering the description field in the admin's users page without escaping it. A WYSIWYG editor is provided to the users for the profile description which itself has a built-in sanitizer. The user can bypass the WYSIWYG's default sanitizer by intercepting the request (using Burp Suite for instance) and insert some malicious XSS payload. Our fix is to sanitize the HTML before inserting it into the database.
π» Technical Description *
We are using stevebauman's purify library which is a wrapper around ezyang's htmlpurifier which is a famous standards-compliant HTML filter library.
We replace the description input with the sanitized version before inserting it into the database
// app/Http/Requests/UpdateProfileRequest.php
/**
* Extend the default getValidatorInstance method
* so description field can be escaped
*
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function getValidatorInstance()
{
$request = $this->toArray(); // extract all inputs
if (array_key_exists('description', $request)) {
$description = $request["description"]; // get description input
$escaped_description = Purify::clean($description); // escape the data
$this->merge(array('description' => $escaped_description)); // replace the old data with the new escaped one
}
return parent::getValidatorInstance();
}
π Proof of Concept (PoC) *
User test is editing his profile:
User test intercepts the request using Burp Suite:
User test adds his XSS payload to the description input:
Admin super visits test's profile, XSS payload gets executed:
π₯ Proof of Fix (PoF) *
User test is editing his profile:
User test intercepts the request using Burp Suite and adds his XSS payload to the description input:
Admin super visits test's profile, the <img/> element is rendered but the XSS payload is not executed:
The HTML element is sanitized:
π User Acceptance Testing (UAT)
There is no unit testing in this project but the feature in question (the WYSIWYG editor) is still working and the HTML is being rendered properly.
@thehunckerma (https://huntr.dev/users/thehunckerma) has fixed a potential Stored Cross Site Scripting vulnerability in your repository π¨. For more information, visit our website (https://huntr.dev/) or click the bounty URL below...
Q | A Version Affected | * Bug Fix | YES Original Pull Request | https://github.com/418sec/digidocu/pull/1
If you are happy with this disclosure, we would love to get a CVE assigned to the vulnerability. Feel free to credit @thehunckerma, the discloser found in the bounty URL (below) and @huntr-helper.
User Comments:
π Metadata *
Bounty URL: https://huntr.dev/bounties/2-other-digidocu/
βοΈ Description *
DigiDocu is rendering the description field in the admin's users page without escaping it. A WYSIWYG editor is provided to the users for the profile description which itself has a built-in sanitizer. The user can bypass the WYSIWYG's default sanitizer by intercepting the request (using Burp Suite for instance) and insert some malicious XSS payload. Our fix is to sanitize the HTML before inserting it into the database.
π» Technical Description *
We are using stevebauman's purify library which is a wrapper around ezyang's htmlpurifier which is a famous standards-compliant HTML filter library. We replace the description input with the sanitized version before inserting it into the database
π Proof of Concept (PoC) *
User test is editing his profile:
User test intercepts the request using Burp Suite:
User test adds his XSS payload to the description input:
Admin super visits test's profile, XSS payload gets executed:
π₯ Proof of Fix (PoF) *
User test is editing his profile:
User test intercepts the request using Burp Suite and adds his XSS payload to the description input:
Admin super visits test's profile, the
<img/>
element is rendered but the XSS payload is not executed:The HTML element is sanitized:
π User Acceptance Testing (UAT)
There is no unit testing in this project but the feature in question (the WYSIWYG editor) is still working and the HTML is being rendered properly.