Alternative link
The application accepted a user-supplied filter expression in a query parameter and evaluated it as a NoSQL query, allowing the attacker to change the filter to return other users' records. By using a comparison operator instead of equality, the attacker retrieved customer information and, on one endpoint, an administrator's email address, username, password hash and phone number.
synack.com
Published on synack.com
In this article I detail my recent discovery on Synack Red Team, a NoSQL injection.
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 the user-controlled $filter value directly into a NoSQL query without validating or restricting the operators that could be used.
Impact
An authenticated user could read other users' basic customer information and, on one endpoint, an administrator's email address, username, password hash and phone number.
What the attacker needed
Authenticated account with provided credentials; access to the application APIs
How it was found
- Log in and intercept the request to the Customers endpoint that contains the $filter parameter.
- Remove the extra conditions from the filter and send only the id equality condition to confirm the filter is evaluated.
- Replace the equality operator with a greater-than operator so the filter matches other users' IDs.
- Send the modified filter to the Customers endpoint and observe other users' basic information returned.
- Find other endpoints that use the same $filter parameter, including CustomerLogins.
- Send the same modified filter to the CustomerLogins endpoint and observe the administrator's PII and password hash 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 web application let users control a filter that was passed directly to a database query. Instead of only returning the logged-in user's own record, the filter could be changed to ask for records belonging to other users. This is called NoSQL injection: user input is treated as part of a database command rather than as plain data.
What is IDOR?
One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.