How a NoSQL Injection Attack Helped Me Earn $500: A Step-by-Step Guide
The login form of a web application using MongoDB was vulnerable to NoSQL injection because user input was not sanitised. An attacker could bypass authentication and gain access to the admin panel.
Published on medium.com
NoSQL databases, such as MongoDB and Couchbase, have become popular due to their ability to handle large amounts of unstructured data. However, their flexibility also makes them vulnerable to NoSQL injection attacks if improperly secured.
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 application passed user-supplied JSON directly into MongoDB queries without validating or sanitising it, allowing query operators to be injected.
Impact
An attacker could bypass authentication and gain unauthorised access to the admin panel.
What the attacker needed
A web application using MongoDB; a login form that accepts JSON input
The fix
The issue was fixed after the report was submitted.
How it was found
- Identify a website that uses a NoSQL database by checking login, signup, and search forms for clues such as error messages mentioning MongoDB.
- Test the login form by entering input that uses query operators to see if the application is vulnerable.
- Confirm the vulnerability by manipulating other parts of the query, such as using regular expressions to match any user.
- Document the steps and submit a detailed report to the bug bounty program.
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.
NoSQL injection is like tricking a database into ignoring its normal rules by sending special commands instead of plain text. Here, the login form accepted a username and password that were not simple strings but instructions telling the database to return any user, so the attacker got in without knowing a real password.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.