Oviva epa4all-client
IDP Discovery Document Signature Bypass
The client fetches the central IDP's OpenID discovery document as a signed JWT but parses the payload without verifying the signature. An attacker who can man-in-the-middle the TLS connection to the identity provider substitutes a forged document that redirects the uri_puk_idp_enc and uri_puk_idp_sig endpoints to attacker-controlled URLs, capturing the SMC-B-signed authentication material.
Description
parseFromJwt() calls JWSObject.parse(jwt).getPayload(), which decodes the JWT structure but performs no signature check before the payload is consumed:
OidcClient.java:82-89
private OidcDiscoveryResponse parseFromJwt(String jwt) { try { var payload = JWSObject.parse(jwt).getPayload(); return JsonCodec.readBytes(payload.toBytes(), OidcDiscoveryResponse.class); } catch (ParseException e) { throw new AuthorizationException("Failed to parse JWT", e); }}This compounds with a self-referential trust pattern in the challenge responder, where the challenge JWT's iss claim controls where the verification keys are fetched from. A comment in that code reads:
AuthnChallengeResponder.java:78
// Note: The challenge contains the URL to the keys, so is anyways// in control of it. Not sure what validating the signature adds.The forged document points uri_puk_idp_enc and uri_puk_idp_sig at attacker infrastructure. The client fetches the IDP signing key from the attacker's URL and validates the challenge against it (the circular trust), encrypts the SMC-B-signed response to the attacker's encryption key, and POSTs it to the attacker's auth endpoint. The outer HTTP client routes through the Konnektor proxy within the TI network, which provides transport-level protection and is what limits practical exploitability to an attacker already inside the TI.
Impact
- An attacker positioned to MITM the TLS connection to the central IDP captures the SMC-B-signed authentication response and the key material exchanged during login. Holding that material, the attacker can authenticate to the ePA backend as the legitimate institution and read or modify the records of patients the institution's SMC-B card can act on.
- During testing, a mock IDP served a discovery JWT signed with a key the client did not trust; the client completed the authorization flow against the attacker-controlled key URIs (observed as
send_authcode_scon the decrypted channel), confirming the forged document was accepted.
Mitigation
Update epa4all-client to 1.2.2 or later. No workaround is available for affected versions. The fix verifies the JWT signature in parseFromJwt() against a key that is pinned or fetched from a trusted source not derived from the JWT itself, validates the issuer against an allowlist of trusted TI IDP URIs, and pins the IDP discovery URL rather than deriving it from the challenge JWT's iss claim.
Defender's Checklist
Update epa4all-client to 1.2.2 or later.
All versions before 1.2.2 are affected. The fix is pull request #36.
Confirm the discovery JWT signature is actually checked.
After updating, verify that a discovery document signed with an untrusted key is rejected. The signing key must come from a pinned or trusted source, not from the JWT or challenge itself.
Pin the IDP discovery URL and allowlist the issuer.
Do not derive the discovery URL or key URIs from the challenge JWT's
issclaim. Pin the discovery endpoint and validateissueragainst a known list of TI IDP URIs to break the self-referential trust.Do not rely on the Konnektor proxy as the only barrier.
Transport routing through the TI limits who can reach the IDP path, but it is not authentication of the discovery document. An attacker inside the TI, or one who reaches the proxy, still wins without the signature check.
Severity Reasoning
References
How We Can Help
Who We Are
The security researchers behind this advisory.

Dr. rer. nat. Simon Weber
Senior Pentester & MedSec Researcher
I evaluate your SaMD with the same industry-defining security insight I contributed to the BAK MV for the revision of the B3S standard.
- PhD on Hospital Cybersecurity
- Critical vulnerabilities found in hospital systems
- Alumni of THB MedSec Research Group
- gematik Security Hero

Dipl.-Inf. Volker Schönefeld
Senior Application Security Expert
As a former CTO and developer turned pentester, I work alongside your team to uncover vulnerabilities and find solutions that fit your architecture.
- 20+ years as CTO, 50M+ app downloads
- Architected and secured large-scale IoT fleets
- Certified Web Exploitation Specialist
- gematik Security Hero
Looking for a Penetration Test?
Machine Spirits specializes in security assessments for medical devices and healthcare IT. From MDR penetration testing to C5 cloud compliance, we help MedTech companies meet regulatory requirements.
