HAPI FHIR: ReDoS via FHIRPath matches()/replaceMatches() in FHIR Validator HTTP Endpoint
hapifhir org.hl7.fhir.core
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| ca.uhn.hapi.fhir:org.hl7.fhir.dstu2 Maven |
|
|
| ca.uhn.hapi.fhir:org.hl7.fhir.dstu2016may Maven |
|
hapifhir org.hl7.fhir.core
| Product | Affected | Fixed in |
|---|---|---|
| ca.uhn.hapi.fhir:org.hl7.fhir.dstu2 Maven |
|
|
| ca.uhn.hapi.fhir:org.hl7.fhir.dstu2016may Maven |
|
|
| ca.uhn.hapi.fhir:org.hl7.fhir.dstu3 Maven |
|
|
| ca.uhn.hapi.fhir:org.hl7.fhir.r4 Maven |
|
|
| ca.uhn.hapi.fhir:org.hl7.fhir.r4b Maven |
|
|
| ca.uhn.hapi.fhir:org.hl7.fhir.r5 Maven |
|
|
| ca.uhn.hapi.fhir:org.hl7.fhir.validation Maven |
|
|
| ca.uhn.hapi.fhir:org.hl7.fhir.validation.cli Maven |
|
|
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.
From the CVE record · GitHub_M
Affected FHIRPathEngine implementations evaluate attacker-controlled regular expressions without adequate protection against catastrophic backtracking. An attacker who sends a crafted resource to the FHIR Validator HTTP endpoint can exhaust CPU resources and cause a denial of service; the input does not specify whether authentication is required.
Teams running the FHIR Validator HTTP endpoint or using the listed ca.uhn.hapi.fhir:org.hl7.fhir.* Maven packages should check versions >=6.9.5 and <6.9.9, or <6.9.4.2.