Skip to content

Commit 4832edf

Browse files
committed
v0.08b
1 parent 4ec24bb commit 4832edf

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

nosqlmap.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def mainMenu():
3232
select = True
3333
while select:
3434
os.system('clear')
35-
print "NoSQLMap v0.08-by Russell Butturini([email protected])"
35+
print "NoSQLMap v0.08a-by Russell Butturini([email protected])"
3636
print "\n"
3737
print "1-Set options (do this first)"
3838
print "2-NoSQL DB Access Attacks"
@@ -261,51 +261,53 @@ def webApps():
261261
randInjDelta = abs(injLen - randLength)
262262

263263
if (randInjDelta >= 100) and (injLen != 0) :
264-
print "Not equals injection respnose varied " + str(randInjDelta) + " bytes from random parameter! Injection works!"
264+
print "Not equals injection response varied " + str(randInjDelta) + " bytes from random parameter! Injection works!"
265265

266266
elif (randInjDelta > 0) and (randInjDelta < 100) and (injLen != 0) :
267267
print "Response variance was only " + str(randInjDelta) + " bytes. Injection might have worked but difference is too small to be certain. "
268268

269269
elif (randInjDelta == 0):
270270
print "Random string response size and not equals injection were the same. Injection did not work."
271271
else:
272-
print "Got zero length response. Injection did not work."
272+
print "Injected response was smaller than random response. Injection may have worked but requires verification."
273273

274274
print "Testing Mongo <2.4 $where all Javascript string escape attack for all records...\n"
275275
print " Injecting " + whereStrUri
276276
whereStrLen = int(len(urllib.urlopen(whereStrUri).read()))
277277
whereStrDelta = abs(whereStrLen - randLength)
278278

279-
if whereStrDelta >= 100 and (whereStrLen != 0):
279+
if (whereStrDelta >= 100) and (whereStrLen > 0):
280280
print "Java $where escape varied " + str(whereStrDelta) + " bytes from random parameter! Where injection works!"
281281

282-
elif (whereStrDelta > 0) and (whereStrDelta < 100) and (whereStrLen != 0):
282+
elif (whereStrDelta > 0) and (whereStrDelta < 100) and (whereStrLen - randLength > 0):
283283
print " response variance was only " + str(whereStrDelta) + "bytes. Injection might have worked but difference is too small to be certain."
284284

285285
elif (whereStrDelta == 0):
286286
print "Random string response size and $where injection were the same. Injection did not work."
287287

288288
else:
289-
print "Got zero length response. Injection did not work."
289+
print "Injected response was smaller than random response. Injection may have worked but requires verification."
290290

291291
print "\n"
292292
print "Testing Mongo <2.4 $where Javascript integer escape attack for all records...\n"
293293
print " Injecting " + whereIntUri
294294

295295
whereIntLen = int(len(urllib.urlopen(whereIntUri).read()))
296296
whereIntDelta = abs(whereIntLen - randLength)
297+
#print "whereIntLen debug: " + str(whereIntLen)
298+
#print "whereIntDelta debug: " + str(whereIntDelta)
297299

298-
if (whereIntDelta >= 100) and (whereIntLen != 0):
300+
if (whereIntDelta >= 100) and (whereIntLen - randLength > 0):
299301
print "Java $where escape varied " + str(whereIntDelta) + " bytes from random parameter! Where injection works!"
300302

301-
elif (whereIntDelta > 0) and (whereIntDelta < 100) and (whereIntLen != 0):
303+
elif (whereIntDelta > 0) and (whereIntDelta < 100) and (whereIntLen - randLength > 0):
302304
print " response variance was only " + str(whereIntDelta) + "bytes. Injection might have worked but difference is too small to be certain."
303305

304306
elif (whereIntDelta == 0):
305307
print "Random string response size and $where injection were the same. Injection did not work."
306308

307309
else:
308-
print "Got zero length response. Injection did not work."
310+
print "Injected response was smaller than random response. Injection may have worked but requires verification."
309311
#Start a single record attack
310312

311313
print "Testing Mongo <2.4 $where all Javascript string escape attack for one record...\n"
@@ -317,17 +319,17 @@ def webApps():
317319
else:
318320
whereOneStrDelta = 0
319321

320-
if (whereOneStrDelta >= 100) and (whereOneStrLen != 0):
322+
if (whereOneStrDelta >= 100) and (whereOneStrLen - randLength > 0):
321323
print "Java $where escape varied " + str(whereOneStrDelta) + " bytes from random parameter! Where injection works!"
322324

323-
elif (whereOneStrDelta > 0) and (whereOneStrDelta < 100) and (whereOneStrLen != 0):
325+
elif (whereOneStrDelta > 0) and (whereOneStrDelta < 100) and (whereOneStrLen - randLength > 0):
324326
print " response variance was only " + str(whereOneStrDelta) + "bytes. Injection might have worked but difference is too small to be certain."
325327

326328
elif (whereOneStrDelta == 0):
327329
print "Random string response size and $where single injection were the same. Injection did not work."
328330

329331
else:
330-
print "Got zero length response. Injection did not work."
332+
print "Injected response was smaller than random response. Injection may have worked but requires verification."
331333
print "\n"
332334
print "Testing Mongo <2.4 $where Javascript integer escape attack for one record...\n"
333335
print " Injecting " + whereOneInt
@@ -339,17 +341,17 @@ def webApps():
339341
else:
340342
whereOneIntDelta = 0
341343

342-
if (whereOneIntDelta >= 100) and (whereOneIntLen != 0):
344+
if (whereOneIntDelta >= 100) and (whereOneIntLen - randLength > 0):
343345
print "Java $where escape varied " + str(whereOneIntDelta) + " bytes from random parameter! Where injection works!"
344346

345-
elif (whereOneIntDelta > 0) and (whereOneIntDelta < 100) and (whereOneIntLen != 0):
347+
elif (whereOneIntDelta > 0) and (whereOneIntDelta < 100) and (whereOneIntLen - randLength > 0):
346348
print " response variance was only " + str(whereOneIntDelta) + "bytes. Injection might have worked but difference is too small to be certain."
347349

348350
elif (whereOneIntDelta == 0):
349351
print "Random string response size and $where single record injection were the same. Injection did not work."
350352

351353
else:
352-
print "Got zero length response. Injection did not work."
354+
print "Injected response was smaller than random response. Injection may have worked but requires verification."
353355

354356
raw_input("Press enter to continue...")
355357
return()

0 commit comments

Comments
 (0)