View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0037016 | mantisbt | security | public | 2026-04-12 07:09 | 2026-05-09 19:56 |
| Reporter | siunam | Assigned To | dregad | ||
| Priority | immediate | Severity | major | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Target Version | 2.28.2 | Fixed in Version | 2.28.2 | ||
| Summary | 0037016: CVE-2026-40597: Content Security Policy bypass via attachments | ||||
| 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
When finfo sees that the buffer starts with | ||||
| Steps To Reproduce |
| ||||
| Additional Information | This was originally reported as part of 0037011 by @siunam. After analysis and discussion, it was agreed that it is in fact a separate vulnerability. Proposed approach to fix (from 0037011:0070961):
| ||||
| Tags | No tags attached. | ||||
| Attached Files | |||||
|
Advisory https://github.com/mantisbt/mantisbt/security/advisories/GHSA-9c3j-xm6v-j7j3 created, CVE request sent. Please review and comment, thanks. |
|
|
I think the CVSS score should be 0: |
|
|
I also want to clarify that this CSP bypass is not a vulnerability, but rather a security risk. This is because this bypass requires other vulnerabilities (i.e.: HTML injection) to have security impacts. |
|
I'm not sure I agree with your assessement. As I understand the concept, a Risk is the probability of something harmful happening, i.e. that a Threat exploits the Vulnerability, combined with the consequences of that. In my opinion, we clearly have a flaw in the software (i.e. a Vulnerability) here. The fact that another vulnerability is required to effectively exploit it does not make it a Risk. |
|
|
Looks like I misunderstood security risk with other things. But the point is that CSP bypass is always a security risk because it removes a layer of protection. However, it can be escalated to a vulnerability when it actively enables an attacker to exploit an underlying flaw (like HTML injection in this case) that the CSP was specifically intended to prevent. |
|
|
CVE-2026-40597 assigned |
|
|
@siunam, patch is available for review https://github.com/mantisbt/mantisbt-private/pull/7, feedback welcome. |
|
|
I confirmed the patch fixed the vulnerability! I also left some comments on that PR. |
|
|
MantisBT: master-2.28 26647b2e 2026-05-03 13:46 Details Diff |
Restrict MIME type for file downloads Until now, file_download.php was sending attachments content with a MIME type determined by PHP's Fileinfo [1]. This creates a risk of JavaScript execution bypassing the Content Security Policy. We now only set the Content-Type header for known safe types (e.g. PDF and images), all text types are forced to text/plain and the rest is sent as application/octet-stream. Includes corrections following review by vboctor. Fixes 0037016, GHSA-9c3j-xm6v-j7j3 / CVE-2026-40597 [1]: https://www.php.net/manual/en/book.fileinfo.php |
Affected Issues 0037016, 0037020 |
|
| mod - file_download.php | Diff File | ||