题目地址:buuctf
让我们尝试找源文件,在index.php.bak得到源文件
<?php
include_once "flag.php";
if(isset($_GET['key'])) {
$key = $_GET['key'];
if(!is_numeric($key)) {
exit("Just num!");
}
$key = intval($key);
$str = "123ffwsfwefwf24r2f32ir23jrw923rskfjwtsw54w3";
if($key == $str) {
echo $flag;
}
}
else {
echo "Try to find out source file!";
}
要求我们传入key值,key值只能是数字,并且key值等于123ffwsfwefwf24r2f32ir23jrw923rskfjwtsw54w3才能得到flag
PHP作为弱类型语言,当字符串与整型值比较时,字符串先转换成整型,然后再比较,也就是说只要key=123就能满足。
index.php?key=123得到flag