CVE-2026-40597: MantisBT Content Security Policy bypass in file_download.php

CVE-2026-40597 · Severity: high · CVSS 4 · Published 2026-05-22

Mantis Bug Tracker (MantisBT) is an open-source platform used by organizations to track software bugs and project issues. A security flaw in the file attachment system allows attackers to bypass the application's security policies by uploading specially crafted files that the system incorrectly identifies as executable scripts. If an attacker also finds a way to inject basic HTML into the site, they can use this flaw to execute malicious code in a victim's browser, potentially leading to the theft of sensitive session data or unauthorized actions.

Technologies: MantisBT, mantisbt/mantisbt (Packagist). Vendors: MantisBT, Packagist.

Quick answers

Is CVE-2026-40597 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-40597 being exploited in the wild.
How severe is CVE-2026-40597?
High severity, with a CVSS score of 4, published 22 May 2026.
Which products and versions are affected?
MantisBT <= 2.28.1; mantisbt/mantisbt (Packagist) <= 2.28.1, ECOSYSTEM:introduced=0,fixed=2.28.2.
Is there a fix for CVE-2026-40597?
Yes. mantisbt/mantisbt (Packagist): upgrade to 2.28.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-40597 attacked?
It is attacked over the network, in a web application.
Am I affected by CVE-2026-40597?
Check whether you run MantisBT or mantisbt/mantisbt (Packagist) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • mantisbt/mantisbt (Packagist): upgrade to 2.28.2 or later
    composer require mantisbt/mantisbt:^2.28.2

Technical details

A Content Security Policy (CSP) bypass exists in MantisBT versions 2.28.1 and below within the file_download.php component. The vulnerability occurs because the application uses PHP's finfo_buffer (via file_create_finfo) to determine MIME types; certain file headers (e.g., #!/usr/bin/env node) cause the system to serve attachments with an 'application/javascript' MIME type. An attacker with low privileges can upload such a file and, if a separate HTML/XSS injection point exists, reference the attachment in a <script> tag to bypass 'script-src' directives. This bypasses the 'nosniff' protection because the served MIME type is valid for JavaScript. The issue is resolved in version 2.28.2 by forcing 'application/javascript' files to be downloaded as attachments rather than served inline.

Affected products

  • MantisBT MantisBT <= 2.28.1

Identifiers

  • CVE-2026-40597
  • GHSA-9c3j-xm6v-j7j3

Timeline

  • 2026-04-12: disclosed: Initial report by siunam
  • 2026-05-09: advisory: GitHub Security Advisory published
  • 2026-05-22: patched: Version 2.28.2 released

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.