Skip to content

OpenMRS has Stored Velocity SSTI to RCE via ConceptReferenceRange

Critical severity GitHub Reviewed Published May 4, 2026 in openmrs/openmrs-core

Package

maven org.openmrs.api:openmrs-api (Maven)

Affected versions

>= 2.7.0, < 2.7.9
>= 2.8.0, < 2.8.6

Patched versions

2.7.9
2.8.6

Description

Impact

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).

Persistent Remote Code Execution: The payload persists in the concept_reference_range database table (VARCHAR 65535). A single compromised concept for a common clinical measurement executes the payload on every subsequent observation validation across all users, API clients, and integrations in the facility.

Privilege Escalation: The Manage Concepts privilege is a content-management function, defined as "Able to add/edit/delete concept entries", not an administrative privilege. Multiple non-admin staff per facility typically hold this privilege. The attacker escalates from concept dictionary management to arbitrary code execution as the Tomcat application server process.

PHI Exfiltration: The Velocity context objects directly expose patient data without requiring OS-level RCE.

Patches

This is fixed in 2.8.6 and 2.7.9 as well as future versions.

Workarounds

Ensure the Manage Concepts privilege is restricted to only authorized users and carefully audit any ConceptReferenceRanges in the database.

Resources

openmrs/openmrs-core@8d1c193
https://www.machinespirits.com/advisory/1e8430/

References

@ibacher ibacher published to openmrs/openmrs-core May 4, 2026
Published to the GitHub Advisory Database May 4, 2026
Reviewed May 4, 2026

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
High
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H

EPSS score

Weaknesses

Improper Control of Generation of Code ('Code Injection')

The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. Learn more on MITRE.

CVE ID

CVE-2026-41258

GHSA ID

GHSA-xj4f-8jjg-vx4q

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.