URL: https://cryptixctf.com/challenges

上位に賞金が出るやつでしたけど、参加者が300チーム弱と、意外と狙い目のCTFだったかもです。

ただし、全問正解しないとダメですけどね。

cryptix_Score.png



[Forensics]: Hidden deep within (400 points)


Challenge

“This is just noise… There is nothing….”

Attachments:

  • useless.png


Solution

「青い空を見上げればいつもそこに白い猫」でLSB立てたらPNGのヘッダが見えたので、バイナリデータ保存したところ、“flag{Haha_fake_flag}” と書かれたPNGファイルになりました。

そのPNGに対してZstegかけたらフラグが取れました。

Flag: flag{st3g4n0gr4phy_i5_34sy}





[Web]: Your ID please


Challenge

This is super secure, confidential research. You are just not meant to access it. Don’t even try, it’s futile.
Okay, you don’t believe me? have the source code too!
https://cryptixctf.com/web4/php_code.txt

https://cryptixctf.com/web4

Attachments:

  • php_code.txt
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
include_once 'flag.php';

if($_SERVER["REQUEST_METHOD"] == "POST"){
    if(isset($_POST["ID"])&&isset($_POST["pwd"])){
        if(strcmp($secretpassphrase, $_POST["pwd"]) == 0){
            echo "Hey, you are in!  " . $_POST["ID"]  . "<br>";
            if($_POST["ID"] == "SuperUser1337"){
                echo "Your Flag: " . $flag;
            }
        }else{
            echo "<script type='text/javascript'>alert('Unable to Login');</script>";
        }
    }
}


Solution

Burpでpwdのところをpwd[]に書き換えてフォワードします。

ID="SuperUser1337”&pwd[]=pass

Flag: flag{Why_Juggl3_th3_Typ5}





[Reversing]: Let’s climb the ladder (250 points)


Challenge

Here is an executable. You know what to do.
Note: The flag format is as usual flag{XXXX…}

Attachments:

  • passphrase (ELF 64-bit)


Solution (Unsolved…)

Ghidraでデコンパイルします。

  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
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
void check(char *pcParm1)

{
  size_t sVar1;
  
  sVar1 = strlen(pcParm1);
  if ((int)sVar1 == 0x15) {
    if ((int)pcParm1[7] == (uint)(pcParm1[0x10] == 0)) {
      fail();
    }
    else {
      if ((int)pcParm1[1] == (uint)(pcParm1[0xb] == 0)) {
        fail();
      }
      else {
        if ((int)pcParm1[2] == (uint)(pcParm1[8] == 0)) {
          fail();
        }
        else {
          if ((int)pcParm1[8] == (uint)(pcParm1[0x12] == 0)) {
            fail();
          }
          else {
            if ((int)pcParm1[3] == (uint)(pcParm1[0x11] == 0)) {
              fail();
            }
            else {
              if ((int)pcParm1[5] == (uint)(pcParm1[0x14] == 0)) {
                fail();
              }
              else {
                if ((int)pcParm1[9] == (uint)(pcParm1[10] == 0)) {
                  fail();
                }
                else {
                  if ((int)pcParm1[0xc] == (uint)(pcParm1[0x13] == 0)) {
                    fail();
                  }
                  else {
                    if (*pcParm1 == 'r') {
                      if ((int)pcParm1[2] - (int)pcParm1[1] == 1) {
                        if ((int)pcParm1[10] - (int)pcParm1[8] == 1) {
                          if (pcParm1[2] == '4') {
                            if ((int)*pcParm1 + (int)pcParm1[3] == 0xd6) {
                              if ((int)pcParm1[4] - (int)pcParm1[3] == 5) {
                                if ((int)pcParm1[6] + (int)pcParm1[5] == 0xd5) {
                                  if ((int)pcParm1[5] - (int)pcParm1[6] == 7) {
                                    if ((int)pcParm1[7] - (int)pcParm1[8] == 0x2b) {
                                      if ((int)pcParm1[0xd] + (int)pcParm1[0xc] == 0xcf) {
                                        if ((int)pcParm1[0xd] * (int)pcParm1[0xc] == 0x29ba) {
                                          if ((int)pcParm1[0xf] - (int)pcParm1[0xe] == 0xd) {
                                            if ((int)pcParm1[0xf] - (int)*pcParm1 == 7) {
                                              success();
                                            }
                                            else {
                                              fail();
                                            }
                                          }
                                          else {
                                            fail();
                                          }
                                        }
                                        else {
                                          fail();
                                        }
                                      }
                                      else {
                                        fail();
                                      }
                                    }
                                    else {
                                      fail();
                                    }
                                  }
                                  else {
                                    fail();
                                  }
                                }
                                else {
                                  fail();
                                }
                              }
                              else {
                                fail();
                              }
                            }
                            else {
                              fail();
                            }
                          }
                          else {
                            fail();
                          }
                        }
                        else {
                          fail();
                        }
                      }
                      else {
                        fail();
                      }
                    }
                    else {
                      fail();
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  else {
    fail();
  }
  return;
}


長さ0x15 (21文字) でチェックしていて、それぞれのif文を解析すると、たぶんこんな感じかな〜と思ったんですけどね。

00 : r
01 : 3    // if ((int)pcParm1[2] - (int)pcParm1[1] == 1) {
02 : 4
03 : d    // if ((int)*pcParm1 + (int)pcParm1[3] == 0xd6) {
04 : i    // if ((int)pcParm1[4] - (int)pcParm1[3] == 5) {
05 : n    // if ((int)pcParm1[6] + (int)pcParm1[5] == 0xd5) {           // 110 + 103 = 213
06 : g    // if ((int)pcParm1[5] - (int)pcParm1[6] == 7) {              // 110 - 103
07 : _    // if ((int)pcParm1[7] - (int)pcParm1[8] == 0x2b) {
08 : 4    // if ((int)pcParm1[2] == (uint)(pcParm1[8] == 0)) { 
09 : 5    // if ((int)pcParm1[9] == (uint)(pcParm1[10] == 0)) {
10 : 5    // if ((int)pcParm1[10] - (int)pcParm1[8] == 1) {
11 : 3    // if ((int)pcParm1[1] == (uint)(pcParm1[0xb] == 0)) {
12 : m    // if ((int)pcParm1[0xd] + (int)pcParm1[0xc] == 0xcf) {    // 98 + 109
13 : b    // if ((int)pcParm1[0xd] * (int)pcParm1[0xc] == 0x29ba) {  // 2 * 7^2 * 109 = 98 * 109
14 : l    // if ((int)pcParm1[0xf] - (int)pcParm1[0xe] == 0xd) {
15 : y    // if ((int)pcParm1[0xf] - (int)*pcParm1 == 7) {
16 : _    // if ((int)pcParm1[7] == (uint)(pcParm1[0x10] == 0)) {
17 : d    // if ((int)pcParm1[3] == (uint)(pcParm1[0x11] == 0)) {
18 : 4    // if ((int)pcParm1[8] == (uint)(pcParm1[0x12] == 0)) {
19 : m    // if ((int)pcParm1[0xc] == (uint)(pcParm1[0x13] == 0)) {
20 : n    // if ((int)pcParm1[5] == (uint)(pcParm1[0x14] == 0)) {


このパスフレーズを使ってプログラムを実行すると、

root@kali:~/cryptixctf# ./passphrase r34ding_455embly_d4mn
Please wait while we are authenticating....
.......
....
You are in!

“You are in!” と言われるんですが、実際にはフラグとして通りませんでした。

Discordでも、ご機嫌ナナメの人が数名いました。

Flag: flag{r34ding_455embly_d4mn} (?)



それはさておき、Ghidraのデコンパイルの結果がちょっと変だと思いました。

1
2
3
    if ((int)pcParm1[7] == (uint)(pcParm1[0x10] == 0)) {
      fail();
    }

if文にマッチしたらfail()だし。

“== 0” だし。。



radare2で見ると、こんな感じ。

 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
[0x000005d0]> pdd@sym.check
/* r2dec pseudo code output */
/* passphrase @ 0x71c */
#include <stdint.h>
 
int64_t check (char * arg1) {
    char * s;
    size_t var_4h;
    rdi = arg1;
    s = rdi;
    rax = rdi;
    eax = strlen (rdi);
    var_4h = eax;
    if (var_4h != 0x15) {
        eax = 0;
        fail ();
    } else {
        rax = s;          // arg1
        rax += 7;         
        eax = *(rax);     // 7文字目
        edx = (int32_t) al;
        rax = s;
        rax += 0x10;
        eax = *(rax);     // 16文字目
        al = (al == 0) ? 1 : 0;
        eax = (int32_t) al;
        if (edx != eax) {
:

ふーん、まいっか(笑)