AppSecExplained
  • Index < START HERE
    • My courses
    • How to get started from zero
  • 📽️Live Stream Content
    • Resource of the week
  • Discovery / Recon
    • Methodology
    • Content discovery / recon
      • Subdomains
      • Endpoints
      • Parameters
      • Spidering
  • Common vulns
    • SQL injection overview
      • Detection
      • Blind SQLi
      • Second-order SQLi
      • SQLi lab setup & writeups
    • NoSQL injection
    • JavaScript injection (XSS)
      • XSS Methodology
    • File Inclusion
      • Local file inclusion
        • Directory traversal
    • Command injection
    • XXE (XML external entity) injection
      • Blind XXE
    • Template injection
      • Server-side template injection
      • Client-side template injection
    • Authentication
      • Attacking password-based authentication
      • Attacking MFA
      • Authentication lab setup & writeups
    • Cross-Site Request Forgery (CSRF)
    • Insecure deserialization
      • PHP
      • Java
      • Python
      • .NET
    • Server-side request forgery (SSRF)
    • Insecure file upload
    • Clickjacking
    • Open redirect
    • Vulnerable components
    • Race conditions
      • Limit overrun
    • Prototype pollution
      • Client-side prototype pollution
    • APIs
      • API: BOLA
      • API: Broken authentication
      • BOPLA
      • API: BFLA
  • Bypassing controls
    • Rate limiting
    • WAF Bypasses
  • Scripts
    • Docker-compose.yml files
      • Wordpress
      • SQLi testing labs
    • PHP scripts
      • RCE Function Check
    • Wordlists
      • Single characters
      • SQLi
  • Code review
    • Getting started
    • Sinks
  • Links worth your time
    • Practical API Hacking
    • Rana Khalil's Web Security Academy Course
    • Portswigger's Web Security Academy
    • TCM Security Discord
    • PentesterLand Writeups
Powered by GitBook
On this page
  • What is it?
  • Checklist:
  • Exploitation
  • References & Resources

Was this helpful?

  1. Common vulns

NoSQL injection

What is it?

NoSQL injection is where an attacker can manipulate the queries made to a NoSQL database through user input.

A simple example:

  • A vulnerable web application has the endpoint /search?user={username}

  • When a request is made, the application queries a NoSQL database (e.g., MongoDB) like this: db.users.find({username: {$eq: username}})

  • If an attacker inserts a payload into {username} such as {"$ne": ""}, it may modify the query to retrieve all users.

  • The vulnerable application sends this query to the database, potentially leaking all usernames.

It's important to note that payloads may vary depending on the database, query, and application. NoSQL injection can lead to:

  • Sensitive data exposure

  • Data manipulation

  • Denial of service

Other learning resources:

Writeups:

Have a good writeup & want to share it here? Drop me a message on LinkedIn.

Checklist:

Exploitation

# basic login bypass
{"username": "anyname", "password": {"$ne": ""}}
# retrieve data
{"$where": "this.someField == 'someValue'"}
# blind
{"someField": {"$regex": "^someValue"}}

References & Resources

PreviousSQLi lab setup & writeupsNextJavaScript injection (XSS)

Last updated 3 months ago

Was this helpful?

LogoWSTG - Latest | OWASP Foundation
OWASP WSTG - Testing for NoSQL
LogoNoSQL injection | Web Security AcademyWebSecAcademy
PortSwigger NoSQL Injection