/

CVE-2026-62295

Severity:

HIGH RISK

(7.5)

Uncontrolled Recursion (CWE-674) in HAPI FHIR JSON Parser

CVE-2026-62295

Received

Vulnerability type

Category:

Uncontrolled Recursion

CWE:

CWE-20, CWE-400, CWE-674

Impact:

Denial of Service

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

HAPI FHIR's JSON parser does not enforce a maximum nesting depth for arrays or objects, allowing deeply nested but syntactically valid FHIR JSON to trigger excessive recursion.

An attacker who can submit JSON resources for validation may cause a request thread to fail with StackOverflowError, potentially resulting in denial of service or broader process instability when the error is not safely isolated.

Affected context

The issue occurs in HAPI FHIR deployments that use the affected JSON utility parser to process attacker-influenced FHIR resources. It becomes risky when submitted JSON can contain deeply nested arrays or objects and the service lacks parser depth limits, request isolation, or safe handling for stack exhaustion errors.

Exploit preconditions

  • Attack surface: An endpoint or service that accepts FHIR JSON for parsing or validation
  • Required access: Ability to submit or cause processing of a JSON resource
  • Trigger point: Recursive array or object parsing before structural validation completes
  • Why exploitation is possible: The parser permits unbounded nesting depth, allowing recursion to exhaust the request thread's stack

Why this happens

The underlying bug is an uncontrolled-recursion condition mapped to CWE-674. Array and object parsing recursively descends through nested JSON structures without enforcing a maximum depth, so a relatively small input can consume the available call stack before normal validation controls run.

The related lack of input-size or resource-consumption limits also aligns with CWE-400, while insufficient structural validation before resource consumption relates to CWE-20.

Potential impact

  • Affected request threads may terminate with StackOverflowError
  • FHIR validation or ingestion services may become unavailable
  • Worker capacity could be reduced under repeated requests
  • The hosting process may become unstable if stack exhaustion is not isolated safely
  • Dependent healthcare interoperability workflows could experience delays

General mitigation guidance

Mitigation generally focuses on bounding parser resource consumption and isolating failures.

Common defensive patterns include:

  • Enforcing explicit maximum nesting depth for arrays and objects
  • Applying request-size, structure, and processing-time limits before deep parsing
  • Using iterative parsing or bounded recursion where practical
  • Validating input structure incrementally rather than after unrestricted traversal
  • Isolating parser failures at the request boundary and handling stack exhaustion safely
  • Running validation workers with least privilege and controlled resource quotas
  • Rejecting malformed, excessively complex, or policy-disallowed resources by default

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis rules identifying recursive parsers without depth guards
  • Code review checks for missing limits on nesting, input size, and parser work
  • Tests using progressively deeper arrays and objects to confirm bounded behavior
  • Runtime monitoring for StackOverflowError, repeated validation failures, and worker exhaustion
  • API gateway or policy controls that enforce request complexity limits

Automated security review tools may help identify recursive parsing paths that lack explicit resource bounds.

Sources

SourceLink
github.comgithub.com/hapifhir/org.hl7.fhir.core/commit/396f447500407693d6ae1e64db59782862ca7506
github.comgithub.com/hapifhir/org.hl7.fhir.core/security/advisories/GHSA-2cq7-hg49-56gc

Frequently asked

questions

It can be exploitable through a network-facing FHIR endpoint when an attacker is permitted to submit JSON resources for parsing or validation. The exact scope depends on endpoint exposure and deployment controls.

Authentication may or may not be required. The key prerequisite is the ability to submit or trigger processing of a deeply nested JSON document.

Enforce a strict maximum nesting depth and broader input-complexity limits, then isolate parser failures so one request cannot destabilize workers or the hosting process.

Treat parser resource consumption as a security boundary, test deeply nested inputs, apply request policies, and monitor for stack exhaustion and repeated resource-intensive validation attempts.

Find out what's already
exploitable in your codebase.