How a Missing GraphQL Authorization Check Exposed a HealthTech Un
A public GraphQL query for doctor schedules allowed fetching nested patient profiles without an authorization check, exposing private medical records. An attacker could scrape the entire patient database by cycling through doctor names.
In the world of modern APIs, GraphQL is king. It’s flexible, efficient, and allows front-end developers to request exactly the data they need with a single query.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the developers placed authorization checks only on root-level queries and omitted a field-level check in the resolver for the nested patient field.
Impact
An attacker could scrape the entire patient database, exposing private medical records, lab results, and diagnostic histories of over two million patients.
What the attacker needed
No authentication needed; knowledge of doctor names
The fix
The issue was fixed by implementing a centralized authorization middleware layer that enforces field-level security checks within the PatientProfile resolver.
How it was found
- Intercept the dashboard GraphQL request and note the query structure.
- Run an introspection query to map the schema and find the Appointment type with a nested patient field.
- Try fetching another user's appointment via the root appointment query and observe a 403.
- Find the public publicDoctorSchedule query that returns Appointment objects.
- Append the nested patient field to the public query and send it.
- Observe the response containing private patient medical history and diagnoses.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
GraphQL is a way for apps to ask a server for exactly the data they need, including related data in one request. The server is supposed to check permission for each piece of data, but here it only checked permission on the main query and forgot to check the linked patient details. That let anyone see other patients' medical information.
What is IDOR?
One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.