{"id":"CVE-2026-81875","aliases":["GHSA-3w98-rrpr-fprr"],"url":"https://o3.security/vulnerability/CVE-2026-81875","summary":"HAPI FHIR: SHCParser unbounded DEFLATE decompression causes denial of service","details":"### Summary\n`SHCParser` inflates compressed Smart Health Card JWT payloads into memory without a decompressed-size limit. An attacker who can submit SHC content for validation can craft a small compressed JWT payload that expands to a very large byte array, causing memory exhaustion or severe garbage collection pressure.\n\n### Details\nThe vulnerable code is in `org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/SHCParser.java`.\n\n`decodeJWT()` checks `MAX_ALLOWED_SHC_LENGTH`, but this only logs an error and parsing continues:\n\n```java\n// SHCParser.java:282-284\nif (jwt.length() > MAX_ALLOWED_SHC_LENGTH) {\n  logError(...);\n}\n```\n\nIf the header contains `\"zip\":\"DEF\"`, the payload is inflated before JSON parsing:\n\n```java\n// SHCParser.java:300-304\nif (\"DEF\".equals(res.header.asString(\"zip\"))) {\n  payloadJson = inflate(payloadJson);\n}\nres.payload = JsonParser.parseObject(FileUtilities.bytesToString(payloadJson), true);\n```\n\n`inflate()` accumulates all decompressed output in a `ByteArrayOutputStream` and has no maximum output size:\n\n```java\n// SHCParser.java:455-468\nwhile (!inflater.finished()) {\n  final int count = inflater.inflate(buffer);\n  outputStream.write(buffer, 0, count);\n}\nreturn outputStream.toByteArray();\n```\n\nThe same unbounded decompression pattern exists in `decompress()` at `SHCParser.java:410-423`.\n\n### PoC\nCreate a highly compressible SHC-shaped JSON payload, compress it with raw DEFLATE (`new Deflater(9, true)`), Base64URL-encode it as the JWT payload, and set the JWT header to `{\"zip\":\"DEF\"}`.\n\nLocal verification measured the following expansion through `SHCParser.inflate()`:\n\n```text\nplain=1000066 compressed=1052 inflated=1000066 ratio=950\nplain=16000066 compressed=15626 inflated=16000066 ratio=1023\n```\n\nA small compressed payload can therefore allocate many megabytes of heap. Larger payloads can trigger `OutOfMemoryError` or process instability.\n\n### Impact\nThis is a denial-of-service vulnerability. Any validator service or application that accepts attacker-supplied SHC content can be forced to allocate excessive heap memory. Impact ranges from request failure and severe GC pressure to process termination.\n\n### Credits\n- Thai Son Dinh from VinSOC Labs (R&D)","published":"2026-09-16T18:44:47.591Z","modified":"2026-10-28T11:12:29.303246368Z","cvss":{"score":7.5,"severity":"HIGH","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"},"epss":null,"cisaKev":null,"exploitsKnown":null,"affectedPackages":[{"ecosystem":"Maven","name":"ca.uhn.hapi.fhir:org.hl7.fhir.r5","fixedVersion":"6.9.12"},{"ecosystem":"Maven","name":"ca.uhn.hapi.fhir:org.hl7.fhir.validation","fixedVersion":"6.9.12"},{"ecosystem":"Maven","name":"ca.uhn.hapi.fhir:org.hl7.fhir.validation.cli","fixedVersion":null}],"fix":{"url":"https://github.com/hapifhir/org.hl7.fhir.core/commit/fbb94216e0ad21ded75be77e5e20242ba194e83f","label":"hapifhir/org.hl7.fhir.core@fbb9421"},"references":[{"type":"WEB","url":"https://github.com/hapifhir/org.hl7.fhir.core/releases/tag/6.9.11"},{"type":"WEB","url":"https://github.com/hapifhir/org.hl7.fhir.core/releases/tag/6.9.12"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/81xxx/CVE-2026-81875.json"},{"type":"ADVISORY","url":"https://github.com/hapifhir/org.hl7.fhir.core/security/advisories/GHSA-3w98-rrpr-fprr"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-81875"},{"type":"FIX","url":"https://github.com/hapifhir/org.hl7.fhir.core/commit/fbb94216e0ad21ded75be77e5e20242ba194e83f"},{"type":"FIX","url":"https://github.com/hapifhir/org.hl7.fhir.core/pull/2493"},{"type":"PACKAGE","url":"https://github.com/hapifhir/org.hl7.fhir.core"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-10-28T11:12:29.303246368Z"}}