반응형
반응형
반응형

소스:

1
2
3
4
5
6
7
8
9
10
11
12
<?php 
  include "./config.php"
  login_chk(); 
  $db = dbconnect(); 
  if(strlen($_GET[shit])>1exit("No Hack ~_~"); 
  if(preg_match('/ |\n|\r|\t/i'$_GET[shit])) exit("HeHe"); 
  $query = "select 1234 from{$_GET[shit]}prob_giant where 1"
  echo "<hr>query : <strong>{$query}</strong><hr><br>"
  $result = @mysqli_fetch_array(mysqli_query($db,$query)); 
  if($result[1234]) solve("giant"); 
  highlight_file(__FILE__); 
?>
cs

 

if(strlen($_GET[shit])>1) exit("No Hack ~_~"); 

 

shit의 길이가 1보다 크면 죽어버린다.

 

쿼리 값을 보면 from 과 prob_giant사이에 공백이 없는 것을 볼 수 있다. 

select 1234 from prob_giant where 1

 

 

 

 

 

 

공백을 넣는 방법에는

 

%09  (tab \t)

%0a  (linefeed \n)

%0b  (vertical tab)

%0c  (form feed)

%0d  (carriage return \r)

 

가 있는데

아래 구문에 의해서 몇개는 필터링 된다.

 

if(preg_match('/ |\n|\r|\t/i', $_GET[shit])) exit("HeHe"); 

 

 

 

 

 

\t \n \r이 아닌 %0b나 %0c를 입력해주면 풀린다.

반응형

+ Recent posts