Bace

xcz.kr - prob18 본문

xcz.kr

xcz.kr - prob18

Bace 2020. 2. 6. 22:10

문제는 다음과 같다.

wrong T.T 라고 나와있고, Solver들이 나와 있다.

 

Description의 View source를 확인해보았다.

<html>
<head>
<link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon">
<title>Prob18</title>
</head>
<body style="background-image:url('../images/content-tail.gif');">
<b>Title</b></br>
<i>Comming Soon</i></br></br>
<b>Description</b></br>
<font size="2px">
View source</br>
<?
$key = "Congratulations!</br>Key is ??????????????????";
$liillillilliliili = @$_COOKIE['c'];
$liillillliiiliili = @$_GET['g'];
$lilllillliiiliili = @$_POST['p'];
if(empty($liillillilliliili) || empty($liillillliiiliili) || empty($lilllillliiiliili)){exit ('wrong T.T');}
$lililillliiiliili = $liillillliiiliili . $liillillilliliili;
$lilililliiiiliill = $lilllillliiiliili;

function test($a){
$b = '';
    for($i=0; $i < strlen($a); $i++){
        $b = $b . ' - ' . ord(substr($a,$i,1));
    }
    return $b;
}
if(test($lililillliiiliili)==" - 103 - 105 - 118 - 101 - 109 - 101 - 112 - 97 - 115 - 115 - 119 - 111 - 114 - 100" || test($lilililliiiiliill) == " - 107 - 101 - 121 - 112 - 108 - 122 - 33"){
    echo $key;
}
else{
    echo 'wrong T.T';
}
?>
</font>
</body>
</html>

 

if문을 통과하면 key를 내주는데 ord값이 아스키코드를 출력하는 것이므로, 아스키코드 표를 통해 코드를 해석해보니 

givemepassword 가 $_GET['g'].$_COOKIE['c'] 이고,

keyplz! 가 $_POST['p'] 이면 된다.

 

get으로 giveme를 주고

cookie 값을 설정해주고

 

form method = post를 통해 keyplz! 를 넘겨주었다.

 

submit을 누르면 flag가 나온다.

 

 

# Auth