2016-02-18 283 views
0

我正在用MongoDB應用程序進行檢查。還有就是應用程序安裝在我的系統上,當我在輸入框中輸入單引號('),它彈出以下錯誤:MongoDb應用程序安全

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred. 
/usr/lib/cgi-bin/mongo/2.2.3/dbparse.py in() 
    41 print "</th>" 
    42 if where: 
=> 43 for record in collection.find(where): 
    44   print "<tr>" 
    45   print "<td align=\"center\">"+record["test"]+"</td>" 
record undefined, collection = Collection(Database(MongoClient('localhost', 27017), u'test_d'), u'london_garages'), collection.find = <bound method Collection.find of Collection(Data...', 27017), u'test_d'), u'l_g')>, where = {'$where': "this.test== ''--'"} 

什麼是錯誤的含義是什麼?如果你有另一個指針來檢查這個應用程序的安全性,請讓我知道。

回答

1

如果你看一下錯誤和以下部分:

where = {'$where': "this.test== ''--'"} 

我認爲單引號去where子句(某種搜索),所以你的代碼可能類似如下:

where = {'$where': "this.test== '[YOUR TEXT BOX INPUT]--'"} 

單引號提前終止了where子句。這是NoSQL注入的一個很好的演示。