Summary
Medplum versions before 5.1.14 contain a server-side request forgery (SSRF) vulnerability in the subscription worker, where authenticated users can register FHIR Subscription endpoints with arbitrary URLs.
By pointing these endpoints at internal services, attackers can coerce the Medplum server to perform unauthorized internal network requests and exfiltrate IAM credentials and sensitive patient health data.
Affected context
This vulnerability arises in Medplum deployments that use FHIR Subscription resources to trigger outbound HTTP requests from a backend worker process.
When a user can create or modify Subscription resources with custom endpoint URLs, and the server resolves and calls those URLs without strict network egress controls or validation, internal network locations become reachable through the application.
This typically affects environments where the Medplum subscription worker has connectivity to internal services such as cloud metadata endpoints, internal databases, or orchestration APIs that are not directly exposed to the public internet.
Exploit preconditions
- Attack surface: Medplum FHIR API for creating or updating Subscription resources.
- Required access: Authenticated user account with permission to create or manage FHIR Subscription resources.
- Trigger point: The subscription worker sending HTTP POST requests to the configured
endpointURL whenever matching FHIR events occur. - Why exploitation is possible: The worker trusts user-controlled endpoint URLs and issues outbound HTTP requests from a privileged internal network position without enforcing strict allowlists, network segmentation, or outbound URL validation.
Why this happens
The core issue is a server-side request forgery pattern, where untrusted user input (the Subscription endpoint URL) is used directly to construct and dispatch HTTP requests from the server environment.
Instead of constraining callbacks to a vetted set of domains or network ranges, the implementation allows arbitrary URLs, effectively turning the subscription worker into a proxy for reaching internal-only services.
This behavior maps to CWE-918: Server-Side Request Forgery (SSRF), in which an attacker leverages server-side HTTP capabilities and network visibility to interact with resources that are otherwise inaccessible from the external network perimeter.
Potential impact
- Access to cloud instance metadata services, which could expose temporary IAM credentials or tokens.
- Unauthorized access to internal APIs, databases, or administration endpoints reachable from the subscription worker.
- Exfiltration of sensitive patient health records through crafted subscription endpoints and POST bodies.
- Abuse of internal orchestration or control plane endpoints, potentially enabling lateral movement or privilege escalation within the environment.
- Use of the Medplum server as a pivot point to map internal network topology and services.
General mitigation guidance
Effective mitigation focuses on strictly limiting where server-side callbacks can be sent and reducing the trust placed in user-controlled URLs:
- Enforce allowlists of permitted domains or network ranges for Subscription endpoints, rejecting or sanitizing any URL outside controlled destinations.
- Implement URL validation that blocks access to link-local, loopback, private, and metadata IP ranges, as well as non-HTTP/HTTPS schemes.
- Place subscription workers in network segments with minimal necessary egress capabilities, avoiding direct connectivity to sensitive control-plane or metadata endpoints.
- Apply least-privilege principles to any credentials accessible from the worker, so that even if SSRF occurs, exposed tokens have limited scope.
- Prefer architectural patterns where external systems poll for data using well-defined APIs, instead of unbounded, user-defined push endpoints.
How teams detect issues like this
Detection can combine code-level analysis with operational monitoring:
- Use static analysis and code review to flag any use of HTTP client libraries with user-controlled URLs, especially in background workers or callback mechanisms.
- Review FHIR Subscription handling logic for missing domain allowlists, inadequate URL validation, or direct use of user input in outbound network calls.
- Monitor outbound network traffic from subscription workers for connections to unexpected internal IP ranges, metadata services, or non-standard destinations.
- Implement logging and alerting on Subscription creation and update events that specify unusual or internal-looking endpoints (e.g., IP literals, link-local ranges).
- Integrate automated security testing or SSRF-focused scanners in CI/CD pipelines to exercise callback endpoints with controlled test inputs.

