bagisto has Cross Site Scripting (XSS) issue in TinyMCE Image Upload (HTML)
The advisory, in context
Summary
In Bagisto v2.3.7, the TinyMCE image upload functionality allows an attacker with sufficient privileges (e.g. admin) to upload a crafted HTML file containing embedded JavaScript. When viewed, the malicious code executes in the context of the admin/user’s browser.
Details
The application blocks the uploading of HTML files; however, if the backend detected that the content of the .png file is HTML or JavaScript, the file extension will be automatically converted from .png to .html. When the HTML is viewed, it will execute the JavaScript code.
PoC
Created a html file, renamed the extension to .png, and uploaded the file. It was converted to HTML file in the backend. When opened in another tab, the JavaScript code will execute. <img width="1605" height="702" alt="image" src="https://github.com/user-attachments/assets/bd9406aa-2380-464f-ac21-32d483639969" /> <img width="1358" height="314" alt="image" src="https://github.com/user-attachments/assets/e5a64a5a-39fb-4fdb-ada9-14c4b9554803" />
Impact
A aalicious script is stored in HTML file and executed when the content is viewed. An attacker (with upload privilege) can target other admin users or editors who view the content, enabling session hijacking, unauthorized actions, or privilege escalation.
Affected packages
Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.
Earlier releases before 2.3.8
Fixed in 2.3.8
64 explicitly affected versions
v0.1.0, v0.1.1, v0.1.2, v0.1.3, v0.1.4, v0.1.4-BETA1, v0.1.4-BETA2, v0.1.4-BETA3, v0.1.4-BETA4, v0.1.5, v0.1.6, v0.1.6-ALPHA1, v0.1.7, v0.1.7-BETA1, v0.1.7-BETA2, v0.1.8, v0.1.9, v0.1.9-BETA1, v0.2.0, v0.2.1, v0.2.2, v1.0.0, v1.0.0-BETA1, v1.1.0, v1.1.1, v1.1.2, v1.2.0, v1.2.0-BETA1, v1.3.0, v1.3.1, v1.3.2, v1.3.3, v1.4.0, v1.4.1, v1.4.2, v1.4.3, v1.4.4, v1.4.5, v1.5.0, v1.5.1, v2.0.0, v2.0.0-BETA-1, v2.1.0, v2.1.1, v2.1.2, v2.2.0, v2.2.1, v2.2.10, v2.2.2, v2.2.3, v2.2.4, v2.2.5, v2.2.6, v2.2.7, v2.2.8, v2.2.9, v2.3.0, v2.3.1, v2.3.2, v2.3.3, v2.3.4, v2.3.5, v2.3.6, v2.3.7
View affected-version evidence
{
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.3.8"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"v0.1.0",
"v0.1.1",
"v0.1.2",
"v0.1.3",
"v0.1.4",
"v0.1.4-BETA1",
"v0.1.4-BETA2",
"v0.1.4-BETA3",
"v0.1.4-BETA4",
"v0.1.5",
"v0.1.6",
"v0.1.6-ALPHA1",
"v0.1.7",
"v0.1.7-BETA1",
"v0.1.7-BETA2",
"v0.1.8",
"v0.1.9",
"v0.1.9-BETA1",
"v0.2.0",
"v0.2.1",
"v0.2.2",
"v1.0.0",
"v1.0.0-BETA1",
"v1.1.0",
"v1.1.1",
"v1.1.2",
"v1.2.0",
"v1.2.0-BETA1",
"v1.3.0",
"v1.3.1",
"v1.3.2",
"v1.3.3",
"v1.4.0",
"v1.4.1",
"v1.4.2",
"v1.4.3",
"v1.4.4",
"v1.4.5",
"v1.5.0",
"v1.5.1",
"v2.0.0",
"v2.0.0-BETA-1",
"v2.1.0",
"v2.1.1",
"v2.1.2",
"v2.2.0",
"v2.2.1",
"v2.2.10",
"v2.2.2",
"v2.2.3",
"v2.2.4",
"v2.2.5",
"v2.2.6",
"v2.2.7",
"v2.2.8",
"v2.2.9",
"v2.3.0",
"v2.3.1",
"v2.3.2",
"v2.3.3",
"v2.3.4",
"v2.3.5",
"v2.3.6",
"v2.3.7"
]
}