Course contentsShow
← Security
Lesson 597 of 3,05213. Web Security - Injection AttacksFree lesson

NoSQL Blind Injection and Timing Attacks

Extracting data character-by-character using conditional operators and response timing when direct output is unavailable.

NoSQL Blind Injection and Timing Attacks

You'll learn how to extract sensitive data from NoSQL databases one character at a time when the application doesn't directly show query results.

What Is Blind NoSQL Injection?

Just like SQL blind injection you've already learned, NoSQL blind injection occurs when an attacker can't see direct database output, but can still extract data by asking yes/no questions. The database responds through subtle differences in application behavior—either through different content (Boolean-based) or different response times (timing-based).

The Character-by-Character Extraction Technique

Imagine playing "20 Questions" to guess a password. You ask: "Does it start with 'a'?" If the server responds slowly (or quickly, or with a different page), that's your answer. Then you ask about the second character, and so on.

In NoSQL contexts like MongoDB, you use conditional operators ($regex, $gt, $lt) to test character positions:

Conceptual example in MongoDB:

  • Query: Is the username's first character > 'm'?
  • Injection: {"username": {"$regex": "^a.*"}}
  • You measure: Does the response take 5 seconds (true) or instant (false)?

Time-based attacks use database sleep functions or intentionally expensive operations to create measurable delays. Boolean-based attacks look for different responses (error vs. success, different content).

Why This Matters

When NoSQL applications hide error messages and suppress direct output, timing attacks become your primary data extraction method. By systematically testing each character position with conditional operators, attackers can reconstruct entire database contents—slowly, but surely.

Key Takeaway:
NoSQL blind injection extracts hidden data character-by-character using conditional operators like $regex combined with response timing analysis, turning invisible database queries into measurable Boolean signals.