CVE-2026-41258: CWE-94: Improper Control of Generation of Code ('Code Injection') in openmrs openmrs-core
OpenMRS is an open source electronic medical record system platform. From 2.7.0 to before 2.7.9 and 2.8.6, the ConceptReferenceRangeUtility.evaluateCriteria() method in OpenMRS Core evaluates database-stored criteria strings as Apache Velocity templates without any sandbox configuration. The VelocityEngine is initialized with only logging properties and noSecureUberspector, leaving the default UberspectImpl in place, which allows unrestricted Java reflection through template expressions. A user with the Manage Concepts privilege can store a malicious Velocity template expression in a concept's reference range criteria field. This payload is then executed automatically whenever a user or API call validates an observation against the affected concept. The Velocity context exposes $patient (the Person / Patient object), $obs (the Obs object), and $fn (the ConceptReferenceRangeUtility instance with access to the full OpenMRS service layer). This vulnerability is fixed in 2.7.9 and 2.8.6.
AI Analysis
Technical Summary
The vulnerability (CVE-2026-41258) in openmrs-core arises from improper control of code generation (CWE-94) in the evaluateCriteria() method of ConceptReferenceRangeUtility. The method evaluates criteria strings stored in the database as Apache Velocity templates without sandbox restrictions, using a VelocityEngine initialized with noSecureUberspector and default UberspectImpl. This configuration permits unrestricted Java reflection through template expressions. A user with Manage Concepts privilege can store malicious Velocity template expressions in a concept's reference range criteria field, which are executed automatically during observation validation. The Velocity context exposes sensitive objects ($patient, $obs, $fn) that provide access to patient data and the full OpenMRS service layer. The vulnerability is present in versions 2.7.0 to before 2.7.9 and 2.8.0 to before 2.8.6 and has been fixed in 2.7.9 and 2.8.6.
Potential Impact
Successful exploitation allows a privileged user to execute arbitrary Java code within the OpenMRS server process, leading to complete compromise of confidentiality, integrity, and availability of the system. This includes unauthorized access to patient data and potential full control over the OpenMRS service layer. The CVSS score of 9.1 reflects the critical nature of this vulnerability with network attack vector, low attack complexity, required high privileges, no user interaction, and complete impact on confidentiality, integrity, and availability.
Mitigation Recommendations
This vulnerability is fixed in OpenMRS Core versions 2.7.9 and 2.8.6. Users should upgrade to these or later versions to remediate the issue. No official patch or temporary fix is provided other than upgrading. Until upgraded, restrict Manage Concepts privilege to trusted users only to reduce risk. Patch status is not explicitly stated beyond the fixed versions; check the official OpenMRS advisories for the latest remediation guidance.
CVE-2026-41258: CWE-94: Improper Control of Generation of Code ('Code Injection') in openmrs openmrs-core
Description
OpenMRS is an open source electronic medical record system platform. From 2.7.0 to before 2.7.9 and 2.8.6, the ConceptReferenceRangeUtility.evaluateCriteria() method in OpenMRS Core evaluates database-stored criteria strings as Apache Velocity templates without any sandbox configuration. The VelocityEngine is initialized with only logging properties and noSecureUberspector, leaving the default UberspectImpl in place, which allows unrestricted Java reflection through template expressions. A user with the Manage Concepts privilege can store a malicious Velocity template expression in a concept's reference range criteria field. This payload is then executed automatically whenever a user or API call validates an observation against the affected concept. The Velocity context exposes $patient (the Person / Patient object), $obs (the Obs object), and $fn (the ConceptReferenceRangeUtility instance with access to the full OpenMRS service layer). This vulnerability is fixed in 2.7.9 and 2.8.6.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability (CVE-2026-41258) in openmrs-core arises from improper control of code generation (CWE-94) in the evaluateCriteria() method of ConceptReferenceRangeUtility. The method evaluates criteria strings stored in the database as Apache Velocity templates without sandbox restrictions, using a VelocityEngine initialized with noSecureUberspector and default UberspectImpl. This configuration permits unrestricted Java reflection through template expressions. A user with Manage Concepts privilege can store malicious Velocity template expressions in a concept's reference range criteria field, which are executed automatically during observation validation. The Velocity context exposes sensitive objects ($patient, $obs, $fn) that provide access to patient data and the full OpenMRS service layer. The vulnerability is present in versions 2.7.0 to before 2.7.9 and 2.8.0 to before 2.8.6 and has been fixed in 2.7.9 and 2.8.6.
Potential Impact
Successful exploitation allows a privileged user to execute arbitrary Java code within the OpenMRS server process, leading to complete compromise of confidentiality, integrity, and availability of the system. This includes unauthorized access to patient data and potential full control over the OpenMRS service layer. The CVSS score of 9.1 reflects the critical nature of this vulnerability with network attack vector, low attack complexity, required high privileges, no user interaction, and complete impact on confidentiality, integrity, and availability.
Mitigation Recommendations
This vulnerability is fixed in OpenMRS Core versions 2.7.9 and 2.8.6. Users should upgrade to these or later versions to remediate the issue. No official patch or temporary fix is provided other than upgrading. Until upgraded, restrict Manage Concepts privilege to trusted users only to reduce risk. Patch status is not explicitly stated beyond the fixed versions; check the official OpenMRS advisories for the latest remediation guidance.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-04-18T14:01:46.801Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a074b98ec166c07b06a98d7
Added to database: 5/15/2026, 4:36:40 PM
Last enriched: 5/15/2026, 4:52:00 PM
Last updated: 5/16/2026, 7:30:27 AM
Views: 9
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.