Plit00's Story

[Wargame.kr]- login filtering write-up 본문

Wargame/Wargame.kr

[Wargame.kr]- login filtering write-up

plit00 2018. 2. 28. 00:10

이 문제는 작년쯤에 푼문제로 write-up을 하지않은 문제들을 한번에 올릴 생각이다.




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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.
[id&ps lib.php 함수에 포함 ]
  
 
  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..";
  }
 }
?>

<!--

you have blocked accounts.

guest / guest
blueh4g / blueh4g1234ps

cs


start 를 누르면 이러한 코드가 뜨게되는데 

하나하나 분석해보면 인젝션이 강렬하게 해주세요!! 한다.

이문제는 단순하게 생각하면 쉽다.


대소문자가 구분이 없는데 처음에는


guest / guest
blueh4g / blueh4g1234ps

를 각각 쳐보았지만 풀리지않았다.


id= Guest
pw=guest


'Wargame > Wargame.kr' 카테고리의 다른 글

[Wargame.kr]-md5_compare write-up  (0) 2018.03.03
[Wargame.kr]-md5 password write-up  (0) 2018.02.28
[Wargame.kr]-DB is really good write-up  (0) 2018.02.28
Comments