当前位置:网站首页>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(上题中的方法都可以)

边栏推荐
- 用手机在指南针上开户靠谱吗?这样有没有什么安全隐患
- Some pits designed by NOC
- 在支付宝上买基金安全吗?哪里可以买基金
- Several ways of gson's @jsonadapter annotation
- MySQL data type learning notes
- Understand esp32 sleep mode and its power consumption
- 自动化测试平台(十三):接口自动化框架与平台对比及应用场景分析及设计思路分享
- 【分类模型】Q 型聚类分析
- Chinese explanation of common rclone subcommands
- Is fixed investment fund a high-risk product?
猜你喜欢

【LINGO】求解二次规划

产品学习(一)——结构图

AI视频智能平台EasyCVR设备录像出现无法播放现象的问题修复

软件工程复习

Insufficient free space after clearing expired cache entries - consider increasing the maximum cache space

【LINGO】求七个城市最小连线图,使天然气管道价格最低
![[wechat applet] how to build a building block development?](/img/69/edb02c88b52b474a797307b96de369.jpg)
[wechat applet] how to build a building block development?
![[matlab] solve nonlinear programming](/img/2e/7a1f520b602b7539be479efb198f6a.png)
[matlab] solve nonlinear programming

解决无法读取META-INF.services里面定义的类

Esp32 monitors the battery voltage with ULP when the battery is powered
随机推荐
嵌入式系统
SQL learning notes 2
ESP32深度睡眠电流怎样低于10uA
女生适合学产品经理吗?有什么优势?
清除过期缓存条目后可用空间仍不足 - 请考虑增加缓存的最大空间
(上)苹果有开源,但又怎样呢?
Router 6/ 以及和Router5 的区别
开源了!文心大模型ERNIE-Tiny轻量化技术,又准又快,效果全开
给逆序对数求原数组
数据库笔记
如何画产品架构图?
【计网】(一) 集线器、网桥、交换机、路由器等概念
TDB中多个model情况下使用fuseki查询
Lxml module (data extraction)
SQL statement
mysql学习
Find the original array for the inverse logarithm
[wechat applet low code development] second, resolve the code composition of the applet in practice
Webapck packaging principle -- Analysis of startup process
[lingo] find the shortest path problem of undirected graph