I have accounts. but, it's blocked. can you login bypass filtering?
인젝션 느낌이 솔솔 난다.
소스를 보라고 권하기 때문에 소스를 보자면
<?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
-->
blueh4g라는 아이디로 로그인을 해야되는데 로그인이 안되는 그런 느낌적인 느낌이다.
실제로 시도해봐도 블럭된다고 뜬다. 이제 우린 어떻게 해야할것인가? 특문같은것은 mysql_real_escape_string 덕에 시도할맛이 안나고..
그런데 마지막 주석이 의미심장하다.
가만보니 비교문도 === 가 아니라 == 이다. 이는 대소문자를 가리지 않는다는건데.
혹시나 하는마음에 Guest / guest를 시도하니 패스...
=== 를 써서 비교하는게 맞을 것 같다. 아니면 이상한 아이디랑 비밀번호 쓰지 말든지..