Skip to content
SQL injection Write-up Intermediate

How an Unsanitized “Filter” Input Nuked a SaaS Unicorn’s Da

The employee search endpoint passed user-supplied JSON directly into a MongoDB query, so an attacker could use query operators to bypass filters and tenant isolation. Using the $where operator, the attacker could read employee records, contract details and SSNs from every company on the platform.

T4nv1 Follow

Published on medium.com

If there’s one phrase that should instantly trigger a bug hunter’s spider-sense, it’s this: “Dynamic Search Filter.”

T4nv1, on medium.com

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

Impact

An attacker could read employee records, contract details and SSNs across all tenants on the platform, breaking tenant isolation entirely.

What the attacker needed

Access to the employee search feature; ability to send crafted JSON requests

The fix

The report recommends disabling $where execution and sanitising input parameters, and the text says an emergency patch was deployed.

How it was found

  1. Intercept the JSON payload sent when applying a multi-tag filter on the Advanced Employee Search modal.
  2. Replace a string filter value with a MongoDB not-equal operator and observe that all records in the organisation are returned.
  3. Note that a tenant_id is appended server-side, keeping results within the tester's own organisation.
  4. Send a $where operator containing a JavaScript expression that always evaluates true.
  5. Observe that records from every company on the platform are returned.

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.

A search box normally treats what you type as plain text. Here the server accepted structured data and put it straight into a database query, so special database instructions could be slipped in. That let the tester read records belonging to other companies, not just their own.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

More by T4nv1

View all

113 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.