CVE-2026-53728
## 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 e
Properties
- ghsa_id
- GHSA-m44r-7c5h-m6mj
- severity
- high
- summary
- Medplum: Improper Validation of Redirect URI in External Auth Callback allows Authorization Code Leakage
- cvss_score
- 7.1
- cve_id
- CVE-2026-53728
- cvss_vector
- CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:L
- is_ghsa_only
- false
- ghsa_published
- 2026-08-17T13:36:17Z
- source_url
- https://github.com/advisories/GHSA-m44r-7c5h-m6mj
- ghsa_updated
- 2026-08-17T13:36:17Z
Related Entities (5)
VULNERABLE_TO (1)
AFFECTS (1)
HAS_WEAKNESS (2)
REPORTED_BY (1)
Explore deeper with Ninja Signal's threat intelligence graph