Post

LOS Lv.9 vampire

vampire

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

<?php 
  include "./config.php"; 
  login_chk(); 
  $db = dbconnect(); 
  if(preg_match('/\'/i', $_GET[id])) exit("No Hack ~_~");
  $_GET[id] = strtolower($_GET[id]);
  $_GET[id] = str_replace("admin","",$_GET[id]); 
  $query = "select id from prob_vampire where id='{$_GET[id]}'"; 
  echo "<hr>query : <strong>{$query}</strong><hr><br>"; 
  $result = @mysqli_fetch_array(mysqli_query($db,$query)); 
  if($result['id'] == 'admin') solve("vampire"); 
  highlight_file(__FILE__); 
?>

Solution

1
2
3
4
5
6
7
따옴표 필터링
id 입력값을 소문자로 변경
입력값중에 admin이 있으면 공백으로 변경함. 

입력을 adadminmin으로 하면 중간에 있는 admin이 공백이 되므로 admin이 됨.

?id=adadminmin
This post is licensed under CC BY 4.0 by the author.