GitHub Advisoryadvisory · Maven

GHSA-fgv2-4q4g-wc35 HAPI FHIR Core has Authentication Credential Leakage via Improper URL Prefix Matching on HTTP Redirect

HIGH Published 2026-03-30 Modified 2026-03-31 Official page ↗
Aliases
CVE-2026-34359
Ecosystem
Maven
Packages
ca.uhn.hapi.fhir:org.hl7.fhir.core, ca.uhn.hapi.fhir:org.hl7.fhir.utilities
Severity
High
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
Weaknesses
CWE-346
Reviewed
2026-03-30

Affected packages

• Maven ca.uhn.hapi.fhir:org.hl7.fhir.core: < 6.9.4 → fixed in 6.9.4 • Maven ca.uhn.hapi.fhir:org.hl7.fhir.utilities: < 6.9.4 → fixed in 6.9.4

Description

Summary `ManagedWebAccessUtils.getServer()` uses `String.startsWith()` to match request URLs against configured server URLs for authentication credential dispatch. Because configured server URLs (e.g., `http://tx.fhir.org`) lack a trailing slash or host boundary check, an attacker-controlled domain like `http://tx.fhir.org.attacker.com` matches the prefix and receives Bearer tokens, Basic auth credentials, or API keys when the HTTP client follows a redirect to that domain. Details The root cause is in `ManagedWebAccessUtils.getServer()` at `org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/http/ManagedWebAccessUtils.java:26`: ```java public static ServerDetailsPOJO getServer(String url, Iterable serverAuthDetails) { if (serverAuthDetails != null) { for (ServerDetailsPOJO serverDetails : serverAuthDetails) { if (url.startsWith(serverDetails.getUrl())) { // serverAuthDetails) { if (serverAuthDetails != null) { for (ServerDetailsPOJO serverDetails : serverAuthDetails) { if (urlMatchesServer(url, serverDetails.getUrl())) { return serverDetails; } } } return null; } /** • Check if a URL matches a configured server URL with proper host boundary validation. • After the configured prefix, the next character must be '/', '?', '#', ':', or end-of-string. */ private static boolean urlMatchesServer(String url, String serverUrl) { if (url == null || serverUrl == null) return false; if (!url.startsWith(serverUrl)) return false; if (url.length() == serverUrl.length()) return true; char nextChar = url.charAt(serverUrl.length()); return nextChar == '/' || nextChar == '?' || nextChar == '#' || nextChar == ':'; } ``` Apply the same fix to `ManagedWebAccess.isLocal()` at line 214 and the three-argument `getServer()` overload at line 14. Additionally, consider re-introducing the host-equality check for redirects in `SimpleHTTPClient` (as was previously implemented in commit `6b615880` but removed in `3871cc69`) to provide defense-in-depth against credential leakage on cross-origin redirects.

Related

Alias · CVE (1)

  • CVE-2026-34359 HAPI FHIR is a complete implementation of the HL7 FHIR standard for healthcare interoperability in Java. vulnerability

Weakness · CWE (1)

  • CWE-346 Origin Validation Error weakness

References