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

边栏推荐
- HW(OD)岗面试题
- Figure out the difference between event coordinates screenx, clientx, pagex and offsetx
- Solve the problem of "unexpected status code 503 service unavailable" when kaniko pushes the image to harbor
- 比赛即实战!中国软件杯发布全新产业创新赛项,校企可联合参赛
- 问题:OfficeException: failed to start and connect(二)
- Grain Mall - environment (p1-p27)
- ESP32 ESP-IDF ADC监测电池电压(带校正)
- 【电气介数】电气介数及考虑HVDC和FACTS元件的电气介数计算
- PAT (Advanced Level) Practice 1057 Stack
- 在长城证券上做基金定投安全吗?
猜你喜欢

ESP32 ESP-IDF ADC监测电池电压(带校正)

K8S搭建Redis集群

【微信小程序低代码开发】二,在实操中化解小程序的代码组成

ESP32 - ULP 协处理器在低功耗模式下读片内霍尔传感器HALL SENSOR

【MATLAB】求解非线性规划
![[Electrical dielectric number] electrical dielectric number and calculation considering HVDC and facts components](/img/7c/2b1d4797f367cced51f36e8a1bb199.png)
[Electrical dielectric number] electrical dielectric number and calculation considering HVDC and facts components

Esp32 esp-idf ADC monitors battery voltage (with correction)
![[wechat applet] how to build a building block development?](/img/69/edb02c88b52b474a797307b96de369.jpg)
[wechat applet] how to build a building block development?

How to use SCI hub

Methods of downloading Foreign Periodicals
随机推荐
Storage function learning notes
Record an online interface slow query problem troubleshooting
Product learning (III) - demand list
AI视频智能平台EasyCVR设备录像出现无法播放现象的问题修复
Solve the problem of "unexpected status code 503 service unavailable" when kaniko pushes the image to harbor
How to permanently configure local opencv4.5.5 for vs2019
Dirty reading, unreal reading and unrepeatable reading
常用快捷键
K8S搭建Redis集群
数据库笔记
Several ways of gson's @jsonadapter annotation
How the esp32 deep sleep current is lower than 10uA
8 figures | analyze Eureka's first synchronization registry
Understand esp32 sleep mode and its power consumption
mysql学习
【LINGO】求无向图的最短路问题
K8s set up redis cluster
The code generator has eliminated the styling of xxxx js as it exceeds the max of 500kb
解决The code generator has deoptimised the styling of xxxx.js as it exceeds the max of 500kb
Is the account opening of Huafu securities safe and reliable? How to open Huafu securities account