URL: https://ctf.zh3r0.ml/

平日にやってたCTFイベントです。


最終順位は、162位でした。(後日みたら、165位になってました)

zh3r0_CTF_2020_Score1.png


チャレンジリスト

zh3r0_CTF_2020_Score2.png
zh3r0_CTF_2020_Score3.png
zh3r0_CTF_2020_Score4.png



[Web]: Tokens


Challenge

The flag was sent by Mr.4N0NYM4U5 to my victim. But i dont have the username and password of the victim to login into the discord account. The only thing i have is a god damn token. Can you help me to get the flag. Ill give you the token and it is all you need. Token : NzIyMzM1MTQ5NDA0MTkyODIw.Xuhmgw.SZfbikLok4FRqbHQY4L3htLcTaU


Solution

最初、あまりチャレンジ文をよく読んでなくて、JWT (JSON Web Token) なのかなと思っていろいろ試していたんだけどダメで、よく読んでみたらDiscordって書いてあるのに気づいて方向転換。

以下のYouTube動画(How to login to Discord accounts with a token)の通りにやったらできました。
https://www.youtube.com/watch?v=cqQesvbtreA

動画中に出てくるコードは、以下のところにあります。
http://pastebin.com/raw/nUExn5Cu


以下はログイン後のスクリーンショットです。 zh3r0_CTF_2020_Discord.png


Flag: zh3r0{1et_7he_F0rce_8e_With_YoU}





[Web]: Web-Warmup


Challenge

Chall Link : http://web.zh3r0.ml:8080/
Easy peasy.


Solution

bg.cssの中にフラグが入ってました。

/*css is easy, I think. Don't you?zh3r0{y3s_th1s_1s_w4rmup}*/
#selector {
    width:100%;
    height:100%;
}


Flag: zh3r0{y3s_th1s_1s_w4rmup}





[Binary Exploitation]: Free Flag


Challenge

Welcome to zh3r0 ctf
Here’s your free flag

Attachment:

  • chall (ELF 64-bit)


Solution

“Free Flag” っていうから、てっきりstringsか何かでフラグがゲットできるかと思いきや、普通にBuffer Overflowのチャレンジでした。


Flag: zh3r0{welcome_to_zh3r0_ctf}





[Crypto]: RSA-Warmup


Challenge

RSA is one of the first public-key cryptosystems and is widely used for secure data transmission. In such a cryptosystem, the encryption key is public and distinct from the decryption key which is kept secret.
You all know this :p
here is a warmup question.

nc crypto.zh3r0.ml 8451


Solution

NをFactorizeしてからRsaCtfTool.pyで解きました。


Flag: zh3r0{RSA_1s_Fun}





[Forensics]: Katycat


Challenge

katycat trying to find the flag but she is lazy. will you help her to find the flag?

Attachment:

  • katy.png


Solution

まず、zstegで以下が見つかります。

b1,rgb,lsb,xy       .. text: "https://pastebin.com/hvgCXNcP"

pastebinにあるデータは以下です。
UEsDBAoACQAAALq0vFDu3sG8JQAAABkAAAAIABwAZmxhZy50eHRVVAkAA+jvz179789edXgLAAEE
6AMAAAToAwAAt9tbOQhvceVTC9i83YoBgbIW5fmqoaO3mVwXSLOMqNulwvcwb1BLBwju3sG8JQAA
ABkAAABQSwECHgMKAAkAAAC6tLxQ7t7BvCUAAAAZAAAACAAYAAAAAAABAAAApIEAAAAAZmxhZy50
eHRVVAUAA+jvz151eAsAAQToAwAABOgDAABQSwUGAAAAAAEAAQBOAAAAdwAAAAAA

Base64をしてみたところ、先頭が "PK" だったのでファイルとして保存して、unzip。

すると、zipパスワードを求められます。

$ unzip katy.zip 
Archive:  katy.zip
[katy.zip] flag.txt password:

$ zipinfo katy.zip 
Archive:  katy.zip
Zip file size: 219 bytes, number of entries: 1
-rw-r--r--  3.0 unx       25 TX stor 20-May-29 01:07 flag.txt
1 file, 25 bytes uncompressed, 25 bytes compressed:  0.0%

パスワードは、以下のようにしてCrack。
$ zip2john katy.zip > hash.txt
ver 1.0 efh 5455 efh 7875 katy.zip/flag.txt PKZIP Encr: 2b chk, TS_chk, cmplen=37, decmplen=25, crc=BCC1DEEE

$ john hash.txt –wordlist=/usr/share/wordlists/rockyou.txt Using default input encoding: UTF-8 Loaded 1 password hash (PKZIP [32/64]) Will run 2 OpenMP threads Press ‘q’ or Ctrl-C to abort, almost any other key for status kitkat (katy.zip/flag.txt) 1g 0:00:00:00 DONE (2020-06-16 03:01) 5.882g/s 24094p/s 24094c/s 24094C/s 123456..oooooo Use the “–show” option to display all of the cracked passwords reliably Session completed


Zip解凍。
$ unzip katy.zip 
Archive:  katy.zip
[katy.zip] flag.txt password: 
 extracting: flag.txt                

$ cat flag.txt
K9bC_L`D?f0DEb8c?_06cDJN

最後は、ROT47でした。(直感です)


Flag: zh3r0{1sn7_st3g4n0_e4sy}





[Forensics]: LSB fun


Challenge

have you ever heard of LSB :) ?

Attachment:

  • user.zip (chall.jpgが入ってます)


Solution

LSBという言葉に惑わされて、自作lsb.oとか、steglsb.pyとか、いろいろやってたんですが、そもそもJpegってLSBに埋め込みとかできないんじゃなかったっけ?と思いつつ、基本(?)に戻ってjstegをやったらフラグ取れました。

$ jsteg reveal chall.jpg 
zh3r0{j5t3g_i5_c00l}

jstegってLSB使ってやっているのかな。(よく知らない)


Flag: zh3r0{j5t3g_i5_c00l}





[Forensics]: Snow


Challenge

I wonder if the snow loves the trees and fields, that it kisses them so gently?

Attachment:

  • snow.zip
$ unzip snow.zip 
Archive:  snow.zip
   creating: snow/
  inflating: snow/chall.txt          
   creating: snow/.snowey/
  inflating: snow/.snowey/.flag.txt  
   creating: snow/.snowey/.../
   creating: snow/.snowey/.../.../
  inflating: snow/.snowey/.../.../.secret.txt  

secret.txt の中身
welc0me_to_zh3r0_ctf


Solution

チャレンジ名からして stegsnow だし、secretも与えられているので、簡単ですね。

$ stegsnow -C -p "welc0me_to_zh3r0_ctf" chall.txt ; echo
zh3r0{i5_it_sn0w1ng?}

Flag: zh3r0{i5_it_sn0w1ng?}





[Forensics]: Dozen Bases


Challenge

You were trying to Call someone when you dropped your Dozen eggs in the Base-ment.

Attachment:

  • checkMeOut.wav


Solution

これは意外と解けた人が少なかった (18人) みたいですね。

wavファイルの中にはDTMFの音が入っているので、ツールを使って値を読み取ります。

A2 88 43 96 40 0A 3A 14 09 97 B8 A9 94 59 87 B8 84 48 38 B8 58 47 B4 19 29 84 07 B4 47 BB 97 81 86 43 7B 99 45 41 92 87 7B 58 70 65 5A A5

チャレンジ名の通り、これを12進数として処理する必要があります。アルファベットがAとBしか出てこないのは、12進数だからです。

以下のようなコードを書きました。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

DTMF = ["A2", "88", "43", "96", "40", "A3", "A1", "40", "99", "7B", "8A", "99", "45", "98", "7B", "88", "44", "83", "8B", "85", "84", "7B", "41", "92", "98", "40", "7B", "44", "7B", "97", "81", "86", "43", "7B", "99", "45", "41", "92", "87", "7B", "58", "70", "65", "5A", "A5"]

for n in DTMF:
    if n[1:] == 'A':
        d = int(n[:1],16) * 12 + 10
    elif n[1:] == 'B':
        d = int(n[:1],16) * 12 + 11
    else:
        d = int(n[:1],16) * 12 + int(n[1:])

    print(chr(d),end="")
print()

実行結果:
$ ./dozen_base_solve.py 
zh3r0{y0u_ju5t_h4cked_1nt0_4_saf3_u51ng_DTMF}

Flag: zh3r0{y0u_ju5t_h4cked_1nt0_4_saf3_u51ng_DTMF}





[Subset of subset of hacking machines challenges]: Flag 5


Challenge

Description: Here’s the url ;)

hackit.zh3r0.ml


Solution

Wiresharkでキャプチャーしつつ、nmapしました。

 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
$ sudo nmap -sV -sC hackit.zh3r0.ml
Starting Nmap 7.80 ( https://nmap.org ) at 2020-06-16 20:49 +08
Nmap scan report for hackit.zh3r0.ml (139.59.3.42)
Host is up (0.046s latency).
Not shown: 993 closed ports
PORT     STATE    SERVICE     VERSION
22/tcp   open     http        Apache httpd 2.4.43 ((Unix))
| http-methods: 
|_  Potentially risky methods: TRACE
|_http-server-header: Apache/2.4.43 (Unix)
|_http-title: Site doesn't have a title (text/html).
|_ssh-hostkey: ERROR: Script execution failed (use -d to debug)
99/tcp   open     ssh         OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   2048 70:78:8f:70:79:59:72:5f:05:c9:2a:63:b4:34:c1:52 (RSA)
|   256 08:6d:42:16:2a:47:ae:b4:d7:fa:35:28:91:67:ab:63 (ECDSA)
|_  256 e4:89:6b:09:37:64:c2:47:01:bd:c2:32:d8:cd:06:2d (ED25519)
139/tcp  filtered netbios-ssn
161/tcp  filtered snmp
179/tcp  filtered bgp
646/tcp  filtered ldp
4444/tcp filtered krb524
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 47.14 seconds

httpがポート22で動いてます。まずは、ポート22のトラフィックをを取得したpcapの中で確認すると、z3hr0{shouldve_added_some_filter_here} というフラグが見つかります。

ちなみに、チャレンジのFlag 1 ~ Flag7は全部同じチャレンジ文になっていて、どこにSubmitしたらいいのかがわからないのですが、簡単にフラグが見つかったので、一番Solveが多いFlag 5にSubmitしたら通りました。


Flag: z3hr0{shouldve_added_some_filter_here}



他にやったこと:

GET /robots.txt HTTP/1.1
User-Agent: Mozilla/5.0 (compatible; Nmap Scripting Engine; https://nmap.org/book/nse.html)
Connection: close
Host: hackit.zh3r0.ml:22

HTTP/1.1 200 OK
Date: Tue, 16 Jun 2020 13:20:45 GMT
Server: Apache/2.4.43 (Unix)
Last-Modified: Mon, 15 Jun 2020 15:05:13 GMT
ETag: "6c-5a820c0f31543"
Accept-Ranges: bytes
Content-Length: 108
Connection: close
Content-Type: text/plain

Hmmm you shouldnt be here.... 2yryYz3sx16kWt72agdFZJqxZ5kqqvocsnU416bULtVs63Cvwmvr6f34Ck8sSHQU1PPnQqD7bqW9q

最後のエンコードされた部分はBase58で、"I tried to hide this, anyway, check out /clue3349203.txt" にデコードされます。

このファイルに含まれているデータはJSFuckです。
http://hackit.zh3r0.ml:22/clue3349203.txt


デコードすると、以下になります。
console.log('Employee ID: 865151c643cbbb7e3bf4fd5dbb71354e') 

以下にもアクセスしてみましたが、
http://hackit.zh3r0.ml:22/~865151c643cbbb7e3bf4fd5dbb71354e/

結局、同じフラグ(z3hr0{shouldve_added_some_filter_here})が取れるだけでした。


あとは、ちょっとgobusterとかやったり、SSH周りを見たけど無理そうだったので、潔よく降参しました。





[Master]: Tic Tac Toe


Challenge

Can you beat the image?

Attachment:

  • image


(Unsolved)

$ file image
image: data

$ xxd image | head -n 6
00000000: d9ff 0328 8aa2 0028 8aa2 0028 8aa2 0028  ...(...(...(...(
00000010: 8aa2 0028 8aa2 0028 8aa2 0028 8aa2 0028  ...(...(...(...(
00000020: 8aa2 0028 8aa2 3050 142d 85fc 0000 d041  ...(..0P.-.....A
00000030: 2391 08d4 388e a336 2045 5124 4300 ff9f  #...8..6 EQ$C...
00000040: fbae 0e12 b64c db1a 2ed6 c25b 7890 5b01  .....L.....[x.[.
00000050: f90b 93b1 cfed bd33 27cc f038 fcda 6e2c  .......3'..8..n,

$ xxd image | tail -n 6
000034c0: 0900 4300 dbff 3d6f 414e 5156 5862 3363  ..C...=oANQVXb3c
000034d0: 6b52 764e 4862 3130 6a64 2f67 3259 3046  kRvNHb10jd/g2Y0F
000034e0: 3264 7630 3262 6a35 535a 6956 4864 3139  2dv02bj5SZiVHd19
000034f0: 5765 7563 3364 3339 794c 364d 4863 3052  Weuc3d39yL6MHc0R
00003500: 4861 3e00 feff 0000 0100 0100 0001 0100  Ha>.............
00003510: 4649 464a 1000 e0ff d8ff                 FIFJ......

なんとなく、バイトリバースっぽかったので、試したら正解でした。

$ python -c 'open("image.out", "wb").write(open("image", "rb").read()[::-1]) '

$ file image.out
image.out: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, comment: "aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj01bHNvRkc3bXVQNAo=", baseline, precision 8, 522x567, components 3

コメントにかかれているのは、YouTubeへのリンクです。
$ echo "aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj01bHNvRkc3bXVQNAo=" | base64 -d
https://www.youtube.com/watch?v=5lsoFG7muP4

Kapela というバンドの 「Rock My Way」という曲の動画です。

「Kapela」とか、そこら辺をパスワードに steghide で解くのかなぁと思ったんですが全くダメで、ここで詰まりました。

$ steghide extract -p 'Kapela' -sf image.jpg
steghide: could not extract any data with that passphrase!