logo

NoSQL error-based injection

ID: 5545f22d-a96c-5a3c-a4a3-b75132e9552c

STIX ID: report--5545f22d-a96c-5a3c-a4a3-b75132e9552c

Feed Name: SensePost Blog

Date Published: 2025-03-15

Date Updated: 2026-04-30

...
...

This post outlines a fast, error-based NoSQL injection technique for MongoDB: instead of slow Boolean/regex guessing, an attacker injects JavaScript into `$where` (or via syntax injection) to execute `throw new Error(JSON.stringify(this))`, causing the database to return full documents in error messages; it demonstrates payload construction, handling syntax to safely insert the throw, iterating through records by excluding known users or comparing `_id`, and shows alternatives using `$expr`/`$function` and type-cast errors (e.g., `$toInt`) for data exfiltration when application error messages are exposed.

Your team is not currently subscribed to this feed. You must subscribe to it in order to see this post.