当前位置:网站首页>ctfshow-web352,353(SSRF)
ctfshow-web352,353(SSRF)
2022-07-01 06:48:00 【m0_62094846】
web-352
<?php
error_reporting(0);
highlight_file(__FILE__);
$url=$_POST['url'];
$x=parse_url($url);
if($x['scheme']==='http'||$x['scheme']==='https'){
if(!preg_match('/localhost|127.0.0/')){
$ch=curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec($ch);
curl_close($ch);
echo ($result);
}
else{
die('hacker');
}
}
else{
die('hacker');
}
?> 

一定要出现http或者https
不能出现localhost和127.0.0.1
但是
(1)127.1可以被解析成127.0.0.1
url=http://127.1/flag.php
(2)在Linux中,0也会被解析成127.0.0.1

(3)127.0.0.0/8是一个环回地址网段,从127.0.0.1 ~ 127.255.255.254都表示localhost

(4)ip地址还可以通过表示成其他进制的形式访问
(这题只有十进制有用)


web-353
<?php
error_reporting(0);
highlight_file(__FILE__);
$url=$_POST['url'];
$x=parse_url($url);
if($x['scheme']==='http'||$x['scheme']==='https'){
if(!preg_match('/localhost|127\.0\.|\。/i', $url)){
$ch=curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec($ch);
curl_close($ch);
echo ($result);
}
else{
die('hacker');
}
}
else{
die('hacker');
}
?> url=http://0/flag.php(上题中的方法都可以)

边栏推荐
- 【微信小程序】视图容器和基本内容组件
- 解决kaniko push镜像到harbor时报错(代理导致):unexpected status code 503 Service Unavailable
- 记一次线上接口慢查询问题排查
- 【微信小程序低代码开发】二,在实操中化解小程序的代码组成
- 自动化测试平台(十三):接口自动化框架与平台对比及应用场景分析及设计思路分享
- PAT (Advanced Level) Practice 1057 Stack
- Common shortcut keys
- Is it safe to buy funds on Alipay? Where can I buy funds
- Chinese explanation of common rclone subcommands
- Is fixed investment fund a high-risk product?
猜你喜欢
随机推荐
Product learning (I) - structure diagram
Find the original array for the inverse logarithm
Figure out the difference between event coordinates screenx, clientx, pagex and offsetx
RestTemplate使用
Database objects: view learning records
rclone 访问web界面
(I) apple has open source, but so what?
Solve the problem of "unexpected status code 503 service unavailable" when kaniko pushes the image to harbor
在长城证券上做基金定投安全吗?
【FPGA帧差】基于VmodCAM摄像头的帧差法目标跟踪FPGA实现
Dirty reading, unreal reading and unrepeatable reading
【微信小程序】一文解决button、input、image组件
Postgraduate entrance examination directory link
Is fixed investment fund a high-risk product?
转行做产品经理,如何挑选产品经理课程?
How to use Alibaba vector font files through CDN
On whether variables are thread safe
[lingo] find the minimum connection diagram of seven cities to minimize the price of natural gas pipelines
Rclone Chinese document: a collection of common commands
问题:OfficeException: failed to start and connect(二)









