<코드 분석>
<?php
include "./config.php";
login_chk();
$db = dbconnect();
if(preg_match('/prob|_|\.|\(\)/i', $_GET[id])) exit("No Hack ~_~"); // do not try to attack another table, database!
if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~");
$query = "select id from prob_gremlin where id='{$_GET[id]}' and pw='{$_GET[pw]}'";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysqli_fetch_array(mysqli_query($db,$query));
if($result['id']) solve("gremlin");
highlight_file(__FILE__);
?>
필터링 항목 : id, pw 에 "prob" "_" "." "()" 사용 불가능. -> No Hack ~_~
result query 에 id 값이 존재하면 된다.
<해설>
?id='or 1=1 %23
-> id= 공백 or "참" 이기 때문에, query 가 의미하는 것은 "Select id from prob_gremlin" 과 같은 의미이다.
-> %23는 #으로, 한줄 주석을 의미한다. $_GET['id'] 이후의 query 를 주석으로 만들어서 무의미하게 작용하게 하기 위해 써주는 것이다.
'WriteUp > LOS_rubiya' 카테고리의 다른 글
LOS -rubiya : Wolfman (0) | 2020.05.13 |
---|---|
LOS -rubiya : Wolfman (0) | 2020.05.13 |
LOS -rubiya : Orc (0) | 2020.05.08 |
LOS - rubiya : Goblin (0) | 2020.05.07 |
LOS -rubiya : Cobolt (0) | 2020.05.07 |