超级简单的php基础题(弱类型和变量覆盖)
ctf吧
全部回复
仅看楼主
level 7
-L 楼主
收集一些
2022年06月19日 13点06分 1
level 7
-L 楼主
<?php
include("flag.php");
highlight_file(__FILE__);
if(isset($_GET['num'])){
$num = $_GET['num'];
if($num==4476){
die("no no no!");
}
if(preg_match("/[a-z]/i", $num)){
die("no no no!");
}
if(intval($num,0)==4476){
echo $flag;
}else{
echo intval($num,0);
}
}
2022年06月19日 13点06分 2
-L
?num=010574
2022年06月19日 13点06分
-L
intval($num,0); 第二个参数为0的时候自动识别,0开头识别位8进制
2022年06月19日 13点06分
level 7
-L 楼主
<?include("flag.php");
$_GET?$_GET=&$_POST:'flag';
$_GET['flag']=='flag'?$_GET=&$_COOKIE:'flag';
$_GET['flag']=='flag'$_GET=&$_SERVER:'flag';
highlight_file($_GET['HTTP_FLAG']=='flag'?$flag:__FILE__); ?>
2022年06月22日 13点06分 3
-L
?a 再post HTTP_FLAG=flag
2022年06月22日 13点06分
level 7
-L 楼主
<meta charset="utf-8">
<?php
highlight_file(__FILE__);
include('flag.php');
error_reporting(0);
$error='你还想要flag嘛?';
$suces='既然你想要那给你吧!';
foreach($_GET as $key => $value){
if($key==='error'){
die("what are you doing?!");
}
$$key=$$value; #
}foreach($_POST as $key => $value){
if($value==='flag'){
die("what are you doing?!");
}
$$key=$$value;
}
if(!($_POST['flag']==$flag)){
die($error);
}
echo "your are good".$flag."\n"; #
die($suces);
2022年06月22日 14点06分 4
-L
get:?a=flag post:error=a&flag=b
2022年06月22日 14点06分
1