{"id":"CVE-2026-55470","aliases":["CVE-2026-55470","GHSA-fxj4-p9xp-37v5"],"related":[],"kind":"vulnerability","state":"published","title":"HAPI FHIR: DSTU2 FHIRPathEngine.matches() missing RegexTimeout protection allows ReDoS","summary":"HAPI FHIR is a complete implementation of the HL7 FHIR standard for healthcare interoperability in Java. Prior to 6.9.10, the fix for CVE-2026-45367 incompletely patched the DSTU2 module, leaving FHIRPathEngine.matches() in org.hl7.fhir.dstu2/utils/FHIRPathEngine.java to call raw String.matches(sw) without RegexTimeout protection while replaceMatches() was updated, allowing an unauthenticated attacker to trigger catastrophic regex backtracking and exhaust server CPU. This issue is fixed in version 6.9.10.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"HAPI FHIR is a complete implementation of the HL7 FHIR standard for healthcare interoperability in Java. Prior to 6.9.10, the fix for CVE-2026-45367 incompletely patched the DSTU2 module, leaving FHIRPathEngine.matches() in org.hl7.fhir.dstu2/utils/FHIRPathEngine.java to call raw String.matches(sw) without RegexTimeout protection while replaceMatches() was updated, allowing an unauthenticated attacker to trigger catastrophic regex backtracking and exhaust server CPU. This issue is fixed in version 6.9.10.","source":"cvelist"},{"lang":"en","text":"## Summary\nThe fix for CVE-2026-45367 added `RegexTimeout` protection to the `matches()` function in DSTU2016MAY, DSTU3, R4, R4B, and R5, but the DSTU2 module was incompletely patched. In `org.hl7.fhir.dstu2`, `replaceMatches()` was updated while `matches()` at line 2462 still calls the raw `String.matches(sw)` without any timeout, allowing an unauthenticated attacker to trigger catastrophic regex backtracking and exhaust server CPU.\n\n\n## Details\n### Incomplete patch\n\nWithin the same file\n(`org.hl7.fhir.dstu2/utils/FHIRPathEngine.java`), the two functions were\npatched inconsistently:\n\n**Line 2226 — replaceMatches() — PATCHED:**\n```java\nresult.add(new StringType(\n    RegexTimeout.replaceAll(\n        convertToString(focus.get(0)), regex, repl, regexTimeoutMillis)));\n```\n\n**Line 2462 — matches() — NOT PATCHED:**\n```java\nresult.add(new BooleanType(\n    convertToString(focus.get(0)).matches(sw)));\n// ↑ raw String.matches() — no RegexTimeout, no complexity check\n```\n\n**DSTU3 line 2447 — matches() — PATCHED (for comparison):**\n```java\nresult.add(new BooleanType(\n    RegexTimeout.matches(st, sw, regexTimeoutMillis)));\n```\n\n### Module-by-module status\n\n| Module | `matches()` | `replaceMatches()` |\n|---|---|---|\n| **DSTU2** | ❌ raw `str.matches(sw)` | ✅ `RegexTimeout.replaceAll()` |\n| DSTU2016MAY | ✅ `RegexTimeout.matches()` | ✅ |\n| DSTU3 | ✅ `RegexTimeout.matches()` | ✅ |\n| R4 | ✅ `RegexTimeout.matches()` | ✅ |\n| R4B | ✅ `RegexTimeout.matches()` | ✅ |\n| R5 | ✅ `RegexTimeout.matches()` | ✅ |\n\n\n## PoC\n**Requirements:** Java 17+, Maven 3.8+\n\n**pom.xml dependencies:**\n```xml\n<dependency>\n    <groupId>ca.uhn.hapi.fhir</groupId>\n    <artifactId>org.hl7.fhir.utilities</artifactId>\n    <version>6.9.7</version>\n</dependency>\n```\n\n**Test code (reproduces the exact behaviour of DSTU2 line 2462):**\n```java\nimport org.hl7.fhir.utilities.regex.RegexTimeout;\nimport java.util.concurrent.*;\n\nString regex = \"((a|b){0,5}){20}\";\nString input = \"a\".repeat(25) + \"c\";    // no match → full backtracking\n\n// ① Patched approach — RegexTimeout terminates at 500 ms\nlong t1 = System.currentTimeMillis();\ntry {\n    RegexTimeout.matches(input, regex, 500);\n} catch (TimeoutException e) {\n    System.out.println(\"RegexTimeout blocked in \" +\n        (System.currentTimeMillis() - t1) + \" ms\");\n}\n\n// ② DSTU2 line 2462 — raw String.matches(), no timeout\nlong t2 = System.currentTimeMillis();\ninput.matches(regex);                   // equivalent to what FHIRPathEngine does\nSystem.out.println(\"str.matches() ran for \" +\n    (System.currentTimeMillis() - t2) + \" ms with no timeout\");\n```\n\n**Verified output (JDK 25.0.3, Linux):**\n```\nRegexTimeout blocked in 508 ms      ← patched modules: attack stopped\nstr.matches() ran for 1410 ms       ← DSTU2: no timeout, CPU exhausted\n```\n\nThe patched approach cuts off the evaluation at 508 ms. The unpatched DSTU2\ncode runs for 1410 ms on this input with no mechanism to stop it. Longer\ninputs or more complex patterns produce proportionally worse results.\n\n\n## Impact\n**Vulnerability type:** Regular Expression Denial of Service (ReDoS) causing CPU exhaustion and service disruption.\n\n**Who is impacted:** Any application using the `ca.uhn.hapi.fhir:org.hl7.fhir.dstu2` module that evaluates user-supplied FHIRPath expressions — including the FHIR Validator HTTP endpoint, FHIR servers applying FHIRPath invariants from user-provided resources or profiles, and any system embedding `FHIRPathEngine` from the DSTU2 module. No authentication is required; an attacker needs only to submit a FHIR resource or FHIRPath expression whose `matches()` argument contains a catastrophically backtracking regular expression.","format":"markdown","source":"ghsa"},{"lang":"es","text":"HAPI FHIR es una implementación completa del estándar HL7 FHIR para la interoperabilidad sanitaria en Java. Antes de la versión 6.9.10, la corrección para CVE-2026-45367 parcheó incompletamente el módulo DSTU2, dejando que FHIRPathEngine.matches() en org.hl7.fhir.dstu2/utils/FHIRPathEngine.java llamara a String.matches(sw) sin protección RegexTimeout mientras que replaceMatches() fue actualizado, permitiendo a un atacante no autenticado desencadenar un retroceso catastrófico de expresiones regulares y agotar la CPU del servidor. Este problema está solucionado en la versión 6.9.10.","source":"nvd"}],"published":"2026-06-17T18:47:23.000Z","modified":"2026-10-25T17:10:00.197Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-1333"],"affected":[{"ranges":[{"version":"< 6.9.10","status":"affected"}],"vendor":"hapifhir","product":"org.hl7.fhir.core","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"6.9.10"}],"ecosystem":"Maven","package":"ca.uhn.hapi.fhir:org.hl7.fhir.dstu2","purl":"pkg:maven/ca.uhn.hapi.fhir/org.hl7.fhir.dstu2","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"6.9.10"}],"ecosystem":"Maven","package":"ca.uhn.hapi.fhir:org.hl7.fhir.convertors","purl":"pkg:maven/ca.uhn.hapi.fhir/org.hl7.fhir.convertors","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"6.9.10"}],"ecosystem":"Maven","package":"ca.uhn.hapi.fhir:org.hl7.fhir.validation","purl":"pkg:maven/ca.uhn.hapi.fhir/org.hl7.fhir.validation","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"6.9.10"}],"ecosystem":"Maven","package":"ca.uhn.hapi.fhir:org.hl7.fhir.validation.cli","purl":"pkg:maven/ca.uhn.hapi.fhir/org.hl7.fhir.validation.cli","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"6.9.10"}],"vendor":"hapifhir","product":"hl7_fhir_core","cpe":"cpe:2.3:a:hapifhir:hl7_fhir_core:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/hapifhir/org.hl7.fhir.core/security/advisories/GHSA-fxj4-p9xp-37v5","tags":["exploit","third-party-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/hapifhir/org.hl7.fhir.core/commit/56376f7986222626af061ca7fc27ee1ab030e590","tags":["patch","x-refsource-misc"],"sources":["cvelist","nvd"]},{"url":"https://github.com/hapifhir/org.hl7.fhir.core/releases/tag/6.9.10","tags":["release-notes","x-refsource-misc"],"sources":["cvelist","nvd"]},{"url":"https://github.com/hapifhir/org.hl7.fhir.core","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-07-09T12:58:52.590Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-55470","url":"https://www.cve.org/CVERecord?id=CVE-2026-55470","licence":"CVE Terms of Use","modified":"2026-07-09T12:59:00.576Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-fxj4-p9xp-37v5","url":"https://github.com/advisories/GHSA-fxj4-p9xp-37v5","licence":"CC-BY-4.0","modified":"2026-06-17T19:11:27.800Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-55470","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-55470","licence":"Public domain","modified":"2026-10-25T17:10:00.197Z"}],"updatedAt":"2026-11-25T22:59:27.452Z","epss":{"score":0.00445,"percentile":0.40419,"date":"2026-12-01T12:00:22.000Z"}}