Summary
HAPI FHIR: ReDoS via FHIRPath matches()/replaceMatches() in FHIR Validator HTTP Endpoint
Full technical description
All implementations of FHIRPathEngine accept arbitrary FHIRPath expressions and evaluate them without input validation. The FHIRPath functions matches(), matchesFull(), and replaceMatches() pass user-controlled regular expressions directly to Java's Pattern.compile() and String.replaceAll() without complexity checks or timeouts. 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. For example the org.hl7.fhir.r5 module:
Entry point 1, FHIRPathEngine.java:5929 (R5 funcMatches):
private List<Base> funcMatches(ExecutionContext context, List<Base> focus, ExpressionNode exp) {
String sw = convertToString(swb); // attacker-controlled regex pattern
// ...
Pattern p = Pattern.compile("(?s)" + sw); // VULNERABLE: no complexity check
Matcher m = p.matcher(st); // no timeout
boolean ok = m.find();
Entry point 2, FHIRPathEngine.java:5951 (R5 funcMatchesFull):
Pattern p = Pattern.compile("(?s)" + sw); // VULNERABLE: same pattern
Matcher m = p.matcher(st);
boolean ok = m.matches();
Entry point 3, FHIRPathEngine.java:5120 (R5 funcReplaceMatches):
result.add(new StringType(convertToString(focus.get(0))
.replaceAll(regex, repl)).noExtensions()); // VULNERABLE: replaceAll uses Pattern internally
The same vulnerabilities exist in the dstu2, dstu2016may, dstu3, r4, and r4b modules, and the FHIRPathEngine is used in the validation module functionality.
Why this is exploitable:
- No timeout mechanism covers FHIRPath evaluation, the
ValidationTimeoutclass only protectsInstanceValidatoroperations, notevaluateFhirPath() - 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.
A regular expression with worst-case exponential or polynomial matching time is applied to untrusted input, causing excessive CPU use. Typical impact: denial of service when input is crafted to trigger backtracking.
CVE-2026-45367 has a CVSS score of 7.5 (High). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (6.9.7); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
ca.uhn.hapi.fhir:org.hl7.fhir.dstu2 to 6.9.7 or later; ca.uhn.hapi.fhir:org.hl7.fhir.dstu2016may to 6.9.7 or later; ca.uhn.hapi.fhir:org.hl7.fhir.dstu3 to 6.9.7 or later; ca.uhn.hapi.fhir:org.hl7.fhir.r4 to 6.9.7 or later; ca.uhn.hapi.fhir:org.hl7.fhir.r4b to 6.9.7 or later; ca.uhn.hapi.fhir:org.hl7.fhir.r5 to 6.9.7 or later; ca.uhn.hapi.fhir:org.hl7.fhir.validation to 6.9.7 or later; ca.uhn.hapi.fhir:org.hl7.fhir.validation.cli to 6.9.7 or later
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2026-45367? CVE-2026-45367 is a high-severity inefficient regular expression (ReDoS) vulnerability in ca.uhn.hapi.fhir:org.hl7.fhir.dstu2 (maven), affecting versions <= 6.9.6. It is fixed in 6.9.7. A regular expression with worst-case exponential or polynomial matching time is applied to untrusted input, causing excessive CPU use.
- How severe is CVE-2026-45367? CVE-2026-45367 has a CVSS score of 7.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which packages are affected by CVE-2026-45367?
ca.uhn.hapi.fhir:org.hl7.fhir.dstu2(maven) (versions <= 6.9.6)ca.uhn.hapi.fhir:org.hl7.fhir.dstu2016may(maven) (versions <= 6.9.6)ca.uhn.hapi.fhir:org.hl7.fhir.dstu3(maven) (versions <= 6.9.6)ca.uhn.hapi.fhir:org.hl7.fhir.r4(maven) (versions <= 6.9.6)ca.uhn.hapi.fhir:org.hl7.fhir.r4b(maven) (versions <= 6.9.6)ca.uhn.hapi.fhir:org.hl7.fhir.r5(maven) (versions <= 6.9.6)ca.uhn.hapi.fhir:org.hl7.fhir.validation(maven) (versions <= 6.9.6)ca.uhn.hapi.fhir:org.hl7.fhir.validation.cli(maven) (versions <= 6.9.6)
- Is there a fix for CVE-2026-45367? Yes. CVE-2026-45367 is fixed in 6.9.7. Upgrade to this version or later.
- Is CVE-2026-45367 exploitable, and should I be worried? Whether CVE-2026-45367 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-45367 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-45367?
- Upgrade
ca.uhn.hapi.fhir:org.hl7.fhir.dstu2to 6.9.7 or later - Upgrade
ca.uhn.hapi.fhir:org.hl7.fhir.dstu2016mayto 6.9.7 or later - Upgrade
ca.uhn.hapi.fhir:org.hl7.fhir.dstu3to 6.9.7 or later - Upgrade
ca.uhn.hapi.fhir:org.hl7.fhir.r4to 6.9.7 or later - Upgrade
ca.uhn.hapi.fhir:org.hl7.fhir.r4bto 6.9.7 or later - Upgrade
ca.uhn.hapi.fhir:org.hl7.fhir.r5to 6.9.7 or later - Upgrade
ca.uhn.hapi.fhir:org.hl7.fhir.validationto 6.9.7 or later - Upgrade
ca.uhn.hapi.fhir:org.hl7.fhir.validation.clito 6.9.7 or later
- Upgrade