[Level 03] Lord of SQL injection – goblin

Lord of SQL injection – goblin

Level 03


Source Code

<?php 
  include "../config.php"; 
  login_chk(); 
  dbconnect(); 
  if(preg_match('/prob|_|\.|\(\)/i', $_GET[no])) exit("No Hack ~_~"); 
  if(preg_match('/\'|\"|\`/i', $_GET[no])) exit("No Quotes ~_~"); 
  $query = "select id from prob_goblin where id='guest' and no={$_GET[no]}"; 
  echo "<hr>query : <strong>{$query}</strong><hr><br>"; 
  $result = @mysql_fetch_array(mysql_query($query)); 
  if($result['id']) echo "<h2>Hello {$result[id]}</h2>"; 
  if($result['id'] == 'admin') solve("goblin");
  highlight_file(__FILE__); 
?>

Analyse

http://los.sandbox.cash/goblin-~~.php?no=123 이라고 입력하게 되면
select id from prob_goblin where id='guest' and no=123 와 같이 MySQL 쿼리문이 입력된다. 
&result['id']에 반드시 admin이 들어가야 goblin 문제가 풀린다.
다만 6번째 줄에서 [‘, “, `, \]를 필터링 하고 있다.

Frist Hint is next page

카테고리LOS

글의 문제가 있다면 댓글을 달아 주세요.

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.