You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Wpt/Server Side vulnerability/NoSQL injection/Readme.md
+30-1Lines changed: 30 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -168,4 +168,33 @@ For URL-based inputs, you can insert query operators via URL parameters. For exa
168
168
169
169
> Note:
170
170
>
171
-
> You can use the [Content Type Converter](https://portswigger.net/bappstore/db57ecbe2cb7446292a94aa6181c9278) extension to automatically convert the request method and change a URL-encoded POST request to JSON.
171
+
> You can use the [Content Type Converter](https://portswigger.net/bappstore/db57ecbe2cb7446292a94aa6181c9278) extension to automatically convert the request method and change a URL-encoded POST request to JSON.
172
+
173
+
## Detecting operator injection in MongoDB
174
+
175
+
Consider a vulnerable application that accepts a username and password in the body of a `POST` request:
176
+
```
177
+
{"username":"wiener","password":"peter"}
178
+
```
179
+
Test each input with a range of operators. For example, to test whether the username input processes the query operator, you could try the following injection:
180
+
```
181
+
{"username":{"$ne":"invalid"},"password":"peter"}
182
+
```
183
+
If the `$ne` operator is applied, this queries all users where the username is not equal to invalid.
184
+
185
+
If both the username and password inputs process the operator, it may be possible to bypass authentication using the following payload:
This query returns all login credentials where both the username and password are not equal to invalid. As a result, you're logged into the application as the first user in the collection.
190
+
191
+
To target an account, you can construct a payload that includes a known username, or a username that you've guessed. For example:
0 commit comments