# CVE-2026-40076: OpenMRS Core arbitrary file write and code execution via Zip Slip in module upload

> Authenticated attackers can exploit a Zip Slip vulnerability in OpenMRS Core module uploads to write arbitrary files and execute remote code.

- **Severity:** Critical 9.4 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 6 May 2026
- **Updated:** 7 May 2026
- **Also known as:** GHSA-78fc-9688-w8xw

## What is CVE-2026-40076?

CVE-2026-40076 is a critical path traversal vulnerability in openmrs-core, published on 6 May 2026. An attacker needs administrator access to exploit it, with no action from the victim.

### Official description

OpenMRS Core is an open source electronic medical record system platform. In versions 2.7.8 and earlier and versions 2.8.0 through 2.8.5, the module upload endpoint at POST `/openmrs/ws/rest/v1/module` is vulnerable to a Zip Slip path traversal attack. During automatic extraction of uploaded .omod archives in `WebModuleUtil.startModule()`, ZIP entries under web/module/ are checked only to see whether the full entry path starts with `..,` and the remaining path is then concatenated into the destination path without normalization or a boundary check. A crafted archive can therefore include entries such as `web/module/../../../../malicious.jsp` and cause files to be written outside the intended module directory.

An authenticated attacker with module upload access can write arbitrary files to locations such as the web application root and achieve remote code execution by uploading a JSP file and then requesting it. The issue is compounded by the fact that the module.allow_web_admin runtime property is enforced in the legacy UI controller but not in the REST API upload path, so deployments relying on that property to block web-based module administration remain exposed through the REST endpoint. This issue has been fixed in versions after 2.7.8 in the 2.7.x line and in version 2.8.6 and later.

Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

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

4 open source packages ship an affected version, including org.openmrs.web:openmrs-web. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.openmrs.web:openmrs-web` | Maven | All versions to 2.7.8 | None |
| `org.openmrs.web:openmrs-web` | Maven | All versions to 2.7.8 | None |
| `org.openmrs.web:openmrs-web` | Maven | From 2.8.0 to 2.8.5 | None |
| `org.openmrs.web:openmrs-web` | Maven | From 2.8.0 to 2.8.5 | None |

Products: Openmrs Openmrs.

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

No fix has been published for CVE-2026-40076 yet. Limit exposure of the affected software until one is available.

## Is CVE-2026-40076 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-40076 exists.

## Other vulnerabilities in openmrs-core

- [CVE-2018-19276](https://insights.sbomify.com/CVE-2018-19276/): Deserialization in n/a (critical 10.0)
- [CVE-2021-43094](https://insights.sbomify.com/CVE-2021-43094/): SQL injection in n/a (critical 9.8)
- [CVE-2017-12796](https://insights.sbomify.com/CVE-2017-12796/): Deserialization in n/a (critical 9.8)
- [CVE-2026-40075](https://insights.sbomify.com/CVE-2026-40075/): OpenMRS Core arbitrary file read via path traversal in ModuleResourcesServlet (high 8.2)
- [CVE-2025-25928](https://insights.sbomify.com/CVE-2025-25928/): Cross-site request forgery in n/a (high 8.0)

## Fix prompt for AI coding agents

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

What it is: CVE-2026-40076 is a critical path traversal vulnerability in openmrs-core, published on 6 May 2026. An attacker needs administrator access to exploit it, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-40076 exists.

Affected packages and fixed versions:
- org.openmrs.web:openmrs-web (Maven): affected all versions up to 2.7.8; no fix listed
- org.openmrs.web:openmrs-web (Maven): affected all versions up to 2.7.8; no fix listed
- org.openmrs.web:openmrs-web (Maven): affected from 2.8.0 up to 2.8.5; no fix listed
- org.openmrs.web:openmrs-web (Maven): affected from 2.8.0 up to 2.8.5; no fix listed

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-40076/ (Markdown: https://insights.sbomify.com/CVE-2026-40076/index.md)
```

## Sources

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

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