# Stored Cross-Site Scripting (XSS) in Blocks Plugin
### Summary
<p align="justify">A Stored Cross-Site Scripting (XSS) vulnerability was identified in <code>Blocks Plugin</code> of the FluentCMS application. This vulnerability allows attackers to inject malicious scripts into the plugin. The injected scripts are stored on the server and executed automatically whenever the affected page is accessed by users, posing a significant security risk.</p>
---
### Details
<p align="justify">The application fails to properly validate and sanitize user inputs in the <code>Blocks Plugin</code>. This lack of validation allows attackers to inject malicious scripts, which are then stored on the server. Whenever the affected page is accessed, the malicious payload is executed in the victim's browser, potentially compromising the user's data and system.</p>
---
### PoC
#### Step by Step:
<p align="justify">Authenticate with admin account and acess <code>Blocks menu</code>. Click on <code>"Add Block"</code> button to setup a new entry:</br> <img align="center" src="https://hackmd.io/_uploads/SJL1iXtAbx.png"></br></br>Insert the payload in field <code>"Content"</code> and type any value in another fields, click on <code>"Submit"</code>:</br> <img align="center" src="https://hackmd.io/_uploads/SySQiXKCWx.png"></br></br> Then, access page preview by this endpoint: <code>"/?pagePreview=1"</code>. Drag and drop the Block Plugin in any place at the page: </br> <img align="center" src="https://hackmd.io/_uploads/BygjsmYA-e.png"></br></br> Click on <code>"Select"</code> button: </br> <img align="center" src="https://hackmd.io/_uploads/r1tf2QFRWe.png"></br></br>Select the Block that was set up before: </br> <img align="center" src="https://hackmd.io/_uploads/rJLHhXKR-e.png"></br></br> At least, access the page like an usual user and the script will execute automatically: </br> <img align="center" src="https://hackmd.io/_uploads/HkPv37FRbx.png"></br></br></p>
##
#### Payload:
````javascript
"><img src=x onerror=alert('CVE-Hunters')>
````
---
### Impact
<p align="justify">
<ul>
<li>Stealing session cookies: Attackers can use stolen session cookies to hijack a user's session and perform actions on their behalf.</li>
<li>Downloading malware: Attackers can trick users into downloading and installing malware on their computers.</li>
<li>Hijacking browsers: Attackers can hijack a user's browser or deliver browser-based exploits.</li>
<li>Stealing credentials: Attackers can steal a user's credentials.</li>
<li>Obtaining sensitive information: Attackers can obtain sensitive information stored in a user's account or in their browser.</li>
<li>Defacing websites: Attackers can deface a website by altering its content.</li>
<li>Misdirecting users: Attackers can change the instructions given to users who visit the target website, misdirecting their behavior.</li>
<li>Damaging a business's reputation: Attackers can damage a business's image or spread misinformation by defacing a corporate website.</li>
</ul>
</p>
---
### Finder
*Discovered with💜 by [Karina Gante](https://karinagante.github.io/).*
> *Official Member of [CVE-Hunters](https://www.cvehunters.com/)🏹*