NoSQL Injection
Many applications store data in databases. Beyond relational engines, non-relational (NoSQL) databases are common. We focus on MongoDB (document-oriented, BSON).
NoSQL Types (brief)
Document-oriented (e.g., MongoDB, DynamoDB, Firestore)
Key–Value (e.g., Redis)
Wide-column (e.g., Cassandra)
Graph (e.g., Neo4j)
MongoDB Basics
Documents (fields → values) stored in collections:
{
_id: ObjectId("63651456d18bf6c01b8eeae9"),
type: 'Granny Smith',
price: 0.65
}Connect
mongosh mongodb://127.0.0.1:27017List databases:
Switch DB (created on first write):
Insert
Query
Exact match and list all:
Operators (examples): $eq, $gt, $gte, $in, $lt, $lte, $nin, $and, $or, $not, $nor, $regex, $where.
Combined example (type starts with G and price < 0.70):
Sort and limit:
Update
Remove
Next: basics of NoSQL injection and exploitation patterns.
Last updated