CVE-2026-45367: HAPI FHIR Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-3653-68v6-rq57
CVSS 7.5
CWE-1333
Published
Advisory Summary

CVE-2026-45367 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting HAPI FHIR libraries in the Maven ecosystem. The issue involves redos via fhirpath matches()/replacematches() in fhir validator http endpoint. Remediation is available by upgrading affected packages to version 6.9.7.

CVE-2026-45367 at a Glance

CVE Identifier CVE-2026-45367
GHSA Identifier GHSA-3653-68v6-rq57
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-1333: Inefficient Regular Expression Complexity
Affected Product HAPI FHIR
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-45367

To remediate this vulnerability, upgrade all affected HAPI FHIR dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

ca.uhn.hapi.fhir:org.hl7.fhir.dstu2 fixed: 6.9.7
<dependency>
    <groupId>ca.uhn.hapi.fhir</groupId>
    <artifactId>org.hl7.fhir.dstu2</artifactId>
    <version>6.9.7</version>
</dependency>
ca.uhn.hapi.fhir:org.hl7.fhir.dstu2016may fixed: 6.9.7
<dependency>
    <groupId>ca.uhn.hapi.fhir</groupId>
    <artifactId>org.hl7.fhir.dstu2016may</artifactId>
    <version>6.9.7</version>
</dependency>
ca.uhn.hapi.fhir:org.hl7.fhir.dstu3 fixed: 6.9.7
<dependency>
    <groupId>ca.uhn.hapi.fhir</groupId>
    <artifactId>org.hl7.fhir.dstu3</artifactId>
    <version>6.9.7</version>
</dependency>
ca.uhn.hapi.fhir:org.hl7.fhir.r4 fixed: 6.9.7
<dependency>
    <groupId>ca.uhn.hapi.fhir</groupId>
    <artifactId>org.hl7.fhir.r4</artifactId>
    <version>6.9.7</version>
</dependency>
ca.uhn.hapi.fhir:org.hl7.fhir.r4b fixed: 6.9.7
<dependency>
    <groupId>ca.uhn.hapi.fhir</groupId>
    <artifactId>org.hl7.fhir.r4b</artifactId>
    <version>6.9.7</version>
</dependency>
ca.uhn.hapi.fhir:org.hl7.fhir.r5 fixed: 6.9.7
<dependency>
    <groupId>ca.uhn.hapi.fhir</groupId>
    <artifactId>org.hl7.fhir.r5</artifactId>
    <version>6.9.7</version>
</dependency>
ca.uhn.hapi.fhir:org.hl7.fhir.validation fixed: 6.9.7
<dependency>
    <groupId>ca.uhn.hapi.fhir</groupId>
    <artifactId>org.hl7.fhir.validation</artifactId>
    <version>6.9.7</version>
</dependency>
ca.uhn.hapi.fhir:org.hl7.fhir.validation.cli fixed: 6.9.7
<dependency>
    <groupId>ca.uhn.hapi.fhir</groupId>
    <artifactId>org.hl7.fhir.validation.cli</artifactId>
    <version>6.9.7</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=ca.uhn.hapi.fhir

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2026-45367, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=ca.uhn.hapi.fhir

Analyze the terminal output to locate any version of HAPI FHIR in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.9.7), your application is affected.

Note: The mvn dependency:tree -Dincludes=ca.uhn.hapi.fhir command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In HAPI FHIR, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary 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`):** ```java 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`):** ```java 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`):** ```java 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 `ValidationTimeout` class only protects `InstanceValidator` operations, not `evaluateFhirPath()` - 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.

CVE-2026-45367 Affected HAPI FHIR Versions

8 component(s)
Fixed Versions:
6.9.7
Product / Package Ecosystem Affected Versions Fixed Version
ca.uhn.hapi.fhir:org.hl7.fhir.dstu2
Maven
< 6.9.7
6.9.7
ca.uhn.hapi.fhir:org.hl7.fhir.dstu2016may
Maven
< 6.9.7
6.9.7
ca.uhn.hapi.fhir:org.hl7.fhir.dstu3
Maven
< 6.9.7
6.9.7
ca.uhn.hapi.fhir:org.hl7.fhir.r4
Maven
< 6.9.7
6.9.7
ca.uhn.hapi.fhir:org.hl7.fhir.r4b
Maven
< 6.9.7
6.9.7
ca.uhn.hapi.fhir:org.hl7.fhir.r5
Maven
< 6.9.7
6.9.7
ca.uhn.hapi.fhir:org.hl7.fhir.validation
Maven
< 6.9.7
6.9.7
ca.uhn.hapi.fhir:org.hl7.fhir.validation.cli
Maven
< 6.9.7
6.9.7

References

Frequently Asked Questions

What is CVE-2026-45367?
CVE-2026-45367 is a security vulnerability in HAPI FHIR involving ReDoS via FHIRPath matches()/replaceMatches() in FHIR Validator HTTP Endpoint under CWE-1333: Inefficient Regular Expression Complexity.
Which HAPI FHIR versions are affected?
Affected versions include releases prior to 6.9.7 across affected packages: ca.uhn.hapi.fhir:org.hl7.fhir.dstu2, ca.uhn.hapi.fhir:org.hl7.fhir.dstu2016may, ca.uhn.hapi.fhir:org.hl7.fhir.dstu3, ca.uhn.hapi.fhir:org.hl7.fhir.r4, ca.uhn.hapi.fhir:org.hl7.fhir.r4b, ca.uhn.hapi.fhir:org.hl7.fhir.r5, ca.uhn.hapi.fhir:org.hl7.fhir.validation, ca.uhn.hapi.fhir:org.hl7.fhir.validation.cli.
What version fixes CVE-2026-45367?
Upgrading to 6.9.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is org.hl7.fhir.dstu2 affected?
Yes, ca.uhn.hapi.fhir:org.hl7.fhir.dstu2 is affected in releases prior to 6.9.7. Upgrade your dependency to 6.9.7 or later.
Is org.hl7.fhir.dstu2016may affected?
Yes, ca.uhn.hapi.fhir:org.hl7.fhir.dstu2016may is affected in releases prior to 6.9.7. Upgrade your dependency to 6.9.7 or later.
What is the CVSS score of CVE-2026-45367?
CVE-2026-45367 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-45367?
CVE-2026-45367 is classified under CWE-1333: Inefficient Regular Expression Complexity (The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.).
How can I check Maven dependencies for CVE-2026-45367?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=ca.uhn.hapi.fhir'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-3653-68v6-rq57",
  "modified" : "2026-05-18T20:23:54Z",
  "published" : "2026-05-18T20:23:54Z",
  "aliases" : [ "CVE-2026-45367" ],
  "summary" : "HAPI FHIR: ReDoS via FHIRPath matches()/replaceMatches() in FHIR Validator HTTP Endpoint",
  "details" : "## Summary\n\nAll 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.\n\n## Details\n\nThe vulnerability exists in regex execution in FHIRPathEngine implementations across multiple code modules. For example the org.hl7.fhir.r5 module:\n\n\n**Entry point 1 — `FHIRPathEngine.java:5929` (R5 `funcMatches`):**\n```java\nprivate List<Base> funcMatches(ExecutionContext context, List<Base> focus, ExpressionNode exp) {\n    String sw = convertToString(swb); // attacker-controlled regex pattern\n    // ...\n    Pattern p = Pattern.compile(\"(?s)\" + sw); // VULNERABLE: no complexity check\n    Matcher m = p.matcher(st);                // no timeout\n    boolean ok = m.find();\n```\n\n**Entry point 2 — `FHIRPathEngine.java:5951` (R5 `funcMatchesFull`):**\n```java\nPattern p = Pattern.compile(\"(?s)\" + sw); // VULNERABLE: same pattern\nMatcher m = p.matcher(st);\nboolean ok = m.matches();\n```\n\n**Entry point 3 — `FHIRPathEngine.java:5120` (R5 `funcReplaceMatches`):**\n```java\nresult.add(new StringType(convertToString(focus.get(0))\n    .replaceAll(regex, repl)).noExtensions()); // VULNERABLE: replaceAll uses Pattern internally\n```\n\nThe same vulnerabilities exist in the dstu2, dstu2016may, dstu3, r4, and r4b modules, and the FHIRPathEngine is used in the validation module functionality.\n\n**Why this is exploitable:**\n- No timeout mechanism covers FHIRPath evaluation — the `ValidationTimeout` class only protects `InstanceValidator` operations, not `evaluateFhirPath()`\n- Java's `Pattern.compile()` with a pattern like `(a+)+$` against input `\"aaaaaaaaaaaaaaaaaaaaaa!\"` causes exponential backtracking (O(2^n) time complexity)\n\n\n## Impact\n\n- **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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "ca.uhn.hapi.fhir:org.hl7.fhir.dstu2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.9.7"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.9.6"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "ca.uhn.hapi.fhir:org.hl7.fhir.dstu2016may"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.9.7"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.9.6"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "ca.uhn.hapi.fhir:org.hl7.fhir.dstu3"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.9.7"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.9.6"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "ca.uhn.hapi.fhir:org.hl7.fhir.r4"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.9.7"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.9.6"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "ca.uhn.hapi.fhir:org.hl7.fhir.r4b"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.9.7"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.9.6"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "ca.uhn.hapi.fhir:org.hl7.fhir.r5"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.9.7"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.9.6"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "ca.uhn.hapi.fhir:org.hl7.fhir.validation"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.9.7"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.9.6"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "ca.uhn.hapi.fhir:org.hl7.fhir.validation.cli"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.9.7"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.9.6"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/hapifhir/org.hl7.fhir.core/security/advisories/GHSA-3653-68v6-rq57"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/hapifhir/org.hl7.fhir.core"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-18T20:23:54Z",
    "nvd_published_at" : null
  }
}