NoSQLMap 是一个开源 Python 工具,旨在审计和自动化注入攻击并利用 NoSQL 数据库和使用 NoSQL 的 Web 应用程序中的默认配置弱点,以便从数据库中泄露或克隆数据。
最初由@tcsstool编写,现在由@codingo_维护NoSQLMap 的命名是为了向 Bernardo Damele 和 Miroslav 的 Stampar 的流行 SQL 注入工具sqlmap致敬。它的概念基于 Ming Chow 在 Defcon 21 上的精彩演讲“滥用 NoSQL 数据库”并对其进行了扩展。
NoSQLMap MongoDB 管理攻击演示。
截图

概括
什么是 NoSQL?
NoSQL(原意为“非 SQL”、“非关系型”或“不仅仅是 SQL”)数据库提供了一种存储和检索数据的机制,该机制以关系数据库中使用的表格关系以外的方式建模。此类数据库自 20 世纪 60 年代末就已存在,但直到 21 世纪初,随着 Facebook、Google 和 Amazon.com 等 Web 2.0 公司的需求而大受欢迎,它才获得了“NoSQL”的绰号。NoSQL 数据库越来越多地用于大数据和实时 Web 应用程序。NoSQL 系统有时也被称为“不仅仅是 SQL”,以强调它们可能支持类似 SQL 的查询语言。
DBMS 支持
目前该工具的漏洞主要集中在 MongoDB 和 CouchDB,但未来版本计划增加对其他基于 NoSQL 的平台(如 Redis 和 Cassandra)的支持。
要求
在基于 Debian 或 Red Hat 的系统上,可以以 root 身份运行 setup.sh 脚本来自动安装 NoSQLMap 依赖项。
根据使用的功能而变化:
- Metasploit 框架,
- Python 与 PyMongo,
- httplib2,
- 并且 urllib 可用。
- 用于克隆数据库的本地默认 MongoDB 实例。点击此处查看安装说明。
还有一些其他库需要,常规 Python 安装应该已准备好。您的情况可能有所不同,请检查脚本。
设置
python setup.py install
或者,您可以通过切换到 docker 目录并输入以下内容来构建 Docker 映像:
docker build -t nosqlmap .
或者你可以使用 Docker-compose 来运行 Nosqlmap:
docker-compose build
docker-compose run nosqlmap
使用说明
从以下位置开始
python NoSQLMap
NoSQLMap 使用基于菜单的系统来构建攻击。启动 NoSQLMap 后,您将看到主菜单:
1-Set options (do this first)
2-NoSQL DB Access Attacks
3-NoSQL Web App attacks
4-Scan for Anonymous MongoDB Access
x-Exit
选项解释:
1. Set target host/IP-The target web server (i.e. www.google.com) or MongoDB server you want to attack.
2. Set web app port-TCP port for the web application if a web application is the target.
3. Set URI Path-The portion of the URI containing the page name and any parameters but NOT the host name (e.g. /app/acct.php?acctid=102).
4. Set HTTP Request Method (GET/POST)-Set the request method to a GET or POST; Presently only GET is implemented but working on implementing POST requests exported from Burp.
5. Set my local Mongo/Shell IP-Set this option if attacking a MongoDB instance directly to the IP of a target Mongo installation to clone victim databases to or open Meterpreter shells to.
6. Set shell listener port-If opening Meterpreter shells, specify the port.
7. Load options file-Load a previously saved set of settings for 1-6.
8. Load options from saved Burp request-Parse a request saved from Burp Suite and populate the web application options.
9. Save options file-Save settings 1-6 for future use.
x. Back to main menu-Use this once the options are set to start your attacks.
设置好选项后,返回主菜单,根据您攻击的是 NoSQL 管理端口还是 Web 应用程序,选择 DB 访问攻击或 Web 应用程序攻击。该工具的其余部分基于“向导”,相当容易理解,但如果您有任何问题或建议,请发送电子邮件至codingo@protonmail.com或在 Twitter 上找到我@codingo_ 。
易受攻击的应用程序
此 repo 还包含一个故意设置漏洞的 Web 应用程序,用于测试 NoSQLMap。要运行此应用程序,您需要安装 Docker。然后,您可以从 /vuln_apps 目录运行以下命令。
docker-compose build && docker-compose up
完成后,你应该能够通过访问https://127.0.0.1/index.html来访问存在漏洞的应用程序。