unlayer / react-email-editor

Drag-n-Drop Email Editor Component for React.js
https://unlayer.com/
MIT License
4.6k stars 742 forks source link

⚠️ Stored XSS via the auto-save feature #339

Closed raghunandhanvr closed 1 year ago

raghunandhanvr commented 1 year ago

Overview: A stored Cross-Site Scripting (XSS) vulnerability has been identified in the Drag and Drop Email Editor's Autosave feature. This vulnerability can allow an attacker to execute malicious code on the victim's browser and can lead to severe consequences.

XSS: Cross-Site Scripting (XSS) is a type of web security vulnerability that allows attackers to inject malicious code into web pages viewed by other users. The code can then execute in the victim's browser, leading to a range of harmful outcomes such as stealing sensitive data, taking control of the victim's session, or distributing malware.

Potential Impact: A stored XSS vulnerability like the one found in the Drag and Drop Email Editor's Autosave feature can have significant consequences for the users of the application. Attackers can exploit this vulnerability to inject and execute malicious code in the victim's browser, leading to a wide range of harmful outcomes, such as stealing sensitive data, taking control of the victim's session, or distributing malware.

Proof of Concept (PoC): The vulnerability was discovered by adding the following payload in the Autosave feature of the editor.

<img src=x onerror=alert(1)>

Here Instead of alert(1) I can run any javascript. For example I can write a XSS payload to get the JWT token and send it to my remote server

https://user-images.githubusercontent.com/65498602/236232340-148dec11-8894-4835-bdfd-6d152c93263b.mp4

image

I can fix this vulnerability if you provide a basic knowledge transfer of the react-email-editor codebase to me

Remediation: To fix the vulnerability, the application's code base should be audited to identify and sanitize all input and output points that interact with user data, such as forms, query parameters, cookies, and headers. Input sanitization should be performed on both the client and server sides, and output should be encoded properly to prevent malicious code execution.

Conclusion: In conclusion, the identified stored XSS vulnerability in the Drag and Drop Email Editor's Autosave feature can have severe consequences for the application's users. It is recommended to fix the issue as soon as possible.