numeric函数支持的数字类型
时间方面的数字绕过题:
<?php
show_source(__FILE__);
$flag = "xxxx";
if(isset($_GET['time'])){
if(!is_numeric($_GET['time'])){
echo 'The time must be number.';
}else if($_GET['time'] < 60 * 60 * 24 * 30 * 2){
echo 'This time is too short.';
}else if($_GET['time'] > 60 * 60 * 24 * 30 * 3){
echo 'This time is too long.';
}else{
sleep((int)$_GET['time']);
echo $flag;
}
echo '<hr>';
}
?>
时间区间在于(5184000,7776000),同时time变量被强制类型转换并用于sleep。
那么此时关键就在于numeric函数的利用上了。
is_numeric函数
支持普通数字型字符串、科学记数法型字符串、部分支持十六进制0x型字符串。而强制类型转换int,不能正确转换的类型有十六进制型字符串、科学计数法型字符串(部分)
所以可以采用科学技术法或者十六进制绕过。如?time=0x4f1a01或者?time=6e6时可以绕过。