|
|
|
|
|
by abentspoon
5000 days ago
|
|
Thanks to $elemMatch and automatic parameter parsing, this vulnerability is easier to exploit than it would seem. In rails, both of these are usually considered safe: MysqlCollection.create(:name => params[:name])
MysqlCollection.where(:name => params[:name]).all
MongoCollection.create(:name => params[:name])
MongoCollection.where(:name => params[:name]).all
However, the mongo version is vulnerable to this exploit. /create?name[0][whatever]=anything
/get?name[$elemMatch][$where]=exploitcode
|
|
For completeness' sake, here's a similar exploit vector in ActiveRecord: https://groups.google.com/forum/?fromgroups=#!topic/rubyonra...