こんとろーるしーこんとろーるぶい

週末にカチャカチャッターン!したことを貼り付けていくブログ

HackIT CTF 2018 - Get Going

問題文

Welcome

f:id:graneed:20180910192201p:plain

writeup

画面の表示上は普通の文字列だが、WelcomeのWとelcomeの間に、複数種類の空白文字が含まれている。

root@kali:~# curl https://ctf.hackit.ua/w31c0m3 -o welcome.txt -s
root@kali:~# od -Ax -tx1z welcome.txt 
000000 57 e2 80 8b e2 80 8b e2 80 8b e2 80 8b e2 80 8f  >W...............<
000010 e2 80 8b e2 80 8d e2 80 8b e2 80 8b e2 80 8b e2  >................<
000020 80 8b e2 80 8f e2 80 8c e2 80 8e e2 80 8b e2 80  >................<
000030 8b e2 80 8b e2 80 8b e2 80 8e e2 80 8f e2 80 8d  >................<
000040 e2 80 8b e2 80 8b e2 80 8b e2 80 8b e2 80 8f e2  >................<
000050 80 8b e2 80 8e e2 80 8b e2 80 8b e2 80 8b e2 80  >................<
000060 8b e2 80 8f e2 80 8f e2 80 8e e2 80 8b e2 80 8b  >................<
000070 e2 80 8b e2 80 8b e2 80 8f e2 80 8e e2 80 8f e2  >................<
000080 80 8b e2 80 8b e2 80 8b e2 80 8b e2 80 8d e2 80  >................<
000090 8b e2 80 8c e2 80 8b e2 80 8b e2 80 8b e2 80 8b  >................<
0000a0 e2 80 8e e2 80 8f e2 80 8b e2 80 8b e2 80 8b e2  >................<
0000b0 80 8b e2 80 8b e2 80 8f e2 80 8b e2 80 8e e2 80  >................<
0000c0 8b e2 80 8b e2 80 8b e2 80 8b e2 80 8f e2 80 8d  >................<
0000d0 e2 80 8f e2 80 8b e2 80 8b e2 80 8b e2 80 8b e2  >................<
0000e0 80 8d e2 80 8b e2 80 8c e2 80 8b e2 80 8b e2 80  >................<
0000f0 8b e2 80 8b e2 80 8d e2 80 8b e2 80 8c e2 80 8b  >................<
000100 e2 80 8b e2 80 8b e2 80 8b e2 80 8d e2 80 8c e2  >................<
000110 80 8b e2 80 8b e2 80 8b e2 80 8b e2 80 8b e2 80  >................<
000120 8e e2 80 8f e2 80 8b e2 80 8b e2 80 8b e2 80 8b  >................<
000130 e2 80 8b e2 80 8f e2 80 8b e2 80 8f e2 80 8b e2  >................<
000140 80 8b e2 80 8b e2 80 8b e2 80 8d e2 80 8b e2 80  >................<
000150 8d e2 80 8b e2 80 8b e2 80 8b e2 80 8b e2 80 8e  >................<
000160 e2 80 8f e2 80 8f e2 80 8b e2 80 8b e2 80 8b e2  >................<
000170 80 8b e2 80 8f e2 80 8c e2 80 8d e2 80 8b e2 80  >................<
000180 8b e2 80 8b e2 80 8b e2 80 8d e2 80 8b e2 80 8c  >................<
000190 e2 80 8b e2 80 8b e2 80 8b e2 80 8b e2 80 8f e2  >................<
0001a0 80 8d e2 80 8f e2 80 8b e2 80 8b e2 80 8b e2 80  >................<
0001b0 8b e2 80 8f e2 80 8f e2 80 8d e2 80 8b e2 80 8b  >................<
0001c0 e2 80 8b e2 80 8b e2 80 8e e2 80 8f e2 80 8b e2  >................<
0001d0 80 8b e2 80 8b e2 80 8b e2 80 8b e2 80 8f e2 80  >................<
0001e0 8e e2 80 8f e2 80 8b e2 80 8b e2 80 8b e2 80 8b  >................<
0001f0 e2 80 8c e2 80 8f e2 80 8f e2 80 8b e2 80 8b e2  >................<
000200 80 8b e2 80 8b e2 80 8f e2 80 8e e2 80 8c e2 80  >................<
000210 8b e2 80 8b e2 80 8b e2 80 8b e2 80 8f e2 80 8b  >................<
000220 e2 80 8f e2 80 8b e2 80 8b e2 80 8b e2 80 8b e2  >................<
000230 80 8e e2 80 8f e2 80 8b e2 80 8b e2 80 8b e2 80  >................<
000240 8b e2 80 8b e2 80 8f e2 80 8e e2 80 8d e2 80 8b  >................<
000250 e2 80 8b e2 80 8b e2 80 8b e2 80 8f e2 80 8d e2  >................<
000260 80 8b e2 80 8b e2 80 8b e2 80 8b e2 80 8b e2 80  >................<
000270 8c e2 80 8f e2 80 8f e2 80 8b e2 80 8b e2 80 8b  >................<
000280 e2 80 8b e2 80 8e e2 80 8f e2 80 8f e2 80 8b e2  >................<
000290 80 8b e2 80 8b e2 80 8b e2 80 8c e2 80 8f e2 80  >................<
0002a0 8e e2 80 8b e2 80 8b e2 80 8b e2 80 8b e2 80 8f  >................<
0002b0 e2 80 8b e2 80 8b e2 80 8b e2 80 8b e2 80 8b e2  >................<
0002c0 80 8b e2 80 8d e2 80 8b e2 80 8c e2 80 8b e2 80  >................<
0002d0 8b e2 80 8b e2 80 8c e2 80 8b e2 80 8b e2 80 8b  >................<
0002e0 65 6c 63 6f 6d 65 20 74 6f 20 74 68 65 20 48 61  >elcome to the Ha<
0002f0 63 6b 49 54 20 32 30 31 38 20 43 54 46 2c 20 66  >ckIT 2018 CTF, f<
000300 6c 61 67 20 69 73 20 73 6f 6d 65 77 68 65 72 65  >lag is somewhere<
000310 20 68 65 72 65 2e 20 c2 af 5f 28 e3 83 84 29 5f  > here. .._(...)_<
000320 2f c2 af 0a                                      >/...<
000324

Wとelcomeの間に含まれている空白文字は以下の5種類。

  • e2808b=U+200B
  • e2808c=U+200C
  • e2808d=U+200D
  • e2808e=U+200E
  • e2808f=U+200F

以下のヒントが出ていた。

Get Going hint2: Zero Width Concept.

Zero Width Steganoのキーワードでgoogle検索すると以下がHIT。

Unicode Steganography with Zero-Width Characters

上記5つの空白文字が網羅されていないが、ライブラリの仕様を見ると、取り扱い対象とする空白文字を任意に設定可能なようだ。

http://330k.github.io/misc_tools/unicode_steganography.js

まず、こちらを全コピーして、Chromeの開発者ツールのコンソールに貼り付ける。その後、コンソールで以下のコマンドを実行し、U+200B~U+200Fをsteganoの対象文字とする。

>unicodeSteganographer.setUseChars('\u200b\u200c\u200d\u200e\u200f');
<null

デコードを実行する。

>unicodeSteganographer.decodeText("​​​​‏​‍​​​​‏‌​​​​‏‍​​​​‏​​​​​‏‏​​​​‏‏​​​​‍​‌​​​​‏​​​​​‏​​​​​‏‍‏​​​​‍​‌​​​​‍​‌​​​​‍‌​​​​​‏​​​​​‏​‏​​​​‍​‍​​​​‏‏​​​​‏‌‍​​​​‍​‌​​​​‏‍‏​​​​‏‏‍​​​​‏​​​​​‏‏​​​​‌‏‏​​​​‏‌​​​​‏​‏​​​​‏​​​​​‏‍​​​​‏‍​​​​​‌‏‏​​​​‏‏​​​​‌‏​​​​‏​​​​​​‍​‌​​​‌​​​") ←見えないが、ここに空白文字列をセットしている。
<{originalText: "", hiddenText: "flag{w3_gr337_h4ck3rz_w1th_un1c0d3}"}

フラグゲット。
flag{w3_gr337_h4ck3rz_w1th_un1c0d3}

この問題、1ポイントだけど、1ポイントのレベルではないような・・・。