R136A1

[LOS] 14. giant :: SI 본문

WEB SECURITY/SQL Injection

[LOS] 14. giant :: SI

r136a1x27 2021. 9. 18. 07:26
<?php 
  include "./config.php"; 
  login_chk(); 
  $db = dbconnect(); 
  if(strlen($_GET[shit])>1) exit("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__); 
?>

SQL은 띄어쓰기에 굉장히 엄격하기 때문에

현재 select 1234 from{$_GET[shit]}prob_giant where 1 이므로 

shit에 어떤 값을 넣어서 띄어쓰기를 만들어줘야한다.

 

제약사항

shit에는 공백, \n, \r, \t 이 대소문자 상관없이 들어올 수 없다.

또한 shit은 2글자 이상 될 수 없다 (무조건 1글자)

다른 대체제: /**/, (), %20, %2b(=+), %09, %0a, %0b, %0c, %0d, %a0, 

에서 (), /**/의 경우 4글자이기때문에 사용할 수 없다.

또한 \n(LF=%0a), \r(CR=%0d), \t(HT=Horizontal tab=%09)을 사용할 수 없기 때문에 그에 해당하는 ASCII도 못쓴다.

 

%20, %2b(=+), %a0은 왜 안되는지 모르겠다.

 

%0b (=VT, Virtical tab)과 %0c(=FF, Form Feed)로 풀 수 있었다.

 

'WEB SECURITY > SQL Injection' 카테고리의 다른 글

[LOS] 16. succubus :: SI  (0) 2021.09.19
[LOS] 15. assassin :: blind SI  (0) 2021.09.19
[LOS] 13. bugbear :: blind SI  (0) 2021.09.18
[LOS] 12. darknight :: blind SI  (0) 2021.09.17
[LOS] 11. golem :: blind SI  (0) 2021.04.27
Comments