CVE-2026-49485
JSON

7.5high

HAPI FHIR: ReDoS via FHIRPath matches()/replaceMatches() in FHIR Validator HTTP Endpoint

Severity
7.5high CVSS:3.1 by GitHub_M
Exploit likelihood
0.37% (higher than 33% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-7cmj-v6x8-frvv

Description

HAPI FHIR is a complete implementation of the HL7 FHIR standard for healthcare interoperability in Java. Prior to 6.9.9 and 6.9.4.2, all implementations of FHIRPathEngine accept arbitrary FHIRPath expressions and evaluate them without input validation, and the FHIRPath functions matches(), matchesFull(), and replaceMatches() pass user-controlled regular expressions to Java's Pattern.compile() and String.replaceAll() through an incomplete timeout utility. An attacker can send a resource containing an evil regex pattern that causes catastrophic backtracking, exhausting CPU resources and causing denial of service in the FHIR Validator HTTP endpoint and affected org.hl7.fhir.* modules. This issue is fixed in versions 6.9.9 and 6.9.4.2.

Affected

Product or packageVersionsReported by
hapifhir org.hl7.fhir.core< 6.9.4.2, >= 6.9.5, < 6.9.9CVE List
ca.uhn.hapi.fhir:org.hl7.fhir.dstu2 (Maven)from 6.9.5 before 6.9.9, before 6.9.4.2GitHub Advisory Database
ca.uhn.hapi.fhir:org.hl7.fhir.dstu2016may (Maven)from 6.9.5 before 6.9.9, before 6.9.4.2GitHub Advisory Database
ca.uhn.hapi.fhir:org.hl7.fhir.dstu3 (Maven)from 6.9.5 before 6.9.9, before 6.9.4.2GitHub Advisory Database
ca.uhn.hapi.fhir:org.hl7.fhir.r4 (Maven)from 6.9.5 before 6.9.9, before 6.9.4.2GitHub Advisory Database
ca.uhn.hapi.fhir:org.hl7.fhir.r4b (Maven)from 6.9.5 before 6.9.9, before 6.9.4.2GitHub Advisory Database
ca.uhn.hapi.fhir:org.hl7.fhir.r5 (Maven)from 6.9.5 before 6.9.9, before 6.9.4.2GitHub Advisory Database
ca.uhn.hapi.fhir:org.hl7.fhir.validation (Maven)from 6.9.5 before 6.9.9, before 6.9.4.2GitHub Advisory Database
ca.uhn.hapi.fhir:org.hl7.fhir.validation.cli (Maven)from 6.9.5 before 6.9.9, before 6.9.4.2GitHub Advisory Database

All scores

GitHub_M7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Classification

CWE-400CWE-1333

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

What each source says

CVE List

HAPI FHIR is a complete implementation of the HL7 FHIR standard for healthcare interoperability in Java. Prior to 6.9.9 and 6.9.4.2, all implementations of FHIRPathEngine accept arbitrary FHIRPath expressions and evaluate them without input validation, and the FHIRPath functions matches(), matchesFull(), and replaceMatches() pass user-controlled regular expressions to Java's Pattern.compile() and String.replaceAll() through an incomplete timeout utility. An attacker can send a resource containing an evil regex pattern that causes catastrophic backtracking, exhausting CPU resources and causing denial of service in the FHIR Validator HTTP endpoint and affected org.hl7.fhir.* modules. This issue is fixed in versions 6.9.9 and 6.9.4.2.

GitHub Advisory Database

Summary

All implementations of FHIRPathEngine accept arbitrary FHIRPath expressions and evaluate them without input validation. The utility intended to secure this evaluation did so incorrectly, and did not fully cover all places in which evaluation was being done. An attacker can send a resource containing an evil regex pattern that causes catastrophic backtracking, exhausting system resources, and causing Denial-of-Service.

Details

The vulnerability exists in regex execution in FHIRPathEngine implementations across multiple code modules. The FHIRPath functions matches(), matchesFull(), and replaceMatches() pass user-controlled regular expressions to Java's Pattern.compile() and String.replaceAll() through a utility class designed to time out after a specified interval. That utility correctly cancelled a single executor thread and returned with an exception, but the execution within the thread had no means to listen for this cancellation and would persist. Furthermore, three modules contained method calls in FHIRPathEngine that were not protected by this utility class.

Why this is exploitable:

Java's Pattern.compile() with a pattern like (a+)+$ against input "aaaaaaaaaaaaaaaaaaaaaa!" causes exponential backtracking (O(2^n) time complexity).

Impact

CPU Exhaustion: The exponential backtracking in Java's regex engine consumes 100% of a CPU core for the duration of the hang (effectively infinite for sufficiently long input strings) for callers of FHIRPathEngine.

NVD (es)

HAPI FHIR es una implementación completa del estándar HL7 FHIR para la interoperabilidad sanitaria en Java. Antes de las versiones 6.9.9 y 6.9.4.2, todas las implementaciones de FHIRPathEngine aceptan expresiones FHIRPath arbitrarias y las evalúan sin validación de entrada, y las funciones FHIRPath matches(), matchesFull() y replaceMatches() pasan expresiones regulares controladas por el usuario a Pattern.compile() y String.replaceAll() de Java a través de una utilidad de tiempo de espera incompleta. Un atacante puede enviar un recurso que contenga un patrón de regex malicioso que cause un retroceso catastrófico, agotando los recursos de la CPU y provocando una denegación de servicio en el endpoint HTTP del validador FHIR y en los módulos org.hl7.fhir.* afectados. Este problema está solucionado en las versiones 6.9.9 y 6.9.4.2.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-49485 changed 2026-07-20CVE Terms of Use
GitHub Advisory DatabaseGHSA-7cmj-v6x8-frvv changed 2026-07-09CC-BY-4.0
NVDCVE-2026-49485 changed 2026-10-24Public domain