漏洞分析
https://github.com/apache/solr-site/blob/eb060a0d2cf1d31de403665407fff7a0255578ec/content/solr/security/2021-04-12-cve-2021-27905.md
相应的补丁:
https://github.com/apache/solr/pull/47/files/c12bbae4da0719435cf5e19623f6dad83f0c8c65#diff-838f63a8d7b764661b66c758c19cfe6f3d6454b328a1b5f52f75480530b0cfe7
根据补丁以及漏洞描述可以确定 bug 出在当进行 replication 操作时对传入的 masterUrl 参数 Solr 未对其做白名单过滤导致,补丁则是增加了对该参数的过滤。
构造PoC过程中主要参考文档:
https://solr.apache.org/guide/6_6/index-replication.html
这里基本已经说明什么情况下才需要传masterUrl了
然后根据command=fetchindex和masterUrl就可以得到PoC的格式
http://127.0.0.1:8983/solr/db/replication?command=fetchindex&masterUrl=http://xxx
紧急分析出PoC后又看了下这里的功能是在干嘛,solr 支持配置两个core,分别是主(master)和从(slave),我们可以主动控制让从(slave)去获取主的备份,而master的地址在配置文件可以配置,也允许请求者指定。
根据文档要复现这个漏洞需要将本地的Solr作为slave,默认solr就有多个core,这里选定任意一个db
根据路径修改它的solrconfig.xml(配置文件),添加如下代码:
http://localhost/solr/dbstr> 00:00:20str> lst> requestHandler>
因为PoC 会传入masterUrl,所以这里masterUrl就随便写的。PoC:
http://127.0.0.1:8983/solr/db/replication\?command=fetchindex\&masterUrl=http://xxxx:9999
复现结果:
限制
所以这个漏洞的限制条件也就显而易见了:
1、Solr 必须配置主从模式
2、受影响的是从(slave)服务器
特别声明:以上内容(如有图片或视频亦包括在内)为自媒体平台“网易号”用户上传并发布,本平台仅提供信息存储服务。
Notice: The content above (including the pictures and videos if any) is uploaded and posted by a user of NetEase Hao, which is a social media platform and only provides information storage services.