# CVE-2026-40597: MantisBT has a Content Security Policy bypass via attachments

> Attackers can bypass Content Security Policy restrictions by uploading crafted attachments with valid JavaScript MIME types, enabling script execution.

- **Severity:** High 7.6 (`CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 22 May 2026
- **Updated:** 26 May 2026
- **Also known as:** GHSA-9c3j-xm6v-j7j3

## What is CVE-2026-40597?

CVE-2026-40597 is a high-severity vulnerability in mantisbt, published on 22 May 2026. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

Mantis Bug Tracker (MantisBT) is an open source issue tracker. In versions 2.28.1 and below, 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. This issue has been fixed in version 2.28.2.

Weakness: CWE-79 (Improper Neutralization of Input During Web Page Generation), CWE-358 (Improperly Implemented Security Check for Standard)

## Which versions are affected by CVE-2026-40597?

2 open source packages ship an affected version, including mantisbt/mantisbt.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `mantisbt/mantisbt` | Packagist | All versions | 2.28.2 |
| `mantisbt/mantisbt` | Packagist | All versions | 2.28.2 |

## How do I fix CVE-2026-40597?

Upgrade mantisbt/mantisbt to 2.28.2 or later.

## Is CVE-2026-40597 being exploited?

There is no known exploitation of CVE-2026-40597 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-40597 and fix it if it is affected.

What it is: CVE-2026-40597 is a high-severity vulnerability in mantisbt, published on 22 May 2026. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-40597 in the wild and no public exploit code.

Affected packages and fixed versions:
- mantisbt/mantisbt (Packagist): affected all versions; fixed in 2.28.2
- mantisbt/mantisbt (Packagist): affected all versions; fixed in 2.28.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-40597/ (Markdown: https://insights.sbomify.com/CVE-2026-40597/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-40597
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-40597
- OSV: https://osv.dev/vulnerability/CVE-2026-40597

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-40597/
Summaries are generated and may contain mistakes; the official description above is the record.
