🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: SQL Injection: all 10 questions

Quiz: SQL Injection · Question 10 of 10

A MongoDB login accepts JSON and an attacker sends {"password": {"$ne": ""}}. What is the fix?

A MongoDB login accepts JSON and an attacker sends {"password": {"$ne": ""}}. What is the fix?

  1. A.Use HTTPS
  2. B.Add a CAPTCHA
  3. C.Validate types: accept only a string where a string is expected
  4. D.Rename the password field
Answer & explanation

Correct answer: Validate types: accept only a string where a string is expected

This is NoSQL injection: an operator object instead of a plain value.

Can you get the rest right without peeking?

Take the timed Quiz: SQL Injection quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →