Skip to content
VITI Security

API Security Testing: A Healthtech Scenario With 142 Endpoints and a Homegrown OAuth

by VITI Security TeamApr 28, 2026Illustrative scenario

A composite scenario: a fast-growing clinic software platform with 142 API endpoints and an OAuth implementation written in a hurry. What API security testing found, how the team fixed authorisation at the root, and the lessons for other API-first products.

API Security Testing: Healthtech Case Study - VITI Security

Illustrative scenario: a composite example built from common engagements, not a specific client.

This scenario is a composite, built from API security engagements with health and SaaS platforms, not a single client. A clinic operations and telemedicine platform had grown fast, to several thousand paying clinics and 142 API endpoints serving web, mobile and partner integrations. Its OAuth implementation had been written quickly by a founding engineer and extended many times since. Enterprise hospital groups were now asking for penetration test reports and evidence against a recognised standard. API security testing showed why the auth model needed more than patches.

Scoping an API test

The team supplied an OpenAPI specification, test accounts for each role, such as clinic owner, doctor, front desk, patient and partner, and a staging environment with realistic data. Undocumented endpoints were found by watching traffic from the web and mobile apps, which turned up about a dozen routes missing from the specification, including older versions still live. Testing was mapped to the OWASP API Security Top 10 and the OWASP Application Security Verification Standard.

What the test found

In this scenario, testing produced 18 high and critical findings. Most traced back to the same root causes.

  • Broken object-level authorisation: changing a clinic or patient ID in many requests returned another clinic's records.
  • Broken function-level authorisation: front desk accounts could call endpoints intended for clinic owners, such as changing billing settings.
  • Tokens that never expired and could be reused after logout.
  • Refresh tokens issued without binding to the client, so a leaked token worked from anywhere.
  • An OAuth redirect check that accepted any subdomain, allowing authorisation codes to be sent to an attacker's site.
  • Older API versions without the fixes made to current ones.
  • Responses returning full patient records where the app displayed only a name.

How the test was run

Testers worked through each endpoint with every role's credentials, checking what each role could read, change and delete, both for its own clinic and for another clinic. They tampered with IDs, roles and clinic references in requests, replayed tokens after logout and password change, tested the OAuth flows for redirect and token handling flaws, and looked for injection, mass assignment and missing rate limits. Partner integrations were tested with partner credentials to see what a compromised partner could reach.

Why it mattered for a health platform

Patient records, prescriptions and teleconsultation notes are among the most sensitive data a platform can hold. A cross-clinic access flaw would have been a reportable breach under data protection law and a serious problem with hospital customers, whatever the technical severity score said.

Fixing the root cause, not each endpoint

Patching 142 endpoints one by one would have left gaps. The team instead moved authorisation into shared middleware: every request resolved the user's clinic and role from the token, and every data access checked ownership through a single function. The homegrown OAuth server was replaced with a standard, maintained implementation using short-lived access tokens, rotating refresh tokens and an exact-match redirect allowlist. An API gateway enforced authentication, rate limits and schema validation on every route, and old API versions were retired on a published timeline.

Reducing data exposure

Responses were trimmed to what each client needed, with separate response shapes for patient, staff and partner views. Logging was reviewed to remove patient data from application logs. These changes reduced risk and, as a side effect, made responses smaller and faster.

Partner integrations received their own scoped credentials, so each partner could reach only the clinics that had authorised it.

The retest and evidence

After roughly three months of work alongside feature development, the retest confirmed all high and critical findings closed. The team mapped its controls to ASVS Level 2, giving enterprise customers a recognised standard to compare against, and added automated authorisation tests to the CI pipeline so new endpoints could not ship without ownership checks.

Lessons for API-first products

Most serious API flaws are authorisation flaws, and scanners rarely find them because they do not know which data belongs to whom. Centralise authorisation so new endpoints inherit it. Use standard OAuth implementations rather than writing your own. Keep an accurate API inventory, including old versions. And test with accounts for every role, because cross-role and cross-tenant access is where the damage is.

Our VAPT services include API security testing mapped to the OWASP API Security Top 10 with the retest included. Health platforms serving US customers may also need a HIPAA penetration test, and SaaS companies selling to enterprises often need SOC 2 penetration testing. See our healthcare IT page.

Frequently asked questions

What does API security testing involve?

Attacking your APIs directly, the way an attacker would, looking for broken authorisation, weak authentication, too much data in responses, injection and missing rate limits. It's usually mapped to the OWASP API Security Top 10.

What's the most common API flaw?

Broken object-level authorisation: change an ID in a request and you get, or change, another user's or tenant's data.

Should we build our own OAuth server?

Usually not. Use a well-maintained standard implementation or an identity provider. Home-made OAuth tends to get token handling and redirect checks wrong.

How do we stop new endpoints bringing back authorisation bugs?

Put authorisation in shared middleware, add automated tests in CI that try cross-user and cross-role access, and check each new endpoint against the API inventory.

Find the authorisation flaws scanners miss

We test APIs with accounts for every role, map findings to the OWASP API Security Top 10 and retest after you fix.