WebHacking/Load Of Sql Injection
LOS zombie_assassin
HSr00t
2018. 2. 15. 04:26
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <?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__); ?> | cs |
LOS에서 필터링을 할때 preg_match를 이용하는데 이번 문제에서는 '를 @ereg함수로 필터링을 하고있다.
혹시나해서 저 함수 취약점을 검색하자 %00을 넣으면 %00이 발견된곳이 문자열 마지막으로 착각하고 뒤에 있는 문자열들은 검사를 안 한다는 내용이 있었다.
ABCD%00EFG를 넣게되면 ereg함수에서는 ABCD만 검사를 할것이다.