MantisBT has a Content Security Policy bypass via attachments
Impact
Given any pre-existing XSS / HTML injection vulnerability, an attacker can bypass the Content Security Policy's _script-src_ directive by uploading a crafted attachment to any issue that, when accessed via the _file_download.php_ link, will be downloaded with a valid JavaScript MIME type resulting in script execution.
Source excerpt · OSVNon-JavaScript MIME types will not get imported in a <script> tag by the browser, due to response header X-Content-Type-Options being set to nosniff, which requires all imported JavaScript files to be a valid JavaScript MIME type.
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.
| Affected range | Recorded fix |
|---|---|
| Earlier releases before 2.28.2Ecosystem versions | 2.28.2 |
Version evidence: OSV · GHSA-9c3j-xm6v-j7j3
View original version evidence (76 explicit versions)
Original source description
Given any pre-existing XSS / HTML injection vulnerability, an attacker can bypass the Content Security Policy's script-src directive by uploading a crafted attachment to any issue that, when accessed via the file_download.php link, will be downloaded with a valid JavaScript MIME type resulting in script execution.
The uploaded payload must be sniffed as a valid JavaScript MIME type by PHP finfo (see file_create_finfo() API function). Non-JavaScript MIME types will not get imported in a <script> tag by the browser, due to response header X-Content-Type-Options being set to nosniff, which requires all imported JavaScript files to be a valid JavaScript MIME type.
Impact
Cross-site scripting
Patches
- 9e3bee2e7b909f4e3596985892b8bc8bee9e0bfe
Workarounds
None
Credits
Thanks to siunam (Tang Cheuk Hei) for discovering and responsibly reporting the issue.
References
- Security advisory github.com/mantisbt/mantisbt/security/advisories/GHSA-9c3j-xm6v-j7j3
- Security advisory nvd.nist.gov/vuln/detail/CVE-2026-40597
- Patch github.com/mantisbt/mantisbt/commit/9e3bee2e7b909f4e3596985892b8bc8bee9e0bfe
- Source reference github.com/mantisbt/mantisbt
- Source reference mantisbt.org/bugs/view.php