Bace

wargame.kr - login filtering 본문

wargame.kr

wargame.kr - login filtering

Bace 2020. 2. 7. 04:54

문제는 다음과 같다.

 

계정이 있는데 막혔다고 한다.

 

문제를 들어가보면 다음과 같이 나와있다.

 

소스를 보면 코드를 주고 맨 아래에 계정 2개를 준다.

하지만 id가 guest, blue4g 이면 your account is blocked 가 뜨게 하고 그게 아니면 login ok를 띄우며 key를 준다고 한다.

<?php

if (isset($_GET['view-source'])) {
    show_source(__FILE__);
    exit();
}

/*
create table user(
 idx int auto_increment primary key,
 id char(32),
 ps char(32)
);
*/

 if(isset($_POST['id']) && isset($_POST['ps'])){
  include("../lib.php"); # include for auth_code function.

  mysql_connect("localhost","login_filtering","login_filtering_pz");
  mysql_select_db ("login_filtering");
  mysql_query("set names utf8");

  $key = auth_code("login filtering");

  $id = mysql_real_escape_string(trim($_POST['id']));
  $ps = mysql_real_escape_string(trim($_POST['ps']));

  $row=mysql_fetch_array(mysql_query("select * from user where id='$id' and ps=md5('$ps')"));

  if(isset($row['id'])){
   if($id=='guest' || $id=='blueh4g'){
    echo "your account is blocked";
   }else{
    echo "login ok"."<br />";
    echo "Password : ".$key;
   }
  }else{
   echo "wrong..";
  }
 }
?>
<!DOCTYPE html>
<style>
 * {margin:0; padding:0;}
 body {background-color:#ddd;}
 #mdiv {width:200px; text-align:center; margin:50px auto;}
 input[type=text],input[type=[password] {width:100px;}
 td {text-align:center;}
</style>
<body>
<form method="post" action="./">
<div id="mdiv">
<table>
<tr><td>ID</td><td><input type="text" name="id" /></td></tr>
<tr><td>PW</td><td><input type="password" name="ps" /></td></tr>
<tr><td colspan="2"><input type="submit" value="login" /></td></tr>
</table>
 <div><a href='?view-source'>get source</a></div>
</form>
</div>
</body>
<!--

you have blocked accounts.

guest / guest
blueh4g / blueh4g1234ps

-->

 

id가 guest이면 필터링 하므로 대문자로 GUEST / guest 로 로그인해보았다.

flag가 떴다.

 

# Auth

'wargame.kr' 카테고리의 다른 글

wargame.kr - fly me to the moon  (0) 2020.02.07
wargame.kr - WTF_CODE  (0) 2020.02.07
wargame.kr - QR CODE PUZZLE  (0) 2020.02.07
wargame.kr - flee button  (0) 2020.02.07
wargame.kr - already got  (0) 2020.02.06