Open cwong-scw opened 3 years ago
NoSQL is a variation of data-management technologies, grouped arbitrarily under this name, that really means “non-relational database systems”. This includes graph databases (Cassandra), document databases (MongoDB), key-value stores (Amazon DynamoDB) amongst others.
NoSQL injection happens when an application uses input to build a query or statement without proper filtering or encoding. This may allow an attacker to modify the instruction that is sent to the non-relational database system by supplying specially constructed values, resulting in unauthorised retrieval or modification of data records.
Find all the instances of NoSQL database interaction and check how the queries or statements are being constructed. If any variables are used to construct the queries or statements, back trace these back to their source. Try to identify any variables that originate from input parameters and determine if appropriate filtering or encoding is being performed. Each NoSQL database technology has its own query language so you may need to refer to documentation to identify the special characters that processing may need to account for.
This is probably one of the two most exploited vulnerabilities in web applications and has led to a number of high profile company breaches. It occurs when an application fails to sanitize or validate input before using it to dynamically construct a statement. An attacker that exploits this vulnerability will be able to gain access to the underlying database and view or modify data without permission.
Examine code which interacts with relational databases and identify how each statement or query is constructed. Check if any statements are built by joining strings with external inputs and trace these data flows to see whether proper filtering or encoding was performed. Determine if special characters (such as single quotes) and keywords (such as SELECT or DROP) supplied in inputs can affect the statement that is constructed.
are you awake nosql injection?