Skip to main content

A hospital's patient portal exposed patient documents to the internet: Patient portal penetration test case study.

Case study: a Saudi hospital's patient portal exposed patient documents through an open cloud storage bucket, with IDOR and stored XSS alongside. How each was fixed.

Director, Sumrite
3 min read العربية
Sumrite case study card: patient portal and website penetration test for a Saudi hospital
Patient portal penetration test · Saudi hospital · Sumrite case study
On this page
  1. The scope
  2. A storage bucket that listed patient files to anyone
  3. Unauthenticated uploads and stored XSS
  4. IDOR: deleting other users’ files
  5. The public website
  6. Checklist for any hospital or clinic portal in the Gulf
  7. Frequently asked questions

The scope

The portal is where patients log in, view records and upload images and documents. It was tested grey-box with test accounts supplied by the hospital, following the OWASP Web Security Testing Guide. The public website was tested in the same window.

A storage bucket that listed patient files to anyone

The portal stored uploads in a Firebase bucket on Google Cloud Storage. Its security rules allowed public listing, so a single unauthenticated request returned the file index, and the linked files included patient documents.

This is a cloud configuration problem, not a code bug, and scanners pointed at the portal’s pages do not find it. It took a tester reading the app’s own traffic, seeing where uploads went and asking the bucket directly.

Under the Saudi PDPL, health data is sensitive personal data. Anyone who found the bucket name could have downloaded the files, and there was no log of who did.

Fix: storage rules that deny list and read by default, allow access only to authenticated users and check that the requesting user owns the object. Serve patient files through short-lived signed URLs, never public paths, and turn on access logging.

Unauthenticated uploads and stored XSS

The same rules allowed anyone to write to the bucket. The portal also checked file types only in the browser, so the server accepted SVG files, which can contain script. Uploaded through the open bucket and displayed inside the portal, such a file ran script in the browser of anyone who viewed it, including staff.

Fix: validate type and content on the server, reject or sanitise SVG from users, serve user content from a separate domain as a download, and add a Content-Security-Policy.

IDOR: deleting other users’ files

The delete request identified a file by its ID and never checked who owned it. Changing the ID deleted someone else’s file. This is the most common serious flaw we find in web applications and APIs: the screen only shows your own data, but the server trusts whatever ID it is sent. More in how IDOR exposes customer records.

Fix: a server-side ownership check on every read, change and delete, based on the session, never on anything the client sends.

The public website

The website exposed a publicly readable debug log with internal server details, ran an outdated JavaScript library with known vulnerabilities, and its origin server address was discoverable, which lets attackers bypass any CDN or WAF in front of it. Missing security headers and anti-CSRF protection completed the picture.

Fix: disable debug logging in production and block the path, keep front-end libraries current, accept origin traffic only from the CDN, and add CSP, HSTS and anti-CSRF tokens.

Checklist for any hospital or clinic portal in the Gulf

  • Storage buckets: no public list or read, ownership checks, signed URLs
  • Uploads: server-side type and content validation, no SVG from users
  • Every object request checks ownership on the server
  • CSP, HSTS and anti-CSRF on every page
  • No debug output or logs reachable in production
  • Origin server reachable only through the CDN or WAF

Sumrite tests web applications, APIs and cloud storage for healthcare providers in Saudi Arabia and the UAE. Read this case study in Arabic.

Frequently asked questions

What is the most common serious flaw in patient portals?

Broken access control. In this engagement it showed up twice: a cloud storage bucket that listed patient documents without a login, and an IDOR flaw that let one user delete another user's files by changing an identifier.

How does a misconfigured Firebase or Google Cloud Storage bucket expose data?

If the bucket's security rules allow public list or read access, anyone who knows or guesses the bucket name can request its file index and download the files. Storage rules must require an authenticated user and check that the user owns the object.

Why is SVG upload dangerous?

SVG is an XML format that can contain script. If a portal accepts SVG uploads and serves them from its own origin, an attacker can upload a file that runs script in the browser of anyone who opens it, including staff.

Does an NCA ECC audit check the patient portal for these flaws?

Not directly. An audit checks that controls exist. A penetration test proves whether the portal can actually be abused. NCA ECC expects both, which is why hospitals test internet-facing systems regularly.

See all FAQs →

  • Healthcare
  • Web Application
  • Cloud Storage
  • IDOR
  • XSS
  • Saudi Arabia

Faisal Khan

Faisal Khan is a Director at Sumrite, where he oversees penetration testing, risk assessment and compliance engagements for SaaS and enterprise clients.

Talk to a tester

Want us to look at your application?

Fixed-scope quote. Expert-led testing, verified findings, a fix-and-retest cycle and a report your auditors can use as evidence.