OpenMRS Core CVE-2026-40075
HIGHAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
ReconIdentify OpenMRS instance with vulnerable Tomcat version
-
DeliveryEnumerate valid module IDs from login page resources
-
ExploitCraft path traversal request with ..;/ sequences
-
InstallModuleResourcesServlet processes unsanitized path
-
C2Retrieve arbitrary filesystem files
-
ExecuteExtract credentials from configuration files
-
ImpactPivot to backend systems
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK
2 techniques across 2 tactics: Discovery, Collection The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires the target OpenMRS deployment to run on Apache Tomcat version earlier than 8.5.31 (for Tomcat 8.5.x) or earlier than 9.0.10 (for Tomcat 9.x), as these container versions do not mitigate the ..;/ path parameter bypass technique. The attacker must identify at least one valid installed module ID on the target instance, obtainable through client-side observation of resource requests made by the login page or through common module name enumeration. No authentication, user interaction, or special application configuration is required-the /openmrs/moduleResources/ endpoint is intentionally exposed pre-authentication to serve static assets for the login interface. Deployments on Tomcat 8.5.31+, 9.0.10+, or later are protected at the container layer regardless of OpenMRS version, though the underlying code vulnerability remains. The vulnerability is exploitable against default OpenMRS configurations on vulnerable Tomcat versions. |
| Impact | This vulnerability presents moderate real-world risk despite its High CVSS score. The attack vector is network-based with low complexity (AV:N/AC:L) and requires no authentication (PR:N), privileges, or user interaction (UI:N), enabling straightforward exploitation. However, successful exploitation has a critical prerequisite: the target must run on Apache Tomcat versions earlier than 8.5.31 (released March 2018) or 9.0.10, significantly limiting the vulnerable population six years post-disclosure. The CVSS vector correctly reflects high confidentiality impact (C:H) as attackers can extract database credentials, API keys, and other secrets from configuration files, though no integrity or availability impact exists (I:N/A:N). No EPSS score, KEV status, or public POC availability data was provided, preventing complete exploitation probability assessment. The SSVC decision framework would likely classify this as 'Scheduled' rather than 'Immediate' priority due to the Tomcat version dependency, though organizations running legacy Tomcat installations face 'Out-of-Band' priority. The partial fix availability (2.8.6 released but no patch for 2.7.x branch) creates ongoing exposure for installations on the legacy branch. Real-world impact depends entirely on Tomcat version-modern deployments are container-protected despite the application-layer defect remaining unfixed. |
| Exploit ScenarioDerived | An external attacker identifies an internet-facing OpenMRS installation running on Tomcat 8.5.30 by fingerprinting the login page. Without authentication, they enumerate installed module names from client-side resource requests and discover the 'legacyui' module. The attacker crafts an HTTP GET request to /openmrs/moduleResources/legacyui/..;/..;/..;/..;/..;/..;/etc/passwd which bypasses the Tomcat path traversal protections due to the legacy container version. The ModuleResourcesServlet processes the malformed path without validation, resolves it to the absolute filesystem path /etc/passwd, and returns the file contents in the HTTP 200 response. Using the same technique, the attacker then retrieves application configuration files containing database credentials and API keys, enabling lateral movement to backend systems. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – May 04, 2026
Path traversal in OpenMRS Core's ModuleResourcesServlet allows unauthenticated attackers to read arbitrary files from the server filesystem, including sensitive configuration files and system files like /etc/passwd. The vulnerability exists in versions ≤ 2.7.8 and 2.8.0-2.8.5, with exploitation requiring Apache Tomcat < 8.5.31 where path parameter bypass protections are absent. Fix available in version 2.8.6 for the 2.8.x branch; no patch released for 2.7.x series at time of analysis. CVSS 7.5 (High) reflects network-accessible unauthenticated exploitation with high confidentiality impact.
RemediationAI
Organizations running OpenMRS Core 2.8.x should immediately upgrade to version 2.8.6, which implements path normalization and boundary validation checks in ModuleResourcesServlet per the vendor advisory at https://github.com/openmrs/openmrs-core/security/advisories/GHSA-jjgj-cx3q-pw4w. For installations on the 2.7.x branch where no official patch exists, the primary compensating control is upgrading the underlying Apache Tomcat container to version 8.5.31 or later (or 9.0.10+ for Tomcat 9.x), which blocks the ..;/ bypass technique at the container level-this mitigation addresses the exploit vector but does not remediate the underlying code defect. As a secondary defense-in-depth measure, implement web application firewall (WAF) rules or reverse proxy filtering to detect and block requests containing path traversal sequences (../, ..;/, %2e%2e%2f) to the /openmrs/moduleResources/ endpoint, though this creates ongoing operational overhead and may generate false positives. If upgrading Tomcat is not immediately feasible, consider restricting network access to the OpenMRS instance to trusted IP ranges only, though this significantly impacts usability and does not address insider threat scenarios. Organizations unable to upgrade either OpenMRS or Tomcat should assess their exposure by verifying which module resources are actually required pre-authentication and consider temporarily disabling unused modules to reduce attack surface.
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in maven
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
The vulnerability stems from improper input validation in the ModuleResourcesServlet Java class within OpenMRS Core's web module (pkg:maven/org.openmrs.web:openmrs-web). This servlet handles static resource requests for OpenMRS modules via the /openmrs/moduleResources/{moduleid} endpoint and is intentionally excluded from authentication filters because these resources must be accessible on the login page. The root cause (CWE-22: Improper Limitation of a Pathname to a Restricted Directory) exists in the getFile() method's unsafe concatenation of user-controlled path input without normalization or boundary validation. The code directly appends unsanitized path segments to filesystem paths without checking whether the resolved path remains within the intended module resources directory. Exploitation relies on a known Apache Tomcat path traversal bypass technique using the ..; sequence, which was patched in Tomcat 8.5.31/9.0.10 but remains unmitigated in the OpenMRS application layer. The codebase already contains correct path traversal protection patterns in StartupFilter.java using normalize().startsWith() validation, but this protection was not applied consistently to ModuleResourcesServlet.
Know when Tomcat gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
Primary rating from Vendor (https://github.com/openmrs/openmrs-core) · only source for this CVE.
CVSS VectorVendor: https://github.com/openmrs/openmrs-core
Lifecycle Timeline
2DescriptionCVE.org
Affected Versions
version ≤ 2.7.8 (latest version at time of disclosure)
https://github.com/openmrs/openmrs-core
Impact
The /openmrs/moduleResources/{moduleid} endpoint in OpenMRS Core is vulnerable to a path traversal attack. The ModuleResourcesServlet does not properly validate user-supplied path input, allowing an attacker to traverse directories and read arbitrary files from the server filesystem (e.g., /etc/passwd, application configuration files containing database credentials).
This endpoint serves static module resources (CSS, JS, images) and is not protected by authentication filters, as these resources are required for rendering the login page. Therefore, this vulnerability can be exploited by an unauthenticated attacker.
> Note: Successful exploitation requires the target deployment to run on Apache Tomcat < 8.5.31, where the ..; path parameter bypass is not mitigated by the container. Deployments on Tomcat ≥ 8.5.31 / ≥ 9.0.10 are protected at the container level, though the underlying code defect remains. >
Steps to Reproduce
- Identify a valid installed module ID on the target OpenMRS instance (e.g.,
legacyui). - Send the following HTTP request:
<img width="1038" height="798" alt="image" src="https://github.com/user-attachments/assets/7d10ee0e-4d81-4c01-bc84-a1bf5715f170" />
- The server responds with HTTP 200 and the contents of
/etc/passwd:
<img width="1028" height="843" alt="image" src="https://github.com/user-attachments/assets/b6806a7e-ff52-4f51-8f7f-7ea4e9754d10" />
Root Cause Analysis
The vulnerability exists in ModuleResourcesServlet.java (web/src/main/java/org/openmrs/module/web/ModuleResourcesServlet.java).
The getFile() method constructs a filesystem path from user-controlled input without performing path boundary validation:
protected File getFile(HttpServletRequest request) {
// Step 1: User-controlled path input
String path = request.getPathInfo();
// Step 2: Extract module from path prefix
Module module = ModuleUtil.getModuleForPath(path);
if (module == null) { return null; }
// Step 3: Strip module ID prefix - no traversal check
String relativePath = ModuleUtil.getPathForResource(module, path);
// Step 4: Concatenate into absolute path
String realPath = getServletContext().getRealPath("")
+ MODULE_PATH
+ module.getModuleIdAsPath()
+ "/resources"
+ relativePath; // contains "/../../../etc/passwd"
realPath = realPath.replace("/", File.separator);
// Step 5: No normalize().startsWith() boundary check
File f = new File(realPath);
if (!f.exists()) { return null; }
return f; // Arbitrary file returned to client
}The helper method ModuleUtil.getPathForResource() only strips the module ID prefix and performs no sanitization:
public static String getPathForResource(Module module, String path) {
if (path.startsWith("/")) {
path = path.substring(1);
}
return path.substring(module.getModuleIdAsPath().length());
// Returns unsanitized remainder, e.g., "/../../../../../../etc/passwd"
}The resulting path resolves as:
{webapp}/WEB-INF/view/module/legacyui/resources/../../../../../../etc/passwd
→ /etc/passwdNotably, the same codebase already implements correct path traversal protection in StartupFilter.java:
// StartupFilter.java - correct protection
fullFilePath = fullFilePath.resolve(httpRequest.getPathInfo());
if (!(fullFilePath.normalize().startsWith(filePath))) {
log.warn("Detected attempted directory traversal...");
return; // Request rejected
}This check is absent from ModuleResourcesServlet.
Remediation
Add a path boundary check after constructing realPath and before returning the File object. The fix should use normalize() + startsWith() to ensure the resolved path stays within the allowed module resources directory:
File f = new File(realPath);
Path allowedBase = Paths.get(getServletContext().getRealPath(""), "WEB-INF", "view", "module");
if (!f.toPath().normalize().startsWith(allowedBase.normalize())) {
log.warn("Blocked path traversal attempt: {}", request.getPathInfo());
return null;
}This is consistent with the existing pattern used in StartupFilter.java and TestInstallUtil.java within the same project.
Executive ViewAI
OpenMRS Core versions 2.7.8 and below, and 2.8.0-2.8.5, contain a path traversal vulnerability in ModuleResourcesServlet that enables unauthenticated attackers to read arbitrary files from the server, including sensitive configuration and system files. Organizations running affected versions face immediate risk of credential exposure and system compromise through publicly accessible file access, making this a critical data confidentiality threat that requires urgent patching or containment.
No vendor-released patch identified for 2.7.x series at time of analysis. For all affected versions: restrict network access to ModuleResourcesServlet endpoints via firewall or reverse proxy rules; disable module resource serving if unused; implement strict input validation and path normalization at the application firewall level; require immediate upgrade to 2.8.6 as primary remediation path. Vendor-released patch available for 2.8.x branch (version 2.8.6).
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.
Affected Products (CPE)CVE.org
When running Apache Tomcat versions 9.0.0.M1 to 9.0.0, 8.5.0 to 8.5.22, 8.0.0.RC1 to 8.0.46 and 7.0.0 to 7.0.81 with HTT
When using the Apache JServ Protocol (AJP), care must be taken when trusting incoming connections to Apache Tomcat. Rate
In SysAid On-Premise before 23.3.36, a path traversal vulnerability leads to code execution after an attacker writes a f
Remote code execution is possible with Apache Tomcat before 6.0.48, 7.x before 7.0.73, 8.x before 8.0.39, 8.5.x before 8
When running Apache Tomcat 7.0.0 to 7.0.79 on Windows with HTTP PUTs enabled (e.g. Rated high severity (CVSS 8.1), this
Denial of service against HTTP/2 server implementations allows remote unauthenticated attackers to exhaust server resour
When running on Windows with enableCmdLineArguments enabled, the CGI Servlet in Apache Tomcat 9.0.0.M1 to 9.0.17, 8.5.0
MultipartStream.java in Apache Commons FileUpload before 1.3.1, as used in Apache Tomcat, JBoss Web, and other products,
The payload length in a WebSocket frame was not correctly validated in Apache Tomcat 10.0.0-M1 to 10.0.0-M6, 9.0.0.M1 to
When the default servlet in Apache Tomcat versions 9.0.0.M1 to 9.0.11, 8.5.0 to 8.5.33 and 7.0.23 to 7.0.90 returned a r
The documentation of Apache Tomcat 10.1.0-M1 to 10.1.0-M14, 10.0.0-M1 to 10.0.20, 9.0.13 to 9.0.62 and 8.5.38 to 8.5.78
When using a VirtualDirContext with Apache Tomcat 7.0.0 to 7.0.80 it was possible to bypass security constraints and/or
GHSA-jjgj-cx3q-pw4w
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB